初始提交
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MAF1.PluginContract;
|
||||
|
||||
public sealed class PluginManifest
|
||||
{
|
||||
public string Id { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public string Description { get; set; } = "";
|
||||
public string Version { get; set; } = "1.0.0";
|
||||
public PluginLaunch Launch { get; set; } = new();
|
||||
public int TimeoutSeconds { get; set; }
|
||||
public Dictionary<string, string> Env { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
public List<PluginCredentialNeed> Credentials { get; set; } = [];
|
||||
public List<PluginPort> Inputs { get; set; } = [];
|
||||
public List<PluginPort> Outputs { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class PluginLaunch
|
||||
{
|
||||
public string Command { get; set; } = "";
|
||||
public List<string> Args { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class PluginPort
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public string Type { get; set; } = "string";
|
||||
public string Description { get; set; } = "";
|
||||
public bool Required { get; set; }
|
||||
}
|
||||
|
||||
public sealed class PluginCredentialNeed
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public string Type { get; set; } = "";
|
||||
public bool Required { get; set; } = true;
|
||||
public string Description { get; set; } = "";
|
||||
}
|
||||
|
||||
public sealed class PluginRequest
|
||||
{
|
||||
public Dictionary<string, object?> Inputs { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
[JsonPropertyName("credentials")]
|
||||
public Dictionary<string, PluginCredentialPayload> Credentials { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public sealed class PluginCredentialPayload
|
||||
{
|
||||
public string Id { get; set; } = "";
|
||||
public string Type { get; set; } = "";
|
||||
public string? Endpoint { get; set; }
|
||||
public string? ApiKey { get; set; }
|
||||
public string? Model { get; set; }
|
||||
public Dictionary<string, string> Extra { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public static class PluginJson
|
||||
{
|
||||
public static readonly System.Text.Json.JsonSerializerOptions Options = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase,
|
||||
WriteIndented = false,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user