parsing DEPLOYED_USING_CONFIG_SERVER from assistant plugins

This commit is contained in:
krut_ni 2026-07-13 17:51:57 +02:00
parent a0065e628e
commit 2ff8a878bd
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
2 changed files with 11 additions and 0 deletions

View File

@ -37,6 +37,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
public bool HasEmbeddedProfileSelection { get; private set; } public bool HasEmbeddedProfileSelection { get; private set; }
public bool HasCustomPromptBuilder => this.buildPromptFunction is not null; public bool HasCustomPromptBuilder => this.buildPromptFunction is not null;
public bool IsAssistantBuilderGenerated { get; private set; } public bool IsAssistantBuilderGenerated { get; private set; }
public bool IsManagedByConfigServer { get; private set; }
public AssistantPluginLaunchBehavior LaunchBehavior { get; private set; } public AssistantPluginLaunchBehavior LaunchBehavior { get; private set; }
public string LaunchWorkspaceName { get; private set; } = string.Empty; public string LaunchWorkspaceName { get; private set; } = string.Empty;
public bool StartsChatDirectly => this.LaunchBehavior is AssistantPluginLaunchBehavior.OPEN_WORKSPACE_CHAT_BY_NAME; public bool StartsChatDirectly => this.LaunchBehavior is AssistantPluginLaunchBehavior.OPEN_WORKSPACE_CHAT_BY_NAME;
@ -65,12 +66,14 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
message = string.Empty; message = string.Empty;
this.HasEmbeddedProfileSelection = false; this.HasEmbeddedProfileSelection = false;
this.IsAssistantBuilderGenerated = false; this.IsAssistantBuilderGenerated = false;
this.IsManagedByConfigServer = false;
this.buildPromptFunction = null; this.buildPromptFunction = null;
this.LaunchBehavior = AssistantPluginLaunchBehavior.NONE; this.LaunchBehavior = AssistantPluginLaunchBehavior.NONE;
this.LaunchWorkspaceName = string.Empty; this.LaunchWorkspaceName = string.Empty;
this.RegisterLuaHelpers(); this.RegisterLuaHelpers();
this.TryReadAssistantBuilderMetadata(); this.TryReadAssistantBuilderMetadata();
this.TryReadDeploymentMetadata();
// Ensure that the main ASSISTANT table exists and is a valid Lua table: // Ensure that the main ASSISTANT table exists and is a valid Lua table:
if (!this.State.Environment["ASSISTANT"].TryRead<LuaTable>(out var assistantTable)) if (!this.State.Environment["ASSISTANT"].TryRead<LuaTable>(out var assistantTable))
@ -163,6 +166,12 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
this.IsAssistantBuilderGenerated = generated; this.IsAssistantBuilderGenerated = generated;
} }
private void TryReadDeploymentMetadata()
{
if (this.State.Environment["DEPLOYED_USING_CONFIG_SERVER"].TryRead<bool>(out var deployedUsingConfigServer))
this.IsManagedByConfigServer = deployedUsingConfigServer;
}
private bool TryReadLaunchConfiguration(LuaTable assistantTable, out string message) private bool TryReadLaunchConfiguration(LuaTable assistantTable, out string message)
{ {
message = string.Empty; message = string.Empty;

View File

@ -121,6 +121,8 @@ public static partial class PluginFactory
LOG.LogWarning($"The configuration plugin '{plugin.Id}' does not define 'DEPLOYED_USING_CONFIG_SERVER'. Falling back to the plugin path and treating it as managed because it is stored under '{CONFIGURATION_PLUGINS_ROOT}'."); LOG.LogWarning($"The configuration plugin '{plugin.Id}' does not define 'DEPLOYED_USING_CONFIG_SERVER'. Falling back to the plugin path and treating it as managed because it is stored under '{CONFIGURATION_PLUGINS_ROOT}'.");
} }
} }
else if (plugin is PluginAssistants assistantPlugin)
isManagedByConfigServer = assistantPlugin.IsManagedByConfigServer;
// For configuration plugins, validate that the plugin ID matches the enterprise config ID // For configuration plugins, validate that the plugin ID matches the enterprise config ID
// (the directory name under which the plugin was downloaded): // (the directory name under which the plugin was downloaded):