diff --git a/app/MindWork AI Studio.slnx.DotSettings b/app/MindWork AI Studio.slnx.DotSettings index 946c944e5..b223c4ecd 100644 --- a/app/MindWork AI Studio.slnx.DotSettings +++ b/app/MindWork AI Studio.slnx.DotSettings @@ -10,6 +10,7 @@ FNV GWDG HF + IAI IERI IMIME IONOS diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md b/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md index 14436757c..f2ad7a435 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.11.2.md @@ -52,6 +52,7 @@ - Fixed the Mathematics prototype, which told the AI that a correct derivative or integral had failed its check when the values of the function were far larger than those of its derivative. - Fixed the Mathematics prototype getting stuck for a long time when it checked a result with a very large factorial or power. Meanwhile, no other calculation could run. - Fixed AI Studio ceasing to work when many files in a folder of a local data source changed within a short time, e.g., during a software build or while a sync tool updated the folder. +- Fixed transcripts of audio and video files which could miss whole passages. Before a transcription, AI Studio converts the file into a compact format, and it stored a few pieces of the sound in a way that many programs could not read. They then skipped up to half a minute of the recording at a time, so that the transcript lacked what was said there. - Upgraded several libraries to improve security. - Upgraded Tauri to v2.12.7. - Upgraded MudBlazor to v9.14.0. diff --git a/runtime/Cargo.lock b/runtime/Cargo.lock index e9f6e56e2..f29c09baa 100644 --- a/runtime/Cargo.lock +++ b/runtime/Cargo.lock @@ -523,26 +523,22 @@ dependencies = [ ] [[package]] -name = "audio-core" -version = "0.2.1" +name = "audio-codec-algorithms" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ebbf82d06013f4c41fe71303feb980cddd78496d904d06be627972de51a24" +checksum = "1254ebf6529f3763c491acfb5ab6e960809e3c75a38584cc664f8c5667fb7107" [[package]] name = "audioadapter" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75c3943c6c7279bb25a449a8d1727480730ab2efd7b6fd5d6ca51927096e6e4" -dependencies = [ - "audio-core", - "num-traits", -] +checksum = "d1292ef9edf681b7426ed089004b021a42896492f58bd0c909ad44e5faec9ac4" [[package]] name = "audioadapter-buffers" -version = "4.0.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece3390b6eb40379094843a1da5aaccc34bc0d85a8cbf68d09fe092fee6de29e" +checksum = "46289a81a3bfa26d0f8b2415f8ca9decde9a66308a150568af5c102381b3c8ce" dependencies = [ "audioadapter", "audioadapter-sample", @@ -551,11 +547,11 @@ dependencies = [ [[package]] name = "audioadapter-sample" -version = "4.0.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1592f90413568e259413c21a41a3d571feb1774255c209e7966d98f9db708c90" +checksum = "5258faecf4edbe35ec483bda9b1f7438e6b391891819269c6b5461aeaa0e8d7d" dependencies = [ - "audio-core", + "audio-codec-algorithms", "num-traits", ] @@ -685,9 +681,9 @@ dependencies = [ [[package]] name = "axum-server" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1df331683d982a0b9492b38127151e6453639cd34926eb9c07d4cd8c6d22bfc" +checksum = "3766086d344b8f8d2a9cf6fb211b581de5b160e052d7bc75a92e58cc41909054" dependencies = [ "arc-swap", "bytes", @@ -700,6 +696,7 @@ dependencies = [ "pin-project-lite", "rustls", "rustls-pki-types", + "socket2", "tokio", "tokio-rustls", "tower-service", @@ -1933,15 +1930,6 @@ dependencies = [ "ctutils", ] -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs" version = "7.0.0" @@ -2121,10 +2109,11 @@ checksum = "4a742b95783b1f45b900129082cbc47717b6a77ee8d17eea70a8ea62462f5de3" [[package]] name = "ebml-iterable" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5173ac3752f08b526a6991509615e1a345b221ec3c58c7633433e8c9582312" +checksum = "152f8f4a13024011b26457b8b21040d9a9eb1222e693993ef037db391cd0c004" dependencies = [ + "bytes", "ebml-iterable-specification", "ebml-iterable-specification-derive", "futures", @@ -2452,11 +2441,11 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.31.10" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4945fa9cdfd7571192cf559c186d45ab36c8034482a2d217a19bdc566f190cc" +checksum = "5e87b74024da93123949cca26cb6e366744234fdd4d7914eb3dfeab0baa82d51" dependencies = [ - "chrono", + "jiff 1.0.2", "log", "nu-ansi-term", "regex", @@ -4342,7 +4331,7 @@ dependencies = [ "async-stream", "axum", "axum-server", - "base64 0.22.1", + "base64 0.23.1", "bytes", "calamine", "cbc 0.2.1", @@ -4351,7 +4340,7 @@ dependencies = [ "chrono", "dbus-secret-service", "dbus-secret-service-keyring-store", - "dirs 6.0.0", + "dirs", "docx-to-md", "encoding_rs", "file-format", @@ -4385,7 +4374,7 @@ dependencies = [ "subtle", "symphonia", "sys-locale", - "sysinfo", + "sysinfo 0.40.4", "tauri", "tauri-build", "tauri-plugin-dialog", @@ -4963,17 +4952,6 @@ dependencies = [ "objc2-core-foundation", ] -[[package]] -name = "objc2-open-directory" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb82bed227edf5201dfedf072bba4015a33d3d4a98519837295a90f0a23f676d" -dependencies = [ - "objc2", - "objc2-core-foundation", - "objc2-foundation", -] - [[package]] name = "objc2-osa-kit" version = "0.3.2" @@ -5831,7 +5809,7 @@ dependencies = [ "smallvec", "strum", "stumpalo", - "sysinfo", + "sysinfo 0.39.6", "tap", "tar", "tempfile", @@ -6344,9 +6322,9 @@ dependencies = [ [[package]] name = "rubato" -version = "4.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f57c655d11e929f05a8663b323ff553f8d9773be05dfdc087795955bedeb8d92" +checksum = "6b4da228e06632d025557f798114057cf27a4c6a71d40024c84d6db82fa5ef4a" dependencies = [ "audioadapter", "audioadapter-buffers", @@ -7499,7 +7477,20 @@ dependencies = [ "ntapi", "objc2-core-foundation", "objc2-io-kit", - "objc2-open-directory", + "windows", +] + +[[package]] +name = "sysinfo" +version = "0.40.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e80749408e2d8bec0ffa303012cf4e1b3b355f4a09087b4fdf7473680f6a2de" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", "windows", ] @@ -7626,7 +7617,7 @@ dependencies = [ "anyhow", "bytes", "cookie", - "dirs 7.0.0", + "dirs", "dunce", "embed_plist", "getrandom 0.3.4", @@ -7676,7 +7667,7 @@ checksum = "73d80784e874fa117b9b00a6680cf2f9b8a51bbd14406bea980cf8f328b00646" dependencies = [ "anyhow", "cargo_toml", - "dirs 7.0.0", + "dirs", "glob", "heck 0.5.0", "json-patch", @@ -7873,7 +7864,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b" dependencies = [ "base64 0.23.1", - "dirs 7.0.0", + "dirs", "flate2", "futures-util", "http", @@ -8440,7 +8431,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72" dependencies = [ "crossbeam-channel", - "dirs 7.0.0", + "dirs", "libappindicator", "muda", "objc2", @@ -9023,9 +9014,9 @@ dependencies = [ [[package]] name = "webm-iterable" -version = "0.6.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fbf173b4b38f2f8bbb0082a0d4cb21f263a70811f5fccb1663c421c66d9f9" +checksum = "2b1f0c637f1c2b46d58a1b42b150135f8a31b024bfdcd56cc82febfbb20ba4c0" dependencies = [ "ebml-iterable", ] @@ -9615,7 +9606,7 @@ dependencies = [ "block2", "cookie", "crossbeam-channel", - "dirs 7.0.0", + "dirs", "dom_query 0.29.0", "dpi", "dunce", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index b9a996f53..9ede3fc3e 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -30,18 +30,18 @@ tokio = { version = "1.54.1", features = ["rt", "rt-multi-thread", "macros", "pr tokio-stream = { version = "0.1.19", features = ["sync"] } futures = "0.3.34" async-stream = "0.3.6" -flexi_logger = "0.31.10" +flexi_logger = "0.32.0" chrono = "0.4.45" -dirs = "6.0.0" +dirs = "7.0.0" log = { version = "0.4.35", features = ["kv"] } once_cell = "1.21.4" axum = { version = "0.8.9", features = ["http2", "json", "query", "tokio"] } -axum-server = { version = "0.8.0", features = ["tls-rustls"] } +axum-server = { version = "0.9.2", features = ["tls-rustls"] } rustls = { version = "0.23.46", default-features = false, features = ["aws_lc_rs"] } rand = "0.10.4" rand_chacha = "0.10.0" subtle = "2.6.1" -base64 = "0.22.1" +base64 = "0.23.1" aes = "0.9.4" cbc = "0.2.1" pbkdf2 = "0.13.0" @@ -63,8 +63,8 @@ encoding_rs = "0.8.44" symphonia = { version = "0.6", default-features = false, features = ["aac", "aiff", "alac", "caf", "flac", "isomp4", "mkv", "mp1", "mp2", "mp3", "ogg", "pcm", "vorbis", "wav"] } ropus = "=0.12.18" -rubato = { version = "4", default-features = false, features = ["fft_resampler"] } -webm-iterable = "0.6.4" +rubato = { version = "5.1.0", default-features = false, features = ["fft_resampler"] } +webm-iterable = "0.7.1" calamine = "0.37.0" # pdfium-render binds the functions of a certain PDFium version when it loads the library, and refuses a @@ -88,7 +88,7 @@ onenote_parser = "2.1.0" typed-path = "0.12.4" tempfile = "3.27.0" strum_macros = "0.28.0" -sysinfo = "0.39.6" +sysinfo = { version = "0.40.4", default-features = false, features = ["system", "disk"] } bytes = "1.12.2" qdrant-edge = "0.9.0" diff --git a/runtime/src/log.rs b/runtime/src/log.rs index 9acb23795..4035bf001 100644 --- a/runtime/src/log.rs +++ b/runtime/src/log.rs @@ -338,10 +338,13 @@ fn get_log_time(now: &mut DeferredNow, record: &log::Record) -> LogTime { }, // Case: The event happened earlier, e.g., in the .NET server. The logger - // runs in UTC (see init_logging), so this time is written in UTC as well: + // runs in UTC (see init_logging), so this time is written in UTC as well. + // flexi_logger keeps the arrival time as a jiff value, whose microseconds + // since the Unix epoch carry it over to chrono: Some(created_at) => LogTime { timestamp: created_at.format(flexi_logger::TS_DASHES_BLANK_COLONS_DOT_BLANK).to_string(), - delay_ms: get_notable_delay_ms(created_at, now.now_utc_owned()), + delay_ms: DateTime::::from_timestamp_micros(now.now().timestamp().as_microsecond()) + .and_then(|arrived_at| get_notable_delay_ms(created_at, arrived_at)), }, } } diff --git a/runtime/src/media.rs b/runtime/src/media.rs index 7e6445f5f..fd663eb19 100644 --- a/runtime/src/media.rs +++ b/runtime/src/media.rs @@ -1738,6 +1738,31 @@ mod tests { assert_eq!(clusters, 2); } + /// Verifies that every block keeps a known size. A block of exactly 127 bytes, i.e., an Opus + /// packet of 123 bytes plus the 4 bytes of the block header, must not get the size 0xFF, which + /// EBML reserves for an element of unknown size. + #[test] + fn webm_writer_keeps_the_size_of_every_block_known() { + let path = std::env::temp_dir().join(format!("ai-studio-media-block-size-{}.webm", rand::random::())); + let mut writer = WebmOpusWriter::new(File::create(&path).unwrap()).unwrap(); + for (index, packet_len) in [122, 123, 124].into_iter().enumerate() { + writer.write_packet(&vec![0xf8; packet_len], index as u64 * 960).unwrap(); + } + + writer.finish().unwrap(); + let bytes = fs::read(&path).unwrap(); + let _ = fs::remove_file(path); + let tags = WebmIterator::new(Cursor::new(bytes), &[]).collect::, _>>().unwrap(); + let block_lengths: Vec<_> = tags.iter() + .filter_map(|tag| match tag { + MatroskaSpec::SimpleBlock(block) => Some(block.len()), + _ => None, + }) + .collect(); + + assert_eq!(block_lengths, vec![126, 127, 128]); + } + /// Verifies deterministic arithmetic-mean downmixing. #[test] fn downmix_is_bounded_and_balanced() { diff --git a/runtime/src/qdrant_edge_database.rs b/runtime/src/qdrant_edge_database.rs index 247ccb3a5..2bb8a1a89 100644 --- a/runtime/src/qdrant_edge_database.rs +++ b/runtime/src/qdrant_edge_database.rs @@ -805,7 +805,7 @@ fn ensure_enough_space(required_bytes: u64, available_bytes: Option) -> Qdr /// path as it is serves as the fallback. fn available_space(path: &Path) -> Option { let disks = sysinfo::Disks::new_with_refreshed_list() - .list() + .ok()? .iter() .map(|disk| DiskSpace { mount_point: disk.mount_point().to_path_buf(), @@ -2018,10 +2018,13 @@ mod tests { database.search_embedding(SEARCH_STORE, search_vector(), 3, None, &[]).unwrap(); assert_eq!(payload_indexes(&database).len(), INDEXED_PAYLOAD_FIELDS.len()); + // On Windows, an open WAL locks the file `.wal` in its directory against every other handle, + // so the WAL can be read only after the store is closed, just like before it was loaded: + drop(database); + // Not assert_eq: on failure, it would print every byte of the WAL. assert!(file_contents(&wal_path) == wal, "loading the store left its WAL as it was"); - drop(database); fs::remove_dir_all(test_directory).unwrap(); } diff --git a/runtime/src/stale_process_cleanup.rs b/runtime/src/stale_process_cleanup.rs index 73e92111f..92ea23c51 100644 --- a/runtime/src/stale_process_cleanup.rs +++ b/runtime/src/stale_process_cleanup.rs @@ -32,7 +32,8 @@ pub fn kill_stale_process(pid_file_path: PathBuf, sidecar_type: SidecarType) -> let pid_file_content = fs::read_to_string(&pid_file_path)?; let (pid, expected_name) = parse_pid_file(&pid_file_content)?; - let mut system = System::new_all(); + // Refreshing the one process adds it, so the system needs to load nothing else: + let mut system = System::new().map_err(Error::other)?; let pid = Pid::from_u32(pid); system.refresh_processes(ProcessesToUpdate::Some(&[pid]), true); @@ -63,7 +64,17 @@ pub fn kill_stale_process(pid_file_path: PathBuf, sidecar_type: SidecarType) -> } pub fn log_potential_stale_process(pid_file_path: PathBuf, pid: u32, sidecar_type: SidecarType) { - let mut system = System::new_all(); + let mut system = match System::new() { + Ok(system) => system, + Err(e) => { + warn!(Source="Stale Process Cleanup"; + "{}: Pid file with process number '{}' was not created because the processes could not be read: {}", + sidecar_type, pid, e + ); + return; + } + }; + let pid = Pid::from_u32(pid); system.refresh_processes(ProcessesToUpdate::Some(&[pid]), true); let Some(process) = system.process(pid) else { @@ -87,3 +98,26 @@ pub fn log_potential_stale_process(pid_file_path: PathBuf, pid: u32, sidecar_typ } } } + +// The test starts `sleep`, which Windows lacks: +#[cfg(all(test, unix))] +mod tests { + use super::*; + + /// Verifies that a process found by its number alone gets a PID file and is killed later on. + #[test] + fn stale_process_is_recorded_and_killed() { + use std::os::unix::process::ExitStatusExt; + + let mut child = std::process::Command::new("sleep").arg("30").spawn().unwrap(); + let pid_file_path = std::env::temp_dir().join(format!("ai-studio-stale-process-{}.pid", rand::random::())); + + log_potential_stale_process(pid_file_path.clone(), child.id(), SidecarType::Dotnet); + let content = fs::read_to_string(&pid_file_path).unwrap(); + assert_eq!(content, format!("{}\nsleep\n", child.id())); + + kill_stale_process(pid_file_path.clone(), SidecarType::Dotnet).unwrap(); + assert!(!pid_file_path.exists()); + assert_eq!(child.wait().unwrap().signal(), Some(9)); + } +}