Fixed plugin installation and endless plugin reloading on Linux (#924)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-08-15 19:55:42 +02:00
1 parent 01f25b2bc0
commit 8148b66876
15 files changed
+402 -95

No files matched your search

@@ -301,12 +301,40 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
return fileMap.ToImmutable();
}
/// <summary>
/// The audit hash of this plugin, together with the directory it was computed for.
/// </summary>
/// <remarks>
/// One record instead of two fields, so that a reader always sees a directory and a hash which
/// belong together. Recomputing the same hash twice costs nothing but time, mixing up a hash
/// with the wrong directory would show a wrong security state.
/// </remarks>
private sealed record AuditHashCache(string PluginPath, string Hash);
private AuditHashCache? auditHashCache;
/// <summary>
/// Computes a stable audit hash across all Lua files by hashing a canonical
/// sequence of relative path length, relative path, content length, and content
/// for each file in ordinal path order.
/// </summary>
public string ComputeAuditHash() => AssistantPluginHash.Compute(this.PluginPath);
/// <remarks>
/// The result is kept, because computing it reads every Lua file of the plugin, and the plugins
/// page as well as the assistants page ask for it on every render. That is safe: the files of
/// one plugin instance never change. Whenever something in the plugins directory changes, the
/// plugin factory reloads and creates new instances, cf. PluginFactory.Starting.RestartAllPlugins.
/// The plugin directory is assigned after the instance was created, so the cache remembers which
/// directory it belongs to.
/// </remarks>
public string ComputeAuditHash()
{
if (this.auditHashCache is { } cache && string.Equals(cache.PluginPath, this.PluginPath, StringComparison.Ordinal))
return cache.Hash;
var hash = AssistantPluginHash.Compute(this.PluginPath);
this.auditHashCache = new(this.PluginPath, hash);
return hash;
}
private static string BuildSecureSystemPrompt(string pluginSystemPrompt)
{