Added support for live plugin content via ILivePluginContent

This commit is contained in:
Thorsten Sommer 2026-06-20 18:58:36 +02:00
parent 9b29c9896c
commit 28e30b024e
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
5 changed files with 36 additions and 8 deletions

View File

@ -112,12 +112,16 @@ Plugins can configure:
- Chat templates - Chat templates
- etc. - etc.
When adding configuration options, update: Configuration plugins provide three kinds of values:
- `app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs`: In method `TryProcessConfiguration` register new options. - **Managed settings:** simple values such as booleans, numbers, strings, enums, lists, or sets handled through `ManagedConfiguration`. These values may be locked or used as organization defaults.
- `app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs`: In method `LoadAll` check for leftover configuration. - **Managed configuration objects:** complex Lua tables that are persisted into `SettingsManager.ConfigurationData`, implement `IConfigurationObject`, and are cleaned up through `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`. Examples include providers, profiles, chat templates, data sources, and document analysis policies.
- The corresponding data class in `app/MindWork AI Studio/Settings/DataModel/` to call `ManagedConfiguration.Register(...)`, when adding config options (in contrast to complex config. objects) - **Live plugin content:** complex Lua tables that implement `ILivePluginContent` and are read live from running plugins instead of being persisted to `ConfigurationData`. Examples include `MANDATORY_INFOS` and `INTRODUCTIONS`. If live plugin content creates persistent side data, add a dedicated cleanup path for that side data, like mandatory-info acceptances.
- `app/MindWork AI Studio/Tools/PluginSystem/PluginConfigurationObject.cs` for parsing logic of complex configuration objects.
- `app/MindWork AI Studio/Plugins/configuration/plugin.lua` to document the new configuration option. When adding configuration plugin capabilities:
- For managed settings, update the corresponding data class in `app/MindWork AI Studio/Settings/DataModel/` to call `ManagedConfiguration.Register(...)`, process the setting in `PluginConfiguration.TryProcessConfiguration`, and check for leftover managed configuration in `PluginFactory.Loading.LoadAll`.
- For managed configuration objects, update `PluginConfigurationObject.cs` and `PluginConfigurationObjectType.cs`, persist them in the appropriate `ConfigurationData` collection, and add cleanup via `PluginConfigurationObject.CleanLeftOverConfigurationObjects(...)`.
- For live plugin content, add a data type implementing `ILivePluginContent`, parse it in `PluginConfiguration`, expose it through `PluginFactory`, and add any required cleanup only for persistent side data.
- Always document the new capability in `app/MindWork AI Studio/Plugins/configuration/plugin.lua`.
## RAG (Retrieval-Augmented Generation) ## RAG (Retrieval-Augmented Generation)

View File

@ -1,8 +1,10 @@
using AIStudio.Tools.PluginSystem;
using Lua; using Lua;
namespace AIStudio.Settings.DataModel; namespace AIStudio.Settings.DataModel;
public sealed record DataIntroduction public sealed record DataIntroduction : ILivePluginContent
{ {
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataIntroduction>(); private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataIntroduction>();

View File

@ -1,11 +1,13 @@
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using AIStudio.Tools.PluginSystem;
using Lua; using Lua;
namespace AIStudio.Settings.DataModel; namespace AIStudio.Settings.DataModel;
public sealed record DataMandatoryInfo public sealed record DataMandatoryInfo : ILivePluginContent
{ {
private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataMandatoryInfo>(); private static readonly ILogger LOG = Program.LOGGER_FACTORY.CreateLogger<DataMandatoryInfo>();

View File

@ -0,0 +1,18 @@
namespace AIStudio.Tools.PluginSystem;
/// <summary>
/// Represents complex content from a configuration plugin that is read live from
/// running plugins and is not persisted to the settings data model.
/// </summary>
public interface ILivePluginContent
{
/// <summary>
/// The stable ID of the live plugin content.
/// </summary>
public string Id { get; }
/// <summary>
/// The ID of the enterprise configuration plugin that provides this content.
/// </summary>
public Guid EnterpriseConfigurationPluginId { get; }
}

View File

@ -23,11 +23,13 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
/// <summary> /// <summary>
/// The list of mandatory infos provided by this configuration plugin. /// The list of mandatory infos provided by this configuration plugin.
/// Mandatory infos are live plugin content and are not persisted to ConfigurationData.
/// </summary> /// </summary>
public IReadOnlyList<DataMandatoryInfo> MandatoryInfos => this.mandatoryInfos; public IReadOnlyList<DataMandatoryInfo> MandatoryInfos => this.mandatoryInfos;
/// <summary> /// <summary>
/// The list of introductions provided by this configuration plugin. /// The list of introductions provided by this configuration plugin.
/// Introductions are live plugin content and are not persisted to ConfigurationData.
/// </summary> /// </summary>
public IReadOnlyList<DataIntroduction> Introductions => this.introductions; public IReadOnlyList<DataIntroduction> Introductions => this.introductions;