From a8543c98175beb903cc3b05ccbc02a272c8413cf Mon Sep 17 00:00:00 2001 From: GodsQuantum <193283917+GodsQuantum@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:10:07 +0100 Subject: [PATCH 1/7] feat: add stateless local-or-remote dictation using existing ASR providers --- frontend/src/lib/api.ts | 14 +- frontend/src/lib/dictation.ts | 13 + frontend/src/lib/types.ts | 7 + frontend/src/lib/ui-mode.ts | 4 +- frontend/src/lib/views/DictationView.svelte | 200 ++++++++++ frontend/src/routes/+page.svelte | 2 + frontend/tests/dictation.test.mjs | 26 ++ frontend/tests/ui-mode.test.mjs | 7 +- src/api/dictation.rs | 414 ++++++++++++++++++++ src/api/mod.rs | 7 + 10 files changed, 688 insertions(+), 6 deletions(-) create mode 100644 frontend/src/lib/dictation.ts create mode 100644 frontend/src/lib/views/DictationView.svelte create mode 100644 frontend/tests/dictation.test.mjs create mode 100644 src/api/dictation.rs diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 4a9c53d..97ceecb 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1,8 +1,8 @@ import { parseApiResponse } from './api-response.js'; import type { - EmbeddedRuntimeStatus, Space, SpaceMembership, SpaceKind, + DictationResult, EmbeddedRuntimeStatus, Space, SpaceMembership, SpaceKind, BrowseResponse, DashboardStats, ExportFormat, Job, LiveUploadManifest, LlmProvider, LlmProviderInput, - Provider, ProviderInput, QuickOptions, ReportEncounter, SavedReport, StructureProfile, Workflow + Provider, ProviderInput, TranscriptionRoute, QuickOptions, ReportEncounter, SavedReport, StructureProfile, Workflow } from './types'; export class ApiError extends Error { @@ -163,6 +163,16 @@ export const api = { retryJob: (id: string) => request(`/api/v1/jobs/${id}/retry`, { method: 'POST' }), cancelJob: (id: string) => request(`/api/v1/jobs/${id}/cancel`, { method: 'POST' }), deleteJob: (id: string) => request(`/api/v1/jobs/${id}`, { method: 'DELETE' }), + dictationTranscribe: async ( + file:File, + options:{transcriptionChain:TranscriptionRoute[];language?:string}, + ):Promise => { + const form=new FormData(); + form.append('file',file); + form.append('transcriptionChain',JSON.stringify(options.transcriptionChain)); + form.append('language',options.language??''); + return request('/api/v1/dictation/transcribe',{method:'POST',body:form}); + }, quickServer: (sourcePath: string, options: QuickOptions) => request('/api/v1/quick/server', { method: 'POST', body: JSON.stringify({ sourcePath, ...options }) }), diff --git a/frontend/src/lib/dictation.ts b/frontend/src/lib/dictation.ts new file mode 100644 index 0000000..4f598dc --- /dev/null +++ b/frontend/src/lib/dictation.ts @@ -0,0 +1,13 @@ +/** Prefer native browser encoders over an extra transcription runtime. */ +export const recorderFormats = ['audio/webm;codecs=opus','audio/mp4','audio/ogg;codecs=opus'] as const; +export function chooseRecorderMime(supports:(mime:string)=>boolean):string { + return recorderFormats.find(supports)??''; +} +export function recordedFile(chunks:Blob[], mime:string, date=new Date()):File { + const blob=new Blob(chunks,{type:mime||chunks[0]?.type||'audio/webm'}); + if(!blob.size)throw new Error('Aucun son enregistré.'); + if(blob.size>12*1024*1024)throw new Error('Dictée trop longue : maximum 12 Mio.'); + const ext=blob.type.includes('mp4')?'m4a':blob.type.includes('ogg')?'ogg':'webm'; + const name='dictation-'+date.toISOString().replace(/[:.]/g,'-')+'.'+ext; + return new File([blob],name,{type:blob.type}); +} diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 96a4160..83618f3 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -176,6 +176,13 @@ export interface Job { updatedAtMs: number; } +export interface DictationResult { + text: string; + providerId: string; + model: string; + elapsedMs: number; +} + export interface QuickOptions { providerId?: string; model?: string; diff --git a/frontend/src/lib/ui-mode.ts b/frontend/src/lib/ui-mode.ts index 7383923..a07c256 100644 --- a/frontend/src/lib/ui-mode.ts +++ b/frontend/src/lib/ui-mode.ts @@ -1,9 +1,10 @@ /** A reduced navigation surface; advanced features are never disabled. */ export type UiMode='simple'|'advanced'; -export type View='home'|'quick'|'live'|'workflows'|'jobs'|'settings'; +export type View='home'|'quick'|'live'|'dictation'|'workflows'|'jobs'|'settings'; const simpleItems=[ {id:'home',label:'Home',glyph:'⌂'}, {id:'live',label:'REC',glyph:'●'}, + {id:'dictation',label:'Dictée',glyph:'⌨'}, {id:'jobs',label:'Documents',glyph:'≡'}, {id:'settings',label:'Settings',glyph:'⚙'} ] as const; @@ -11,6 +12,7 @@ const advancedItems=[ {id:'home',label:'Home',glyph:'⌂'}, {id:'quick',label:'Quick',glyph:'✦'}, {id:'live',label:'REC',glyph:'●'}, + {id:'dictation',label:'Dictée',glyph:'⌨'}, {id:'workflows',label:'Workflows',glyph:'↻'}, {id:'jobs',label:'Documents',glyph:'≡'}, {id:'settings',label:'Settings',glyph:'⚙'} diff --git a/frontend/src/lib/views/DictationView.svelte b/frontend/src/lib/views/DictationView.svelte new file mode 100644 index 0000000..4319e0b --- /dev/null +++ b/frontend/src/lib/views/DictationView.svelte @@ -0,0 +1,200 @@ + + +
+
+
+

DICTÉE · LOCAL OU DISTANT

+

Dictée

+

Enregistrez quelques secondes, puis copiez le texte. Aucun enregistrement ni job permanent.

+
+
+
+
+
+ 1. Moteur de transcription et repli + routes=next}/> +
+
+ + +
+
+ + +
+
+ 2. Microphone +

Ctrl+Maj+D dans cette fenêtre. Le raccourci système global nécessite une extension du lanceur natif.

+ {#if recording} + + Enregistrement en cours… + {:else} + + {/if} +
+
+ +
+
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index d100871..332e4fd 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -9,6 +9,7 @@ import DashboardView from '$lib/views/DashboardView.svelte'; import QuickTranscribeView from '$lib/views/QuickTranscribeView.svelte'; import LiveRecordView from '$lib/views/LiveRecordView.svelte'; + import DictationView from '$lib/views/DictationView.svelte'; import WorkflowsView from '$lib/views/WorkflowsView.svelte'; import SettingsView from '$lib/views/SettingsView.svelte'; import JobsView from '$lib/views/JobsView.svelte'; @@ -124,6 +125,7 @@ {:else if active==='home'} {:else if active==='quick'} {:else if active==='live'} + {:else if active==='dictation'} {:else if active==='workflows'} {:else if active==='settings'} {:else}{ + assert.equal(chooseRecorderMime(m=>m==='audio/mp4'),'audio/mp4'); + assert.equal(chooseRecorderMime(()=>false),''); + assert.equal(chooseRecorderMime(()=>true),'audio/webm;codecs=opus'); +}); +test('dictation builds one bounded audio file without disk persistence',()=>{ + const file=recordedFile([new Blob(['sound'],{type:'audio/webm'})], 'audio/webm', new Date('2026-11-18T08:00:00Z')); + assert.equal(file.type,'audio/webm'); + assert.equal(file.size,5); + assert.match(file.name,/dictation-2026-11-18T08-00-00-000Z.webm/); + assert.throws(()=>recordedFile([], ''),/Aucun son/); + assert.throws(()=>recordedFile([new Blob([new Uint8Array(12*1024*1024+1)])],''),/maximum 12/); +}); +test('dictation UI reuses providers and optional structure instead of a second engine',async()=>{ + const fs=await import('node:fs/promises'); + const body=await fs.readFile(new URL('../src/lib/views/DictationView.svelte',import.meta.url),'utf8'); + assert.match(body,/TranscriptionChainEditor/); + assert.match(body,/api\.dictationTranscribe\(/); + assert.match(body,/api\.structureExisting\(/); + assert.match(body,/releaseMicrophone/); + assert.match(body,/navigator\.clipboard\.writeText/); +}); diff --git a/frontend/tests/ui-mode.test.mjs b/frontend/tests/ui-mode.test.mjs index 0b29eff..ced7b69 100644 --- a/frontend/tests/ui-mode.test.mjs +++ b/frontend/tests/ui-mode.test.mjs @@ -2,16 +2,17 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { navigationItems, navigationAllows, normalizeMode, normalizeView } from '../src/lib/ui-mode.ts'; -test('new installs expose only the four essential destinations', () => { +test('new installs expose recording, dictation and essential destinations', () => { assert.equal(normalizeMode(null), 'simple'); - assert.deepEqual(navigationItems('simple').map(item => item.id), ['home', 'live', 'jobs', 'settings']); + assert.deepEqual(navigationItems('simple').map(item => item.id), ['home', 'live', 'dictation', 'jobs', 'settings']); assert.equal(navigationAllows('simple', 'providers'), false); assert.equal(navigationAllows('simple', 'settings'), true); + assert.equal(navigationAllows('simple', 'dictation'), true); }); test('advanced mode preserves existing workflows without showing two configuration sections in the rail', () => { assert.deepEqual(navigationItems('advanced').map(item => item.id), - ['home', 'quick', 'live', 'workflows', 'jobs', 'settings']); + ['home', 'quick', 'live', 'dictation', 'workflows', 'jobs', 'settings']); assert.equal(navigationAllows('advanced', 'workflows'), true); assert.equal(navigationAllows('advanced', 'ai'), false); assert.equal(normalizeMode('advanced'), 'advanced'); diff --git a/src/api/dictation.rs b/src/api/dictation.rs new file mode 100644 index 0000000..70ebf9a --- /dev/null +++ b/src/api/dictation.rs @@ -0,0 +1,414 @@ +use crate::{ + domain::TranscriptionRoute, + error::{AppError, AppResult}, + provider, + state::AppState, +}; +use axum::{ + Json, + extract::{Multipart, State}, +}; +use serde::Serialize; +use std::{path::PathBuf, time::Instant}; +use tokio_util::sync::CancellationToken; +use uuid::Uuid; + +/// Short dictation is intentionally stateless: no database job, retained recording, +/// second STT engine, or background process. The active provider and model are reused. +const MAX_AUDIO_BYTES: usize = 12 * 1024 * 1024; +const MAX_ROUTES: usize = 4; + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DictationResult { + text: String, + provider_id: String, + model: String, + elapsed_ms: u64, +} + +struct StagedAudio(PathBuf); + +impl Drop for StagedAudio { + fn drop(&mut self) { + let _ = std::fs::remove_file(&self.0); + } +} + +fn audio_extension(mime: &str, filename: &str) -> &'static str { + let mime = mime.to_ascii_lowercase(); + if mime.contains("webm") { + return "webm"; + } + if mime.contains("mp4") || mime.contains("m4a") { + return "m4a"; + } + if mime.contains("ogg") { + return "ogg"; + } + if mime.contains("wav") { + return "wav"; + } + if mime.contains("flac") { + return "flac"; + } + match filename + .rsplit('.') + .next() + .unwrap_or("") + .to_ascii_lowercase() + .as_str() + { + "webm" => "webm", + "m4a" | "mp4" => "m4a", + "ogg" | "opus" => "ogg", + "wav" => "wav", + "flac" => "flac", + _ => "webm", + } +} + +fn parse_routes( + json: Option<&str>, + provider_id: &str, + model: &str, +) -> Result, AppError> { + let routes: Vec = match json.map(str::trim).filter(|s| !s.is_empty()) { + Some(raw) if raw.len() <= 4096 => serde_json::from_str(raw) + .map_err(|_| AppError::BadRequest("invalid transcriptionChain".into()))?, + Some(_) => return Err(AppError::BadRequest("transcriptionChain too large".into())), + None if !provider_id.trim().is_empty() => vec![TranscriptionRoute { + provider_id: provider_id.trim().to_owned(), + model: model.trim().to_owned(), + fallback_after_seconds: None, + }], + None => Vec::new(), + }; + if routes.is_empty() + || routes.len() > MAX_ROUTES + || routes + .iter() + .any(|r| r.provider_id.trim().is_empty() || r.fallback_after_seconds == Some(0)) + { + return Err(AppError::BadRequest( + "select 1 to 4 valid transcription routes".into(), + )); + } + Ok(routes) +} + +/// Multipart: file, transcriptionChain (optional), providerId, model, language. +/// Audio and transcript exist only for this request; nothing is persisted to SQLite. +pub async fn transcribe( + State(state): State, + mut multipart: Multipart, +) -> AppResult> { + let mut bytes: Option> = None; + let mut extension = "webm"; + let mut provider_id = String::new(); + let mut model = String::new(); + let mut language = String::new(); + let mut chain = None; + while let Some(mut field) = multipart + .next_field() + .await + .map_err(|_| AppError::BadRequest("invalid dictation upload".into()))? + { + let name = field.name().unwrap_or_default().to_owned(); + if name == "file" { + if bytes.is_some() { + return Err(AppError::BadRequest( + "only one audio file is accepted".into(), + )); + } + extension = audio_extension( + field.content_type().unwrap_or(""), + field.file_name().unwrap_or(""), + ); + let mut audio = Vec::new(); + while let Some(chunk) = field + .chunk() + .await + .map_err(|_| AppError::BadRequest("invalid audio data".into()))? + { + if audio.len().saturating_add(chunk.len()) > MAX_AUDIO_BYTES { + return Err(AppError::BadRequest("dictation exceeds 12 MiB".into())); + } + audio.extend_from_slice(&chunk); + } + bytes = Some(audio); + } else if matches!( + name.as_str(), + "providerId" | "model" | "language" | "transcriptionChain" + ) { + let text = field + .text() + .await + .map_err(|_| AppError::BadRequest("invalid dictation option".into()))?; + if text.len() > 4096 { + return Err(AppError::BadRequest("dictation option too large".into())); + } + match name.as_str() { + "providerId" => provider_id = text, + "model" => model = text, + "language" => language = text, + "transcriptionChain" => chain = Some(text), + _ => {} + } + } + } + let audio = bytes.ok_or_else(|| AppError::BadRequest("audio file is required".into()))?; + if audio.len() < 128 { + return Err(AppError::BadRequest( + "audio file is empty or too short".into(), + )); + } + let routes = parse_routes(chain.as_deref(), &provider_id, &model)?; + let available = state.providers.read().await.clone(); + // Reject an invalid/unavailable selection rather than silently routing elsewhere. + for route in &routes { + if !available + .iter() + .any(|p| p.id == route.provider_id && p.enabled) + { + return Err(AppError::BadRequest( + "selected transcription provider is unavailable".into(), + )); + } + } + let path = + state + .config + .quick_upload_dir() + .join(format!("dictation-{}.{}", Uuid::new_v4(), extension)); + tokio::fs::write(&path, &audio) + .await + .map_err(AppError::from)?; + drop(audio); + let file = StagedAudio(path); + let _slot = state + .transcription_slots + .clone() + .acquire_owned() + .await + .map_err(|_| AppError::Internal(anyhow::anyhow!("transcription scheduler unavailable")))?; + let started = Instant::now(); + for route in routes { + let Some(mut current) = available + .iter() + .find(|p| p.id == route.provider_id) + .cloned() + else { + continue; + }; + if let Some(seconds) = route.fallback_after_seconds { + current.timeout_seconds = current.timeout_seconds.min(seconds); + } + let selected_model = if route.model.trim().is_empty() { + current.model.clone() + } else { + route.model.trim().to_owned() + }; + let token = CancellationToken::new(); + match provider::transcribe( + ¤t, + &selected_model, + Some(&language), + &file.0, + &state.http, + &token, + ) + .await + { + Ok(text) => { + return Ok(Json(DictationResult { + text, + provider_id: current.id, + model: selected_model, + elapsed_ms: started.elapsed().as_millis().min(u64::MAX as u128) as u64, + })); + } + Err(_error) => tracing::warn!( + provider_id = %current.id, + "dictation provider failed; trying next configured route" + ), + } + } + Err(AppError::Upstream( + "all selected transcription routes failed".into(), + )) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn detects_upload_format_without_trusting_filename_extensions() { + assert_eq!(audio_extension("audio/webm;codecs=opus", "foo.wav"), "webm"); + assert_eq!(audio_extension("audio/mp4", "foo.webm"), "m4a"); + assert_eq!(audio_extension("", "test.FLAC"), "flac"); + assert_eq!(audio_extension("", "../../untrusted.exe"), "webm"); + } + #[test] + fn checks_provider_selection_and_bounded_chain() { + assert!(parse_routes(None, "", "").is_err()); + assert!(parse_routes(Some("[]"), "", "").is_err()); + let one = parse_routes(None, "local", "").unwrap(); + assert_eq!(one[0].provider_id, "local"); + assert!( + parse_routes( + Some("[{\"providerId\":\"x\",\"model\":\"\",\"fallbackAfterSeconds\":0}]"), + "", + "" + ) + .is_err() + ); + assert!(parse_routes(Some("bad json"), "", "").is_err()); + } +} + +#[cfg(test)] +mod integration_tests { + use super::*; + use crate::{config::Config, domain::Provider}; + use axum::{Router, body::Bytes, routing::post}; + use reqwest::multipart::{Form, Part}; + use serde_json::{Value, json}; + + fn tiny_wav() -> Vec { + let mut bytes = vec![0u8; 44 + 16000]; + bytes[..4].copy_from_slice(b"RIFF"); + bytes[4..8].copy_from_slice(&(16036u32).to_le_bytes()); + bytes[8..12].copy_from_slice(b"WAVE"); + bytes[12..16].copy_from_slice(b"fmt "); + bytes[16..20].copy_from_slice(&16u32.to_le_bytes()); + bytes[20..22].copy_from_slice(&1u16.to_le_bytes()); + bytes[22..24].copy_from_slice(&1u16.to_le_bytes()); + bytes[24..28].copy_from_slice(&16000u32.to_le_bytes()); + bytes[28..32].copy_from_slice(&32000u32.to_le_bytes()); + bytes[32..34].copy_from_slice(&2u16.to_le_bytes()); + bytes[34..36].copy_from_slice(&16u16.to_le_bytes()); + bytes[36..40].copy_from_slice(b"data"); + bytes[40..44].copy_from_slice(&16000u32.to_le_bytes()); + bytes + } + + async fn setup() -> (tempfile::TempDir, AppState, String) { + let temp = tempfile::tempdir().unwrap(); + let root = temp.path(); + let allowed = root.join("allowed"); + std::fs::create_dir_all(&allowed).unwrap(); + let config = Config { + host: "127.0.0.1".into(), + port: 0, + config_dir: root.join("config"), + dist_dir: root.join("dist"), + data_dir: root.join("data"), + allowed_roots: vec![allowed], + scan_seconds: 1, + file_stability_ms: 20, + max_transcription_jobs: 1, + max_upload_bytes: 16 * 1024 * 1024, + quick_result_retention_hours: 24, + quick_source_retention_hours: 24, + normalized_audio_format: "wav".into(), + ffmpeg_threads: 1, + }; + let state = AppState::load(config).await.unwrap(); + let stub = Router::new().route( + "/v1/audio/transcriptions", + post(|_body: Bytes| async { Json(json!({"text":"bonjour dictée"})) }), + ); + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let upstream = listener.local_addr().unwrap(); + tokio::spawn(async move { axum::serve(listener, stub).await.unwrap() }); + let provider = Provider { + id: "local-test".into(), + name: "Local test".into(), + transcription_url: format!("http://{upstream}/v1/audio/transcriptions"), + model: "fake-asr".into(), + api_key: String::new(), + timeout_seconds: 5, + enabled: true, + }; + state + .db + .upsert("provider", &provider.id, &provider) + .unwrap(); + state.providers.write().await.push(provider); + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let addr = listener.local_addr().unwrap(); + let app = crate::api::router().with_state(state.clone()); + tokio::spawn(async move { axum::serve(listener, app).await.unwrap() }); + (temp, state, format!("http://{addr}")) + } + + fn form(provider: &str, file: Vec) -> Form { + Form::new() + .text("providerId", provider.to_string()) + .text("language", "fr") + .part( + "file", + Part::bytes(file) + .file_name("test.wav") + .mime_str("audio/wav") + .unwrap(), + ) + } + + #[tokio::test] + async fn direct_dictation_returns_text_with_no_persistent_job_or_audio() { + let (_tmp, state, base) = setup().await; + let before = state.db.list::("job").unwrap().len(); + let response = reqwest::Client::new() + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart(form("local-test", tiny_wav())) + .send() + .await + .unwrap(); + assert_eq!(response.status(), reqwest::StatusCode::OK); + let result: Value = response.json().await.unwrap(); + assert_eq!(result["text"], "bonjour dictée"); + assert_eq!(result["providerId"], "local-test"); + assert_eq!(result["model"], "fake-asr"); + let after = state.db.list::("job").unwrap().len(); + assert_eq!(before, after, "dictation must not create a stored job"); + assert!( + std::fs::read_dir(state.config.quick_upload_dir()) + .unwrap() + .filter_map(Result::ok) + .all(|entry| !entry + .file_name() + .to_string_lossy() + .starts_with("dictation-")), + "dictation audio must be removed after completion" + ); + } + + #[tokio::test] + async fn invalid_provider_and_oversized_body_fail_without_jobs() { + let (_tmp, state, base) = setup().await; + let client = reqwest::Client::new(); + let response = client + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart(form("missing", tiny_wav())) + .send() + .await + .unwrap(); + assert_eq!(response.status(), reqwest::StatusCode::BAD_REQUEST); + let response = client + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart(form("local-test", vec![1u8; 12 * 1024 * 1024 + 1])) + .send() + .await + .unwrap(); + assert!(matches!(response.status().as_u16(), 400 | 413)); + assert!( + state + .db + .list::("job") + .unwrap() + .is_empty() + ); + } +} diff --git a/src/api/mod.rs b/src/api/mod.rs index 03b8209..41e7ebe 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,6 +1,7 @@ pub mod ai; pub mod browse; pub mod dashboard; +pub mod dictation; pub mod embedded; pub mod events; pub mod jobs; @@ -61,6 +62,12 @@ pub fn router() -> Router { .route("/api/v1/ready", get(ready)) .route("/api/v1/dashboard", get(dashboard::stats)) .route("/api/v1/events", get(events::events)) + .route( + "/api/v1/dictation/transcribe", + post(dictation::transcribe).layer(axum::extract::DefaultBodyLimit::max( + 12 * 1024 * 1024 + 8192, + )), + ) .route("/api/v1/browse", get(browse::browse)) .route( "/api/v1/providers", From 03b2820ad7dc3869fad19834bca14720292e5026 Mon Sep 17 00:00:00 2001 From: GodsQuantum <193283917+GodsQuantum@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:12:39 +0100 Subject: [PATCH 2/7] test: verify provider fallback for stateless dictation --- src/api/dictation.rs | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/api/dictation.rs b/src/api/dictation.rs index 70ebf9a..12047cc 100644 --- a/src/api/dictation.rs +++ b/src/api/dictation.rs @@ -385,6 +385,64 @@ mod integration_tests { ); } + #[tokio::test] + async fn provider_failure_falls_back_to_the_next_selected_endpoint() { + let (_tmp, state, base) = setup().await; + let fail = Router::new().route( + "/v1/audio/transcriptions", + post(|| async { + ( + axum::http::StatusCode::SERVICE_UNAVAILABLE, + Json(json!({"error":"test"})), + ) + }), + ); + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let upstream = listener.local_addr().unwrap(); + tokio::spawn(async move { axum::serve(listener, fail).await.unwrap() }); + let provider = Provider { + id: "failing-test".into(), + name: "Failing test".into(), + transcription_url: format!("http://{upstream}/v1/audio/transcriptions"), + model: "missing".into(), + api_key: String::new(), + timeout_seconds: 3, + enabled: true, + }; + state.providers.write().await.push(provider); + let chain = json!([ + {"providerId":"failing-test","model":"missing"}, + {"providerId":"local-test","model":"fake-asr"} + ]); + let response = reqwest::Client::new() + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart( + Form::new() + .text("transcriptionChain", chain.to_string()) + .part( + "file", + Part::bytes(tiny_wav()) + .file_name("test.wav") + .mime_str("audio/wav") + .unwrap(), + ), + ) + .send() + .await + .unwrap(); + assert_eq!(response.status(), reqwest::StatusCode::OK); + let result: Value = response.json().await.unwrap(); + assert_eq!(result["providerId"], "local-test"); + assert_eq!(result["text"], "bonjour dictée"); + assert!( + state + .db + .list::("job") + .unwrap() + .is_empty() + ); + } + #[tokio::test] async fn invalid_provider_and_oversized_body_fail_without_jobs() { let (_tmp, state, base) = setup().await; From 61c066e8b445cd9b4532dbf79f9b2c3fd9c77177 Mon Sep 17 00:00:00 2001 From: GodsQuantum <193283917+GodsQuantum@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:25:08 +0100 Subject: [PATCH 3/7] feat(dictation): native Handy Rust capture with streaming ASR and systemwide paste --- frontend/src/lib/api.ts | 7 +- frontend/src/lib/dictation.ts | 1 - frontend/src/lib/types.ts | 6 + frontend/src/lib/views/DictationView.svelte | 29 +- frontend/tests/dictation.test.mjs | 4 +- packaging/desktop/launcher/Cargo.lock | 2000 ++++++++++++++++- packaging/desktop/launcher/Cargo.toml | 21 + .../desktop/launcher/src/desktop_tray.rs | 127 +- packaging/desktop/launcher/src/main.rs | 7 + .../desktop/launcher/src/native_dictation.rs | 286 +++ src/api/dictation.rs | 307 ++- src/api/mod.rs | 8 +- 12 files changed, 2705 insertions(+), 98 deletions(-) create mode 100644 packaging/desktop/launcher/src/native_dictation.rs diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 97ceecb..e26814f 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -1,6 +1,6 @@ import { parseApiResponse } from './api-response.js'; import type { - DictationResult, EmbeddedRuntimeStatus, Space, SpaceMembership, SpaceKind, + DictationResult, DictationSettings, EmbeddedRuntimeStatus, Space, SpaceMembership, SpaceKind, BrowseResponse, DashboardStats, ExportFormat, Job, LiveUploadManifest, LlmProvider, LlmProviderInput, Provider, ProviderInput, TranscriptionRoute, QuickOptions, ReportEncounter, SavedReport, StructureProfile, Workflow } from './types'; @@ -163,6 +163,11 @@ export const api = { retryJob: (id: string) => request(`/api/v1/jobs/${id}/retry`, { method: 'POST' }), cancelJob: (id: string) => request(`/api/v1/jobs/${id}/cancel`, { method: 'POST' }), deleteJob: (id: string) => request(`/api/v1/jobs/${id}`, { method: 'DELETE' }), + dictationSettings: () => request('/api/v1/dictation/settings'), + saveDictationSettings: (settings:DictationSettings) => + request('/api/v1/dictation/settings', { + method:'PUT',body:JSON.stringify(settings) + }), dictationTranscribe: async ( file:File, options:{transcriptionChain:TranscriptionRoute[];language?:string}, diff --git a/frontend/src/lib/dictation.ts b/frontend/src/lib/dictation.ts index 4f598dc..fb6ee33 100644 --- a/frontend/src/lib/dictation.ts +++ b/frontend/src/lib/dictation.ts @@ -6,7 +6,6 @@ export function chooseRecorderMime(supports:(mime:string)=>boolean):string { export function recordedFile(chunks:Blob[], mime:string, date=new Date()):File { const blob=new Blob(chunks,{type:mime||chunks[0]?.type||'audio/webm'}); if(!blob.size)throw new Error('Aucun son enregistré.'); - if(blob.size>12*1024*1024)throw new Error('Dictée trop longue : maximum 12 Mio.'); const ext=blob.type.includes('mp4')?'m4a':blob.type.includes('ogg')?'ogg':'webm'; const name='dictation-'+date.toISOString().replace(/[:.]/g,'-')+'.'+ext; return new File([blob],name,{type:blob.type}); diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 83618f3..c1f8065 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -176,6 +176,12 @@ export interface Job { updatedAtMs: number; } +export interface DictationSettings { + transcriptionChain: TranscriptionRoute[]; + language: string; + structureProfileId?: string | null; +} + export interface DictationResult { text: string; providerId: string; diff --git a/frontend/src/lib/views/DictationView.svelte b/frontend/src/lib/views/DictationView.svelte index 4319e0b..72273b6 100644 --- a/frontend/src/lib/views/DictationView.svelte +++ b/frontend/src/lib/views/DictationView.svelte @@ -11,6 +11,7 @@ let routes:TranscriptionRoute[]=[{providerId:'',model:''}]; let initialized=false; + let saving=false; let language='fr'; let profileId=''; let recording=false; @@ -107,8 +108,29 @@ notify('error','Copie indisponible : sélectionnez le texte manuellement.'); } } + async function saveSettings(){ + if(!routes.length||routes.some(route=>!route.providerId)||saving)return; + saving=true; + try{ + await api.saveDictationSettings({ + transcriptionChain:routes,language,structureProfileId:profileId||null + }); + notify('success','Préférences enregistrées pour la dictée système.'); + }catch(error){ + notify('error',error instanceof Error?error.message:String(error)); + }finally{saving=false;} + } onMount(()=>{ disposed=false; + void api.dictationSettings().then(settings=>{ + if(disposed)return; + if(settings.transcriptionChain.length){ + routes=settings.transcriptionChain; + initialized=true; + } + language=settings.language||'fr'; + profileId=settings.structureProfileId||''; + }).catch(()=>{}); function shortcut(event:KeyboardEvent){ if(event.ctrlKey&&event.shiftKey&&event.code==='KeyD' &&!(event.target instanceof HTMLInputElement) @@ -135,7 +157,7 @@

DICTÉE · LOCAL OU DISTANT

Dictée

-

Enregistrez quelques secondes, puis copiez le texte. Aucun enregistrement ni job permanent.

+

Enregistrez sans limite de durée imposée. Transcrivez avec le moteur choisi ; aucun audio n’est conservé après réussite.

@@ -162,8 +184,11 @@
+ 2. Microphone -

Ctrl+Maj+D dans cette fenêtre. Le raccourci système global nécessite une extension du lanceur natif.

+

Navigateur : Ctrl+Maj+D. Application installée : Ctrl+Alt+D partout (raccourci global) ou menu ScribeWatch dans la zone de notification. La transcription sera insérée dans l’application active si les permissions système le permettent.

{#if recording} Enregistrement en cours… diff --git a/frontend/tests/dictation.test.mjs b/frontend/tests/dictation.test.mjs index 6af6a21..303c933 100644 --- a/frontend/tests/dictation.test.mjs +++ b/frontend/tests/dictation.test.mjs @@ -7,13 +7,13 @@ test('native browser encoder selection chooses supported codec only',()=>{ assert.equal(chooseRecorderMime(()=>false),''); assert.equal(chooseRecorderMime(()=>true),'audio/webm;codecs=opus'); }); -test('dictation builds one bounded audio file without disk persistence',()=>{ +test('browser dictation builds a valid audio file without an arbitrary byte cap',()=>{ const file=recordedFile([new Blob(['sound'],{type:'audio/webm'})], 'audio/webm', new Date('2026-11-18T08:00:00Z')); assert.equal(file.type,'audio/webm'); assert.equal(file.size,5); assert.match(file.name,/dictation-2026-11-18T08-00-00-000Z.webm/); assert.throws(()=>recordedFile([], ''),/Aucun son/); - assert.throws(()=>recordedFile([new Blob([new Uint8Array(12*1024*1024+1)])],''),/maximum 12/); + }); test('dictation UI reuses providers and optional structure instead of a second engine',async()=>{ const fs=await import('node:fs/promises'); diff --git a/packaging/desktop/launcher/Cargo.lock b/packaging/desktop/launcher/Cargo.lock index 70db347..28f6ed2 100644 --- a/packaging/desktop/launcher/Cargo.lock +++ b/packaging/desktop/launcher/Cargo.lock @@ -21,6 +21,28 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "alsa" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d" +dependencies = [ + "alsa-sys", + "bitflags 2.13.2", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "android-activity" version = "0.6.1" @@ -46,6 +68,24 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + [[package]] name = "arc-swap" version = "1.9.3" @@ -61,6 +101,37 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +[[package]] +name = "ashpd" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a3c86f3fd70c0ffa500ed189abfa90b5a52398a45d5dc372fcc38ebeb7a645" +dependencies = [ + "enumflags2", + "futures-channel", + "futures-util", + "rand 0.9.5", + "serde", + "serde_repr", + "tokio", + "url", + "zbus", +] + +[[package]] +name = "ashpd" +version = "0.13.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8421aaa9644a5faf26735f258b669b15f063313ef8f8e2bdb28912a1a6f111" +dependencies = [ + "enumflags2", + "futures-util", + "getrandom 0.4.3", + "serde", + "tokio", + "zbus", +] + [[package]] name = "async-broadcast" version = "0.7.2" @@ -198,12 +269,80 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "audio-codec-algorithms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1254ebf6529f3763c491acfb5ab6e960809e3c75a38584cc664f8c5667fb7107" + +[[package]] +name = "audioadapter" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1292ef9edf681b7426ed089004b021a42896492f58bd0c909ad44e5faec9ac4" + +[[package]] +name = "audioadapter-buffers" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46289a81a3bfa26d0f8b2415f8ca9decde9a66308a150568af5c102381b3c8ce" +dependencies = [ + "audioadapter", + "audioadapter-sample", + "num-traits", +] + +[[package]] +name = "audioadapter-sample" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5258faecf4edbe35ec483bda9b1f7438e6b391891819269c6b5461aeaa0e8d7d" +dependencies = [ + "audio-codec-algorithms", + "num-traits", +] + [[package]] name = "autocfg" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "aws-lc-rs" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048006790404103c488e6c5616b3e7e702a71292aadda08e8f7698a9e0d2eb53" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bfbe32ac36b3c428696ce315464181bc4029d689fd58e3f2a4e58c252242f52" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", + "pkg-config", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "bitflags" version = "1.3.2" @@ -215,6 +354,9 @@ name = "bitflags" version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] [[package]] name = "block2" @@ -259,6 +401,12 @@ version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "byteorder-lite" version = "0.1.0" @@ -321,6 +469,35 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core 0.10.1", +] + +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + [[package]] name = "combine" version = "4.6.9" @@ -350,6 +527,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -363,8 +550,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-graphics-types 0.2.0", "foreign-types", "libc", ] @@ -376,7 +576,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "coreaudio-rs" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ "libc", ] @@ -419,6 +653,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + [[package]] name = "dispatch" version = "0.2.0" @@ -435,6 +675,17 @@ dependencies = [ "objc2 0.6.5", ] +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "dlib" version = "0.5.3" @@ -456,12 +707,54 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "endi" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +[[package]] +name = "enigo" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c6c56e50f7acae2906a0dcbb34529ca647e40421119ad5d12e7f8ba6e50010" +dependencies = [ + "ashpd 0.12.3", + "core-foundation 0.10.1", + "core-graphics 0.25.0", + "foreign-types-shared", + "futures", + "libc", + "log", + "nom", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "reis", + "tokio", + "windows 0.61.3", + "x11rb", + "xkbcommon", + "xkeysym", +] + +[[package]] +name = "enum-primitive-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba7795da175654fe16979af73f81f26a8ea27638d8d9823d317016888a63dc4c" +dependencies = [ + "num-traits", + "quote", + "syn 2.0.119", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -499,6 +792,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + [[package]] name = "event-listener" version = "5.4.2" @@ -540,6 +839,12 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +[[package]] +name = "fixedbitset" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5905ec755cc8386d7928353e4d356d2be3e89e81e5ca01fe630a1ca4d08dc175" + [[package]] name = "flate2" version = "1.1.10" @@ -551,6 +856,12 @@ dependencies = [ "zlib-rs", ] +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "foreign-types" version = "0.5.0" @@ -578,6 +889,36 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.34" @@ -585,6 +926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -593,6 +935,17 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.34" @@ -623,6 +976,12 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + [[package]] name = "futures-task" version = "0.3.34" @@ -635,9 +994,13 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ + "futures-channel", "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "slab", ] @@ -649,7 +1012,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ "rustix 1.1.6", - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", ] [[package]] @@ -671,19 +1047,84 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", ] [[package]] -name = "hashbrown" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" - -[[package]] -name = "hermit-abi" -version = "0.5.3" +name = "handy-cpal" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b0f0a55e498d0260eae6bc9a61a976b60d0c014c038771d6fbcc95907b79d4" +dependencies = [ + "alsa", + "block2 0.6.2", + "coreaudio-rs", + "dasp_sample", + "futures", + "jni", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "objc2 0.6.5", + "objc2-audio-toolbox", + "objc2-avf-audio", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "portable-atomic", + "pulseaudio", + "web-sys", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "handy-recorder" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29602f3465cb080cc437b08903ea7ef395c55a41120264a897acdd25ff9b255a" +dependencies = [ + "dasp_sample", + "futures", + "handy-cpal", + "libc", + "log", + "objc2-av-foundation", + "objc2-core-audio", + "objc2-core-foundation", + "pulseaudio", + "rtrb", + "rubato", + "windows 0.62.2", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hermit-abi" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" @@ -693,6 +1134,213 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "image" version = "0.25.9" @@ -713,9 +1361,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", ] +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + [[package]] name = "jni" version = "0.22.4" @@ -730,7 +1390,7 @@ dependencies = [ "simd_cesu8", "thiserror 2.0.21", "walkdir", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -795,6 +1455,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.13.2", + "serde", + "unicode-segmentation", +] + [[package]] name = "keyboard-types" version = "0.8.3" @@ -838,7 +1509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -865,12 +1536,39 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + [[package]] name = "memchr" version = "2.8.3" @@ -895,6 +1593,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -915,6 +1629,18 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + [[package]] name = "moxcms" version = "0.7.11" @@ -933,7 +1659,7 @@ checksum = "4340e89c178916e62879c5c36b7f699019369be413e496178a6983ce91b8bc03" dependencies = [ "crossbeam-channel", "dpi", - "keyboard-types", + "keyboard-types 0.8.3", "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-core-foundation", @@ -972,6 +1698,44 @@ dependencies = [ "jni-sys 0.3.1", ] +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -1053,6 +1817,44 @@ dependencies = [ "bitflags 2.13.2", "objc2 0.6.5", "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-audio-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2 0.6.5", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-av-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478ae33fcac9df0a18db8302387c666b8ef08a3e2d62b510ca4fc278a384b6c0" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-avf-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-foundation 0.3.2", ] @@ -1080,6 +1882,29 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-core-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" +dependencies = [ + "dispatch2", + "objc2 0.6.5", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-core-audio-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", +] + [[package]] name = "objc2-core-data" version = "0.2.2" @@ -1099,7 +1924,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.13.2", + "block2 0.6.2", "dispatch2", + "libc", "objc2 0.6.5", ] @@ -1110,7 +1937,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", "objc2-core-foundation", + "objc2-io-surface", ] [[package]] @@ -1164,6 +1994,18 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.13.2", "block2 0.6.2", + "libc", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", "objc2 0.6.5", "objc2-core-foundation", ] @@ -1266,6 +2108,12 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "openssl-probe" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" + [[package]] name = "orbclient" version = "0.3.55" @@ -1286,12 +2134,45 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "parking" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link 0.2.1", +] + [[package]] name = "pastey" version = "0.2.3" @@ -1304,6 +2185,17 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + [[package]] name = "pin-project" version = "1.1.13" @@ -1380,6 +2272,39 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -1398,59 +2323,296 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "pulseaudio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba79a4c6904c987cc31fa50e9b750539404511c2dbd9ce95e5e58444177a21e" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "enum-primitive-derive", + "futures", + "log", + "mio", + "num-traits", + "thiserror 1.0.69", +] + [[package]] name = "pxfm" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.4", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "realfft" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "538895ccf2006b473aafbe8d72770e21038961ab67aae34f3c577485fc703a7d" +dependencies = [ + "rustfft", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] [[package]] -name = "quick-xml" -version = "0.41.0" +name = "reis" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +checksum = "00939c5c526a1b4054ef8d9d96b3f92227f08ca355965e986741b556eda6d289" dependencies = [ - "memchr", + "rustix 0.38.44", ] [[package]] -name = "quote" -version = "1.0.47" +name = "reqwest" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" dependencies = [ - "proc-macro2", + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] -name = "r-efi" -version = "5.3.0" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] [[package]] -name = "r-efi" -version = "6.0.0" +name = "rtrb" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +checksum = "5974e397833d890f2f74963408e0d4a6cd8eda2f6a445ae06750291b5d7a997e" [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "rubato" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "a7cb1ffaf8738df50aab642a7f6465df81c6ba9e2818268053487165298114be" dependencies = [ - "bitflags 1.3.2", + "audioadapter", + "audioadapter-buffers", + "num-complex", + "num-integer", + "num-traits", + "realfft", + "visibility", + "windowfunctions", ] [[package]] -name = "redox_syscall" -version = "0.9.5" +name = "rustc-hash" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" -dependencies = [ - "bitflags 2.13.2", -] +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustc_version" @@ -1461,6 +2623,20 @@ dependencies = [ "semver", ] +[[package]] +name = "rustfft" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + [[package]] name = "rustix" version = "0.38.44" @@ -1487,6 +2663,81 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.23" @@ -1502,23 +2753,70 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "scoped-tls" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "scribewatch-desktop-launcher" version = "0.6.5" dependencies = [ + "arboard", + "enigo", + "handy-recorder", + "hound", "image", + "reqwest", + "serde", + "serde_json", "tray-icon", + "uuid", + "wayclip-global-hotkey", "winit", "winreg", "winresource", ] +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.28" @@ -1555,6 +2853,19 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "serde_repr" version = "0.1.21" @@ -1659,6 +2970,34 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.119" @@ -1681,6 +3020,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "task-local" version = "0.1.1" @@ -1743,13 +3102,46 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + [[package]] name = "tokio" version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ + "bytes", + "libc", + "mio", "pin-project-lite", + "signal-hook-registry", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", ] [[package]] @@ -1803,6 +3195,51 @@ version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.44" @@ -1834,6 +3271,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "tray-icon" version = "0.26.1" @@ -1855,27 +3302,84 @@ dependencies = [ ] [[package]] -name = "uds_windows" -version = "1.2.1" +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom", + "petgraph", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.61.2", + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", ] [[package]] -name = "unicode-ident" -version = "1.0.27" +name = "utf8_iter" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] [[package]] -name = "unicode-segmentation" -version = "1.13.3" +name = "utf_types" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" [[package]] name = "uuid" @@ -1883,6 +3387,7 @@ version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" dependencies = [ + "getrandom 0.4.3", "js-sys", "serde_core", "wasm-bindgen", @@ -1894,6 +3399,17 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "visibility" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d674d135b4a8c1d7e813e2f8d1c9a58308aee4a680323066025e53132218bd91" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -1904,6 +3420,21 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasip2" version = "1.0.4+wasi-0.2.12" @@ -1968,6 +3499,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wayclip-global-hotkey" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e27d52b16a43170fe15eb89d2a88a4921d7d50cc740b64b5d091bc9bf8532dd" +dependencies = [ + "ashpd 0.13.13", + "crossbeam-channel", + "futures", + "keyboard-types 0.7.0", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "once_cell", + "thiserror 2.0.21", + "tokio", + "windows-sys 0.59.0", + "x11rb", + "xkeysym", +] + [[package]] name = "wayland-backend" version = "0.3.17" @@ -2096,6 +3647,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-root-certs" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi-util" version = "0.1.11" @@ -2105,12 +3665,196 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "windowfunctions" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90628d739333b7c5d2ee0b70210b97b8cddc38440c682c96fd9e2c24c2db5f3a" +dependencies = [ + "num-traits", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -2135,7 +3879,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -2154,6 +3898,24 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -2217,8 +3979,8 @@ dependencies = [ "calloop", "cfg_aliases", "concurrent-queue", - "core-foundation", - "core-graphics", + "core-foundation 0.9.4", + "core-graphics 0.23.2", "cursor-icon", "dpi", "js-sys", @@ -2287,6 +4049,30 @@ version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +[[package]] +name = "wl-clipboard-rs" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.6", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + [[package]] name = "x11-dl" version = "2.21.0" @@ -2325,6 +4111,17 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" +[[package]] +name = "xkbcommon" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a974f48060a14e95705c01f24ad9c3345022f4d97441b8a36beb7ed5c4a02d" +dependencies = [ + "libc", + "memmap2", + "xkeysym", +] + [[package]] name = "xkbcommon-dl" version = "0.4.2" @@ -2344,6 +4141,29 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + [[package]] name = "zbus" version = "5.19.0" @@ -2369,6 +4189,7 @@ dependencies = [ "rustix 1.1.6", "serde", "serde_repr", + "tokio", "tracing", "uds_windows", "uuid", @@ -2434,12 +4255,78 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "zlib-rs" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + [[package]] name = "zvariant" version = "5.15.1" @@ -2449,6 +4336,7 @@ dependencies = [ "endi", "enumflags2", "serde", + "url", "winnow", "zcheapstr", "zvariant_derive", diff --git a/packaging/desktop/launcher/Cargo.toml b/packaging/desktop/launcher/Cargo.toml index aca5bfa..c7254fe 100644 --- a/packaging/desktop/launcher/Cargo.toml +++ b/packaging/desktop/launcher/Cargo.toml @@ -15,6 +15,27 @@ winresource = "=0.1.34" tray-icon = { version = "=0.26.1", default-features = false, features = ["ksni"] } winit = { version = "=0.30.12", default-features = false, features = ["x11", "wayland"] } image = { version = "=0.25.9", default-features = false, features = ["png"] } +# Native cross-platform microphone capture extracted from Handy (MIT). +handy-recorder = "=0.1.1" +# Stream 16-kHz PCM to disk instead of storing the entire recording in RAM. +hound = "=3.5.1" +# Reuse ScribeWatch's local ASR/LLM HTTP API; these do not launch another engine. +reqwest = { version = "=0.13.4", default-features = false, features = ["blocking", "multipart", "json", "rustls"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +uuid = { version = "1", features = ["v4"] } +# Native clipboard with Wayland data-control, X11, Windows, macOS. +arboard = { version = "=3.7.0", default-features = false, features = ["wayland-data-control"] } +# Global desktop hotkeys, including the XDG GlobalShortcuts portal on KDE Wayland. +global_hotkey = { package = "wayclip-global-hotkey", version = "=0.7.0" } +# Input injection is native Rust, not OS-specific external scripts. +[target.'cfg(target_os = "linux")'.dependencies] +enigo = { version = "=0.6.1", default-features = false, features = ["x11rb", "libei_tokio", "platform_specific"] } + +[target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies] +enigo = { version = "=0.6.1", default-features = false } + + [target.'cfg(windows)'.dependencies] winreg = "=0.55.0" diff --git a/packaging/desktop/launcher/src/desktop_tray.rs b/packaging/desktop/launcher/src/desktop_tray.rs index 284cb1d..98c79da 100644 --- a/packaging/desktop/launcher/src/desktop_tray.rs +++ b/packaging/desktop/launcher/src/desktop_tray.rs @@ -7,10 +7,16 @@ use std::{ time::{Duration, Instant}, }; +use super::native_dictation::{NativeDictation, transcribe_to_clipboard}; +use global_hotkey::{ + GlobalHotKeyEvent, GlobalHotKeyManager, HotKeyState, + hotkey::{Code, HotKey, Modifiers}, +}; use tray_icon::{ Icon, TrayIcon, TrayIconBuilder, menu::{Menu, MenuEvent, MenuItem}, }; +use uuid::Uuid; use winit::{ event::{Event, StartCause}, event_loop::{ControlFlow, EventLoop}, @@ -23,12 +29,35 @@ use super::open_browser; enum Signal { Menu(MenuEvent), Show, + DictationToggle, + DictationFinished(Result), } fn show_file(base: &Path) -> PathBuf { base.join("tray-ipc.port") } +fn token_file(base: &Path) -> PathBuf { + base.join("tray-ipc.token") +} + +pub fn request_dictation(base: &Path) -> Result<(), String> { + let port = fs::read_to_string(show_file(base)).map_err(|e| e.to_string())?; + let token = fs::read_to_string(token_file(base)).map_err(|e| e.to_string())?; + let port: u16 = port + .trim() + .parse() + .map_err(|e: std::num::ParseIntError| e.to_string())?; + let socket = UdpSocket::bind("127.0.0.1:0").map_err(|e| e.to_string())?; + socket + .send_to( + format!("DICTATE:{}", token.trim()).as_bytes(), + ("127.0.0.1", port), + ) + .map_err(|e| e.to_string())?; + Ok(()) +} + pub fn request_show(base: &Path) { // The only accepted IPC action makes the existing tray visible again. if let Ok(port) = fs::read_to_string(show_file(base)) @@ -143,18 +172,29 @@ pub fn run(port: u16, base: PathBuf, mut child: Child) -> Result<(), String> { let socket = UdpSocket::bind("127.0.0.1:0").map_err(|e| e.to_string())?; let ipc_port = socket.local_addr().map_err(|e| e.to_string())?.port(); fs::write(show_file(&base), ipc_port.to_string()).map_err(|e| e.to_string())?; + let token = Uuid::new_v4().to_string(); + fs::write(token_file(&base), &token).map_err(|e| e.to_string())?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + fs::set_permissions(token_file(&base), fs::Permissions::from_mode(0o600)) + .map_err(|e| e.to_string())?; + } let sender = event_loop.create_proxy(); thread::spawn(move || { - let mut buf = [0u8; 32]; + let mut buf = [0u8; 128]; while let Ok((count, _)) = socket.recv_from(&mut buf) { if &buf[..count] == b"SHOW" { let _ = sender.send_event(Signal::Show); + } else if &buf[..count] == format!("DICTATE:{token}").as_bytes() { + let _ = sender.send_event(Signal::DictationToggle); } } }); let menu = Menu::new(); let open = MenuItem::new("Ouvrir ScribeWatch", true, None); + let dictate = MenuItem::new("Démarrer la dictée", true, None); let startup = MenuItem::new("Lancement automatique", true, None); let hide = MenuItem::new( "Masquer l'icône (jusqu'à la prochaine ouverture)", @@ -162,7 +202,7 @@ pub fn run(port: u16, base: PathBuf, mut child: Child) -> Result<(), String> { None, ); let quit = MenuItem::new("Quitter ScribeWatch", true, None); - menu.append_items(&[&open, &startup, &hide, &quit]) + menu.append_items(&[&open, &dictate, &startup, &hide, &quit]) .map_err(|e| e.to_string())?; startup.set_text(if autostart_enabled() { "Désactiver le lancement automatique" @@ -172,8 +212,27 @@ pub fn run(port: u16, base: PathBuf, mut child: Child) -> Result<(), String> { let image = application_icon()?; let mut tray: Option = None; let mut last_health = Instant::now(); + // Different from browser-only Ctrl+Shift+D to avoid duplicate toggles + // when the browser is focused and the global shortcut is pressed. + let shortcut = HotKey::new(Some(Modifiers::CONTROL | Modifiers::ALT), Code::KeyD); + let hotkey_manager = GlobalHotKeyManager::new().ok(); + let hotkey_registered = hotkey_manager + .as_ref() + .is_some_and(|manager| manager.register(shortcut).is_ok()); + if hotkey_registered { + let proxy = event_loop.create_proxy(); + GlobalHotKeyEvent::set_event_handler(Some(move |event: GlobalHotKeyEvent| { + if event.id == shortcut.id() && event.state == HotKeyState::Pressed { + let _ = proxy.send_event(Signal::DictationToggle); + } + })); + } + let event_proxy = event_loop.create_proxy(); + let mut dictation: Option = None; + let mut processing = false; event_loop .run(move |event, target| { + let _keep_global_shortcut_registered = &hotkey_manager; target.set_control_flow(ControlFlow::WaitUntil( Instant::now() + Duration::from_secs(2), )); @@ -198,9 +257,67 @@ pub fn run(port: u16, base: PathBuf, mut child: Child) -> Result<(), String> { let _ = icon.set_visible(true); } } + Event::UserEvent(Signal::DictationToggle) => { + if processing { + eprintln!("ScribeWatch dictation already transcribing"); + } else if let Some(recording) = dictation.take() { + let _ = dictate.set_text("Transcription en cours…"); + processing = true; + match recording.stop() { + Ok(audio) => { + let sender = event_proxy.clone(); + thread::spawn(move || { + let result = transcribe_to_clipboard(port, audio); + let _ = sender.send_event(Signal::DictationFinished(result)); + }); + } + Err(error) => { + eprintln!("ScribeWatch dictation: {error}"); + processing = false; + let _ = dictate.set_text("Démarrer la dictée"); + } + } + } else { + match NativeDictation::start(&base) { + Ok(recording) => { + dictation = Some(recording); + let _ = dictate.set_text("Arrêter la dictée"); + if let Some(icon) = &tray { + let _ = icon + .set_tooltip(Some("ScribeWatch — dictée micro en cours")); + } + } + Err(error) => { + eprintln!("ScribeWatch microphone: {error}"); + } + } + } + } + Event::UserEvent(Signal::DictationFinished(outcome)) => { + processing = false; + let _ = dictate.set_text("Démarrer la dictée"); + match outcome { + Ok(message) => { + if let Some(icon) = &tray { + let _ = icon.set_tooltip(Some(&message)); + } + } + Err(error) => { + eprintln!("ScribeWatch transcription: {error}"); + if let Some(icon) = &tray { + let _ = icon.set_tooltip(Some(&format!( + "ScribeWatch — {}", + error.chars().take(180).collect::() + ))); + } + } + } + } Event::UserEvent(Signal::Menu(event)) => { if event.id == open.id() { let _ = open_browser(port); + } else if event.id == dictate.id() { + let _ = event_proxy.send_event(Signal::DictationToggle); } else if event.id == startup.id() { if let Err(err) = set_autostart(!autostart_enabled()) { eprintln!("Startup preference failed: {err}"); @@ -225,9 +342,15 @@ pub fn run(port: u16, base: PathBuf, mut child: Child) -> Result<(), String> { } } Event::LoopExiting => { + if let Some(active) = dictation.take() { + if let Err(error) = active.stop() { + eprintln!("ScribeWatch dictation recovery: {error}"); + } + } let _ = child.kill(); let _ = child.wait(); let _ = fs::remove_file(show_file(&base)); + let _ = fs::remove_file(token_file(&base)); } _ => {} } diff --git a/packaging/desktop/launcher/src/main.rs b/packaging/desktop/launcher/src/main.rs index bd9e4ba..5ea952f 100644 --- a/packaging/desktop/launcher/src/main.rs +++ b/packaging/desktop/launcher/src/main.rs @@ -44,6 +44,7 @@ fn show_error(message: &str) { } mod desktop_tray; +mod native_dictation; const APP_NAME: &str = "ScribeWatch"; const APP_ENV: &str = "SCRIBEWATCH"; @@ -226,6 +227,9 @@ fn launch(smoke: bool, no_browser: bool) -> Result<(), String> { .and_then(|value| value.parse::().ok()) .unwrap_or(DEFAULT_PORT); if http_health(port).is_ok() { + if env::args().any(|arg| arg == "--dictate-toggle") { + return desktop_tray::request_dictation(&base); + } if smoke { return Err("A server already occupies the smoke test port".into()); } @@ -236,6 +240,9 @@ fn launch(smoke: bool, no_browser: bool) -> Result<(), String> { } return Ok(()); } + if env::args().any(|arg| arg == "--dictate-toggle") { + return Err("ScribeWatch doit être lancé avant une dictée globale".into()); + } if TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], port))).is_ok() { return Err(format!("Port {port} is used by another application")); } diff --git a/packaging/desktop/launcher/src/native_dictation.rs b/packaging/desktop/launcher/src/native_dictation.rs new file mode 100644 index 0000000..9d13570 --- /dev/null +++ b/packaging/desktop/launcher/src/native_dictation.rs @@ -0,0 +1,286 @@ +//! Native Rust microphone capture and dictation transport. +//! Uses Handy's MIT-licensed handy-recorder; never accumulates a long +//! recording in memory, starts no extra engine, and imposes no time limit. +use enigo::{Direction, Enigo, Key, Keyboard, Settings}; +use handy_recorder::{AudioChunk, Recorder, RecorderConfig, Sink}; +use hound::{SampleFormat, WavSpec, WavWriter}; +use serde::Deserialize; +use std::{ + fs::{self, File, OpenOptions}, + io::BufWriter, + path::{Path, PathBuf}, + time::Duration, +}; +use uuid::Uuid; + +struct WavSink { + writer: Option>>, + error: Option, + frames: u64, +} + +impl WavSink { + fn create(path: &Path) -> Result { + let mut options = OpenOptions::new(); + options.write(true).create_new(true); + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt; + options.mode(0o600); + } + let file = options.open(path).map_err(|e| e.to_string())?; + let spec = WavSpec { + channels: 1, + sample_rate: 16_000, + bits_per_sample: 16, + sample_format: SampleFormat::Int, + }; + let writer = WavWriter::new(BufWriter::new(file), spec).map_err(|e| e.to_string())?; + Ok(Self { + writer: Some(writer), + error: None, + frames: 0, + }) + } + + fn finish(mut self) -> Result { + if let Some(writer) = self.writer.take() { + writer.finalize().map_err(|e| e.to_string())?; + } + if let Some(error) = self.error.take() { + return Err(format!("Microphone write failure: {error}")); + } + if self.frames == 0 { + return Err("Microphone captured no audio".into()); + } + Ok(self.frames) + } +} + +impl Sink for WavSink { + fn process_chunk(&mut self, chunk: AudioChunk<'_>) { + if self.error.is_some() { + return; + } + if chunk.sample_rate != 16_000 || chunk.channels != 1 { + self.error = Some(format!( + "Unexpected microphone stream: {} Hz {} channel(s)", + chunk.sample_rate, chunk.channels + )); + return; + } + let Some(writer) = self.writer.as_mut() else { + return; + }; + for sample in chunk.samples.iter().take(chunk.valid_frames) { + let pcm = (sample.clamp(-1.0, 1.0) * 32767.0).round() as i16; + if let Err(error) = writer.write_sample(pcm) { + self.error = Some(error.to_string()); + return; + } + } + self.frames += chunk.valid_frames as u64; + } +} + +pub struct NativeDictation { + recorder: Recorder, + path: PathBuf, +} + +impl NativeDictation { + pub fn start(base: &Path) -> Result { + let directory = base.join("data/dictation-recovery"); + fs::create_dir_all(&directory).map_err(|e| e.to_string())?; + // Remove only old temporary failed dictations. A successful ASR + // already deletes its WAV. No timer, polling job or extra service. + let expiry = std::time::SystemTime::now() + .checked_sub(Duration::from_secs(24 * 3600)); + if let Some(expiry) = expiry { + if let Ok(entries) = fs::read_dir(&directory) { + for entry in entries.flatten() { + if entry.path().extension().is_some_and(|ext| ext == "wav") + && entry.metadata().ok() + .and_then(|m| m.modified().ok()) + .is_some_and(|time| time < expiry) + { + let _ = fs::remove_file(entry.path()); + } + } + } + } + let path = directory.join(format!("{}.wav", Uuid::new_v4())); + let sink = WavSink::create(&path)?; + let recorder = Recorder::open_with_failure_handler(RecorderConfig::speech(), |e| { + eprintln!("ScribeWatch microphone device error: {e}"); + }) + .map_err(|e| { + let _ = fs::remove_file(&path); + e.to_string() + })?; + if let Err(e) = recorder.start(sink) { + let _ = fs::remove_file(&path); + return Err(e.to_string()); + } + Ok(Self { recorder, path }) + } + + pub fn stop(self) -> Result { + let completed = self.recorder.stop().map_err(|e| e.to_string())?; + let end_reason = completed.end_reason.clone(); + let dropped_frames = completed.dropped_frames; + let frames = completed.sink.finish()?; + if dropped_frames > 0 || !matches!(end_reason, handy_recorder::EndReason::StopCalled) { + return Err(format!( + "Incomplete microphone recording: {frames} samples, {dropped_frames} dropped frames, {end_reason:?}. Recovery audio: {}", + self.path.display() + )); + } + Ok(self.path) + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct DictationSettings { + #[serde(default)] + structure_profile_id: Option, +} +#[derive(Deserialize)] +struct Transcript { + text: String, +} +#[derive(Deserialize)] +struct Structured { + markdown: String, +} + +fn preserve_transcript_on_structure_failure( + original: String, + structured: Result, +) -> String { + match structured { + Ok(markdown) if !markdown.trim().is_empty() => markdown, + Ok(_) => original, + Err(error) => { + eprintln!("ScribeWatch optional LLM unavailable, preserving transcript: {error}"); + original + } + } +} + +/// Called only after native microphone has stopped. WAV streams from disk +/// to localhost; the existing backend chooses the saved local/remote model. +pub fn transcribe_to_clipboard(port: u16, file: PathBuf) -> Result { + let base = format!("http://127.0.0.1:{port}"); + let client = reqwest::blocking::Client::builder() + .connect_timeout(Duration::from_secs(5)) + .build() + .map_err(|e| e.to_string())?; + let settings: DictationSettings = client + .get(format!("{base}/api/v1/dictation/settings")) + .send() + .map_err(|e| e.to_string())? + .error_for_status() + .map_err(|e| e.to_string())? + .json() + .map_err(|e| e.to_string())?; + let part = reqwest::blocking::multipart::Part::file(&file) + .map_err(|e| e.to_string())? + .mime_str("audio/wav") + .map_err(|e| e.to_string())?; + let form = reqwest::blocking::multipart::Form::new().part("file", part); + let transcript: Transcript = client + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart(form) + .send() + .map_err(|e| e.to_string())? + .error_for_status() + .map_err(|e| e.to_string())? + .json() + .map_err(|e| e.to_string())?; + let text = if let Some(profile_id) = settings.structure_profile_id.filter(|id| !id.is_empty()) { + // The LLM is optional. A cloud/local LLM failure must never discard + // a successfully recognized transcript or delay the clipboard forever. + let structured = client + .post(format!("{base}/api/v1/structure/existing")) + .json(&serde_json::json!({"profileId": profile_id, "transcript": &transcript.text})) + .send() + .and_then(|r| r.error_for_status()) + .and_then(|r| r.json::()) + .map(|r| r.markdown) + .map_err(|e| e.to_string()); + preserve_transcript_on_structure_failure(transcript.text, structured) + } else { + transcript.text + }; + if text.trim().is_empty() { + return Err("ASR returned empty text".into()); + } + let mut clipboard = arboard::Clipboard::new().map_err(|e| e.to_string())?; + clipboard.set_text(text).map_err(|e| e.to_string())?; + // Keep the transcript in the OS clipboard if key injection is unavailable + // (e.g. KDE Wayland awaiting portal permission). Never pretend it pasted. + let paste_result = paste_to_focused_application(); + // The transcript is now recoverable from the clipboard. Do not retain + // confidential recordings after a successful transcription. + if let Err(error) = fs::remove_file(&file) { + eprintln!("ScribeWatch dictation temporary audio cleanup: {error}"); + } + match paste_result { + Ok(()) => Ok("Dictée transcrite et insérée dans l’application active".into()), + Err(error) => { + eprintln!("ScribeWatch paste unavailable: {error}"); + Ok("Dictée copiée dans le presse-papiers ; collage manuel nécessaire".into()) + } + } +} + +/// Simulates the platform's paste shortcut via Rust. The target window +/// remains focused because the tray never opens a dictation window. +fn paste_to_focused_application() -> Result<(), String> { + let mut keys = Enigo::new(&Settings::default()).map_err(|e| e.to_string())?; + #[cfg(target_os = "macos")] + let modifier = Key::Meta; + #[cfg(not(target_os = "macos"))] + let modifier = Key::Control; + + keys.key(modifier, Direction::Press) + .map_err(|e| e.to_string())?; + let click = keys.key(Key::Unicode('v'), Direction::Click); + let release = keys.key(modifier, Direction::Release); + click.map_err(|e| e.to_string())?; + release.map_err(|e| e.to_string()) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn optional_llm_failure_preserves_exact_asr_transcript() { + let original = "Texte médical exact, intégral.".to_owned(); + assert_eq!(preserve_transcript_on_structure_failure(original.clone(), Err("offline".into())), original); + assert_eq!(preserve_transcript_on_structure_failure(original.clone(), Ok(String::new())), original); + assert_eq!(preserve_transcript_on_structure_failure(original.clone(), Ok("Compte rendu IA".into())), "Compte rendu IA"); + } + + #[test] + fn long_pcm_capture_is_streamed_to_a_wav_file_without_duration_cap() { + let path = std::env::temp_dir().join(format!("scribewatch-test-{}.wav", Uuid::new_v4())); + let mut sink = WavSink::create(&path).unwrap(); + for _ in 0..1000 { + sink.process_chunk(AudioChunk { + samples: &[0.25f32; 480], + sample_rate: 16_000, + channels: 1, + valid_frames: 480, + }); + } + assert_eq!(sink.finish().unwrap(), 480_000); + let mut decoder = hound::WavReader::open(&path).unwrap(); + assert_eq!(decoder.spec().sample_rate, 16000); + assert_eq!(decoder.len(), 480_000); + assert_eq!(decoder.samples::().next().unwrap().unwrap(), 8192); + fs::remove_file(&path).unwrap(); + } +} diff --git a/src/api/dictation.rs b/src/api/dictation.rs index 12047cc..29dcfbd 100644 --- a/src/api/dictation.rs +++ b/src/api/dictation.rs @@ -8,14 +8,15 @@ use axum::{ Json, extract::{Multipart, State}, }; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use std::{path::PathBuf, time::Instant}; +use tokio::io::AsyncWriteExt; use tokio_util::sync::CancellationToken; use uuid::Uuid; -/// Short dictation is intentionally stateless: no database job, retained recording, -/// second STT engine, or background process. The active provider and model are reused. -const MAX_AUDIO_BYTES: usize = 12 * 1024 * 1024; +/// Dictation is stateless: no retained recording, no separate ASR process. +/// Audio streams straight to a temporary file; the existing configurable +/// ScribeWatch upload quota guards disk exhaustion without a duration cap. const MAX_ROUTES: usize = 4; #[derive(Serialize)] @@ -27,6 +28,101 @@ pub struct DictationResult { elapsed_ms: u64, } +const SETTINGS_KIND: &str = "dictation_settings"; +const SETTINGS_ID: &str = "desktop"; +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DictationSettings { + pub transcription_chain: Vec, + pub language: String, + #[serde(default)] + pub structure_profile_id: Option, +} + +async fn effective_settings(state: &AppState) -> AppResult { + if let Some(saved) = state + .db + .get::(SETTINGS_KIND, SETTINGS_ID)? + { + return Ok(saved); + } + let providers = state.providers.read().await; + let first = providers + .iter() + .filter(|p| p.enabled) + .find(|p| p.model.to_ascii_lowercase().contains("parakeet")) + .or_else(|| providers.iter().find(|p| p.enabled)); + Ok(DictationSettings { + transcription_chain: first + .map(|p| { + vec![TranscriptionRoute { + provider_id: p.id.clone(), + model: p.model.clone(), + fallback_after_seconds: None, + }] + }) + .unwrap_or_default(), + language: "fr".into(), + structure_profile_id: None, + }) +} + +pub async fn settings(State(state): State) -> AppResult> { + Ok(Json(effective_settings(&state).await?)) +} + +pub async fn save_settings( + State(state): State, + Json(settings): Json, +) -> AppResult> { + if settings.transcription_chain.is_empty() || settings.transcription_chain.len() > MAX_ROUTES { + return Err(AppError::BadRequest( + "select a valid transcription chain".into(), + )); + } + let providers = state.providers.read().await; + for route in &settings.transcription_chain { + if route.provider_id.trim().is_empty() + || route.fallback_after_seconds == Some(0) + || !providers + .iter() + .any(|p| p.enabled && p.id == route.provider_id) + { + return Err(AppError::BadRequest( + "transcription provider unavailable".into(), + )); + } + } + drop(providers); + if let Some(id) = settings + .structure_profile_id + .as_ref() + .filter(|v| !v.is_empty()) + { + if !state + .structure_profiles + .read() + .await + .iter() + .any(|p| p.id == *id && !p.provider_id.is_empty()) + { + return Err(AppError::BadRequest("AI profile unavailable".into())); + } + } + if settings.language.len() > 20 + || settings + .language + .chars() + .any(|c| !c.is_ascii_alphabetic() && c != '-') + { + return Err(AppError::BadRequest( + "invalid transcription language".into(), + )); + } + state.db.upsert(SETTINGS_KIND, SETTINGS_ID, &settings)?; + Ok(Json(settings)) +} + struct StagedAudio(PathBuf); impl Drop for StagedAudio { @@ -103,8 +199,8 @@ pub async fn transcribe( State(state): State, mut multipart: Multipart, ) -> AppResult> { - let mut bytes: Option> = None; - let mut extension = "webm"; + let mut staged: Option = None; + let mut bytes_received = 0u64; let mut provider_id = String::new(); let mut model = String::new(); let mut language = String::new(); @@ -116,27 +212,42 @@ pub async fn transcribe( { let name = field.name().unwrap_or_default().to_owned(); if name == "file" { - if bytes.is_some() { + if staged.is_some() { return Err(AppError::BadRequest( "only one audio file is accepted".into(), )); } - extension = audio_extension( + let extension = audio_extension( field.content_type().unwrap_or(""), field.file_name().unwrap_or(""), ); - let mut audio = Vec::new(); + let path = state.config.quick_upload_dir().join(format!( + "dictation-{}.{}", + Uuid::new_v4(), + extension + )); + let mut file = tokio::fs::OpenOptions::new() + .write(true) + .create_new(true) + .open(&path) + .await + .map_err(AppError::from)?; + staged = Some(StagedAudio(path)); while let Some(chunk) = field .chunk() .await .map_err(|_| AppError::BadRequest("invalid audio data".into()))? { - if audio.len().saturating_add(chunk.len()) > MAX_AUDIO_BYTES { - return Err(AppError::BadRequest("dictation exceeds 12 MiB".into())); + bytes_received = bytes_received.saturating_add(chunk.len() as u64); + if bytes_received > state.config.max_upload_bytes { + return Err(AppError::BadRequest( + "dictation exceeds the configured ScribeWatch upload quota".into(), + )); } - audio.extend_from_slice(&chunk); + file.write_all(&chunk).await.map_err(AppError::from)?; } - bytes = Some(audio); + file.flush().await.map_err(AppError::from)?; + drop(file); } else if matches!( name.as_str(), "providerId" | "model" | "language" | "transcriptionChain" @@ -157,13 +268,51 @@ pub async fn transcribe( } } } - let audio = bytes.ok_or_else(|| AppError::BadRequest("audio file is required".into()))?; - if audio.len() < 128 { + let file = staged.ok_or_else(|| AppError::BadRequest("audio file is required".into()))?; + if bytes_received < 128 { return Err(AppError::BadRequest( "audio file is empty or too short".into(), )); } - let routes = parse_routes(chain.as_deref(), &provider_id, &model)?; + // Native Rust microphone submits only the audio: load all preferences + // (model selection, fallback chain AND language) from the same saved + // configuration as the browser UI. In particular, an empty language field + // breaks strict forced alignment models such as Parakeet Ultra. + let needs_routes = + chain.as_deref().is_none_or(|v| v.trim().is_empty()) && provider_id.trim().is_empty(); + let saved = if needs_routes || language.trim().is_empty() { + Some(effective_settings(&state).await?) + } else { + None + }; + let routes = if needs_routes { + saved + .as_ref() + .map(|s| s.transcription_chain.clone()) + .unwrap_or_default() + } else { + parse_routes(chain.as_deref(), &provider_id, &model)? + }; + if language.trim().is_empty() { + language = saved + .as_ref() + .map(|s| s.language.clone()) + .unwrap_or_else(|| "fr".into()); + } + if routes.is_empty() { + return Err(AppError::BadRequest( + "no transcription provider is configured".into(), + )); + } + if language.len() > 20 + || language + .chars() + .any(|c| !c.is_ascii_alphabetic() && c != '-') + { + return Err(AppError::BadRequest( + "invalid transcription language".into(), + )); + } let available = state.providers.read().await.clone(); // Reject an invalid/unavailable selection rather than silently routing elsewhere. for route in &routes { @@ -176,16 +325,6 @@ pub async fn transcribe( )); } } - let path = - state - .config - .quick_upload_dir() - .join(format!("dictation-{}.{}", Uuid::new_v4(), extension)); - tokio::fs::write(&path, &audio) - .await - .map_err(AppError::from)?; - drop(audio); - let file = StagedAudio(path); let _slot = state .transcription_slots .clone() @@ -315,10 +454,12 @@ mod integration_tests { ffmpeg_threads: 1, }; let state = AppState::load(config).await.unwrap(); - let stub = Router::new().route( - "/v1/audio/transcriptions", - post(|_body: Bytes| async { Json(json!({"text":"bonjour dictée"})) }), - ); + let stub = Router::new() + .route( + "/v1/audio/transcriptions", + post(|_body: Bytes| async { Json(json!({"text":"bonjour dictée"})) }), + ) + .layer(axum::extract::DefaultBodyLimit::disable()); let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); let upstream = listener.local_addr().unwrap(); tokio::spawn(async move { axum::serve(listener, stub).await.unwrap() }); @@ -443,6 +584,110 @@ mod integration_tests { ); } + #[tokio::test] + async fn native_file_only_request_uses_persisted_language_and_model() { + let (_tmp, state, base) = setup().await; + let upstream = Router::new().route( + "/v1/audio/transcriptions", + post(|body: Bytes| async move { + let raw = String::from_utf8_lossy(&body); + if raw.contains(r#"name="language""#) + && raw.contains("\r\n\r\nfr\r\n") + && raw.contains(r#"name="model""#) + && raw.contains("\r\n\r\nstrict-asr\r\n") + { + ( + axum::http::StatusCode::OK, + Json(json!({"text": "français vérifié"})), + ) + } else { + ( + axum::http::StatusCode::BAD_REQUEST, + Json(json!({"error": "language or model missing"})), + ) + } + }), + ); + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let addr = listener.local_addr().unwrap(); + tokio::spawn(async move { axum::serve(listener, upstream).await.unwrap() }); + let strict = Provider { + id: "strict-asr".into(), + name: "Forced-aligner".into(), + transcription_url: format!("http://{addr}/v1/audio/transcriptions"), + model: "strict-asr".into(), + api_key: String::new(), + timeout_seconds: 10, + enabled: true, + }; + state.providers.write().await.push(strict); + let client = reqwest::Client::new(); + let settings = json!({ + "transcriptionChain": [{"providerId": "strict-asr", "model": "strict-asr"}], + "language": "fr", "structureProfileId": null, + }); + let saved = client + .put(format!("{base}/api/v1/dictation/settings")) + .json(&settings) + .send() + .await + .unwrap(); + assert_eq!(saved.status(), reqwest::StatusCode::OK); + let retrieved: Value = client + .get(format!("{base}/api/v1/dictation/settings")) + .send() + .await + .unwrap() + .json() + .await + .unwrap(); + assert_eq!(retrieved, settings); + let answer = client + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart( + Form::new().part( + "file", + Part::bytes(tiny_wav()) + .file_name("micro.wav") + .mime_str("audio/wav") + .unwrap(), + ), + ) + .send() + .await + .unwrap(); + assert_eq!(answer.status(), reqwest::StatusCode::OK); + let result: Value = answer.json().await.unwrap(); + assert_eq!(result["text"], "français vérifié"); + assert_eq!(result["providerId"], "strict-asr"); + } + + #[tokio::test] + async fn streamed_upload_over_the_old_twelve_mib_limit_succeeds() { + let (_tmp, state, base) = setup().await; + let large = vec![0u8; 13 * 1024 * 1024]; + let result = reqwest::Client::new() + .post(format!("{base}/api/v1/dictation/transcribe")) + .multipart(form("local-test", large)) + .send() + .await + .unwrap(); + assert_eq!(result.status(), reqwest::StatusCode::OK); + assert!( + state + .db + .list::("job") + .unwrap() + .is_empty() + ); + assert!( + std::fs::read_dir(state.config.quick_upload_dir()) + .unwrap() + .filter_map(Result::ok) + .all(|e| !e.file_name().to_string_lossy().starts_with("dictation-")) + ); + } + #[tokio::test] async fn invalid_provider_and_oversized_body_fail_without_jobs() { let (_tmp, state, base) = setup().await; @@ -456,7 +701,7 @@ mod integration_tests { assert_eq!(response.status(), reqwest::StatusCode::BAD_REQUEST); let response = client .post(format!("{base}/api/v1/dictation/transcribe")) - .multipart(form("local-test", vec![1u8; 12 * 1024 * 1024 + 1])) + .multipart(form("local-test", vec![1u8; 16 * 1024 * 1024 + 1])) .send() .await .unwrap(); diff --git a/src/api/mod.rs b/src/api/mod.rs index 41e7ebe..a44c54b 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -62,11 +62,13 @@ pub fn router() -> Router { .route("/api/v1/ready", get(ready)) .route("/api/v1/dashboard", get(dashboard::stats)) .route("/api/v1/events", get(events::events)) + .route( + "/api/v1/dictation/settings", + get(dictation::settings).put(dictation::save_settings), + ) .route( "/api/v1/dictation/transcribe", - post(dictation::transcribe).layer(axum::extract::DefaultBodyLimit::max( - 12 * 1024 * 1024 + 8192, - )), + post(dictation::transcribe).layer(axum::extract::DefaultBodyLimit::disable()), ) .route("/api/v1/browse", get(browse::browse)) .route( From 0727f8c1d5485929ab197ec6d98803b54435e62a Mon Sep 17 00:00:00 2001 From: GodsQuantum <193283917+GodsQuantum@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:23:40 +0100 Subject: [PATCH 4/7] fix(dictation): satisfy Rust 1.98 strict Clippy profile validation --- src/api/dictation.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/api/dictation.rs b/src/api/dictation.rs index 29dcfbd..9fce2db 100644 --- a/src/api/dictation.rs +++ b/src/api/dictation.rs @@ -98,16 +98,14 @@ pub async fn save_settings( .structure_profile_id .as_ref() .filter(|v| !v.is_empty()) - { - if !state + && !state .structure_profiles .read() .await .iter() .any(|p| p.id == *id && !p.provider_id.is_empty()) - { - return Err(AppError::BadRequest("AI profile unavailable".into())); - } + { + return Err(AppError::BadRequest("AI profile unavailable".into())); } if settings.language.len() > 20 || settings From 24d6125fff02c1d0dae04652de206aace0eecd18 Mon Sep 17 00:00:00 2001 From: GodsQuantum <193283917+GodsQuantum@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:45:12 +0100 Subject: [PATCH 5/7] fix(desktop): auto-select available loopback ports for app and local engines --- frontend/src/lib/views/AiProfilesView.svelte | 8 +- frontend/src/lib/views/LiveRecordView.svelte | 2 +- packaging/desktop/README.md | 14 +- packaging/desktop/launcher/src/main.rs | 124 +++++++++++++--- packaging/desktop/test_native_first_run.py | 64 +++++++++ .../desktop/test_native_port_fallback.py | 134 ++++++++++++++++++ src/api/embedded.rs | 42 ++++-- src/state.rs | 45 +++++- 8 files changed, 396 insertions(+), 37 deletions(-) create mode 100644 packaging/desktop/test_native_port_fallback.py diff --git a/frontend/src/lib/views/AiProfilesView.svelte b/frontend/src/lib/views/AiProfilesView.svelte index c68b12f..8d44a2e 100644 --- a/frontend/src/lib/views/AiProfilesView.svelte +++ b/frontend/src/lib/views/AiProfilesView.svelte @@ -95,6 +95,8 @@ } let embedded:EmbeddedRuntimeStatus={desktop:false,engines:[],download:{status:'',model:''}}; + $: embeddedSttOrigin = embedded.engines.find((engine)=>engine.kind==='stt')?.endpoint + ?.replace(/\/v1\/audio\/transcriptions$/, '') ?? 'http://127.0.0.1:38005'; let embeddedBusy=false; let selectedSTT='handy-computer/parakeet-ultra-gguf'; let selectedLLM='unsloth/Qwen3.5-4B-GGUF:Q4_K_M'; @@ -187,7 +189,7 @@ const model=embeddedLlmModels[0]??''; newProvider(); providerDraft={...providerDraft,name:'LLM intégré ScribeWatch', - chatCompletionsUrl:'http://127.0.0.1:38080/v1/chat/completions',model}; + chatCompletionsUrl:embedded.engines.find((e)=>e.kind==='llm')?.endpoint??'http://127.0.0.1:38080/v1/chat/completions',model}; providerModels=[...embeddedLlmModels]; } async function connectEmbeddedStt(){ @@ -196,7 +198,7 @@ embeddedBusy=true; try{ await api.saveProvider({id:'',name:'Transcription intégrée ScribeWatch', - transcriptionUrl:'http://127.0.0.1:38005/v1/audio/transcriptions', + transcriptionUrl:embedded.engines.find((e)=>e.kind==='stt')?.endpoint??'http://127.0.0.1:38005/v1/audio/transcriptions', model,timeoutSeconds:600,enabled:true,apiKey:''}); await refresh(); notify('success','Fournisseur de transcription interne créé. Choisissez-le pour vos workflows.'); @@ -328,7 +330,7 @@
- Gestion avancée des modèles ASR + Gestion avancée des modèles ASR