更新客户端渲染,更新了壳
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using YMhut.Box.Core.Plugins;
|
||||
|
||||
namespace YMhut.Box.Core.Plugins.Runtime;
|
||||
|
||||
public static class PluginRuntimeProtocol
|
||||
{
|
||||
public const string Version = "1";
|
||||
public const string Ready = "ready";
|
||||
public const string Ping = "ping";
|
||||
public const string Pong = "pong";
|
||||
public const string Launch = "launch";
|
||||
public const string ShellStart = "shellStart";
|
||||
public const string ShellInput = "shellInput";
|
||||
public const string ShellOutput = "shellOutput";
|
||||
public const string ShellExit = "shellExit";
|
||||
public const string BridgeCall = "bridgeCall";
|
||||
public const string Log = "log";
|
||||
public const string Cancel = "cancel";
|
||||
public const string Shutdown = "shutdown";
|
||||
public const string Error = "error";
|
||||
|
||||
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web)
|
||||
{
|
||||
WriteIndented = false,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters =
|
||||
{
|
||||
new JsonStringEnumConverter<PluginRuntimeKind>(),
|
||||
new JsonStringEnumConverter<PluginRuntimeSessionStatus>(),
|
||||
new JsonStringEnumConverter<ShellOutputStream>()
|
||||
}
|
||||
};
|
||||
|
||||
public static string Serialize(PluginRuntimeMessage message)
|
||||
{
|
||||
return JsonSerializer.Serialize(message, JsonOptions);
|
||||
}
|
||||
|
||||
public static PluginRuntimeMessage? Deserialize(string line)
|
||||
{
|
||||
return JsonSerializer.Deserialize<PluginRuntimeMessage>(line, JsonOptions);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record PluginRuntimeMessage(
|
||||
string Type,
|
||||
string RequestId = "",
|
||||
string? Version = null,
|
||||
PluginRuntimeLaunchRequest? LaunchRequest = null,
|
||||
PluginRuntimeSession? Session = null,
|
||||
ShellCommandSpec? ShellCommand = null,
|
||||
ShellOutputEvent? ShellOutput = null,
|
||||
string? ShellInput = null,
|
||||
PluginBridgeRequest? BridgeRequest = null,
|
||||
PluginBridgeResponse? BridgeResponse = null,
|
||||
string? LogLevel = null,
|
||||
string? LogCategory = null,
|
||||
string? LogMessage = null,
|
||||
string? LogDetail = null,
|
||||
int? ExitCode = null,
|
||||
string? Error = null);
|
||||
Reference in New Issue
Block a user