diff --git a/AssistentSqliteBootstrap.cs b/AssistentSqliteBootstrap.cs
index 0ac39f6..5cc9bcc 100644
--- a/AssistentSqliteBootstrap.cs
+++ b/AssistentSqliteBootstrap.cs
@@ -1,3 +1,6 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
using System.Threading;
using SQLitePCL;
@@ -5,7 +8,9 @@ namespace Mrleo1nid.SwarmAssistent;
///
/// SwarmUI loads extensions in an isolated AssemblyLoadContext — Microsoft.Data.Sqlite
-/// does not auto-init native SQLite there. Call once before the first connection.
+/// does not auto-init native SQLite there. Native libs ship under the extension dir
+/// (runtimes/linux-x64/native/libe_sqlite3.so), but the loader searches the host
+/// base dir unless we preload from the extension assembly location.
///
internal static class AssistentSqliteBootstrap
{
@@ -17,6 +22,42 @@ internal static class AssistentSqliteBootstrap
{
return;
}
+ PreloadNativeLibrary();
Batteries_V2.Init();
}
+
+ static void PreloadNativeLibrary()
+ {
+ string extDir = Path.GetDirectoryName(typeof(AssistentSqliteBootstrap).Assembly.Location)
+ ?? AppContext.BaseDirectory
+ ?? "";
+ if (string.IsNullOrWhiteSpace(extDir))
+ {
+ return;
+ }
+ string[] relPaths =
+ [
+ Path.Combine("runtimes", "linux-x64", "native", "libe_sqlite3.so"),
+ Path.Combine("runtimes", "linux-x64", "native", "e_sqlite3.so"),
+ "libe_sqlite3.so",
+ "e_sqlite3.so",
+ ];
+ foreach (string rel in relPaths)
+ {
+ string path = Path.Combine(extDir, rel);
+ if (!File.Exists(path))
+ {
+ continue;
+ }
+ try
+ {
+ NativeLibrary.Load(path);
+ return;
+ }
+ catch (Exception ex)
+ {
+ SwarmUI.Utils.Logs.Debug($"AssistentSqliteBootstrap: NativeLibrary.Load({path}): {ex.Message}");
+ }
+ }
+ }
}
diff --git a/SwarmAssistentExtension.cs b/SwarmAssistentExtension.cs
index 73c04d0..1937c87 100644
--- a/SwarmAssistentExtension.cs
+++ b/SwarmAssistentExtension.cs
@@ -33,7 +33,7 @@ public partial class SwarmAssistentExtension : Extension
ExtensionAuthor = "mrleo1nid";
Description = "Collaborative Krea 2 assistant: Ollama chat, persona presets, vector memory, model cards, Generate loop.";
License = "MIT";
- Version = "0.15.12";
+ Version = "0.15.13";
Tags = ["tabs", "ui", "llm", "ollama", "krea", "inpaint", "memory", "training", "heard", "qlora"];
}
diff --git a/SwarmAssistentExtension.csproj b/SwarmAssistentExtension.csproj
index 0dbb4ac..4989f6c 100644
--- a/SwarmAssistentExtension.csproj
+++ b/SwarmAssistentExtension.csproj
@@ -22,7 +22,7 @@
AND !$([System.String]::Copy('%(ReferenceCopyLocalPaths.NuGetPackageId)').StartsWith('SQLitePCLRaw'))" />
-
+
<_SqliteNative Include="@(RuntimeCopyLocalItems)"
@@ -32,5 +32,13 @@
DestinationFiles="$(OutputPath)@(_SqliteNative->'%(RuntimeCopyLocalItems.DestinationSubPath)')"
SkipUnchangedFiles="true"
Condition="'@(_SqliteNative)' != ''" />
+
+