feat: make Windows Agent configuration GUI-only
Build web service image / build (push) Successful in 40s
Build web service image / build (push) Successful in 40s
This commit is contained in:
@@ -25,20 +25,8 @@ try
|
||||
}
|
||||
|
||||
if (args[0] == "serve")
|
||||
{
|
||||
ValidateOptions(args, 1, ["--config"], []);
|
||||
var configPath = Path.GetFullPath(GetRequiredOption(args, "--config"));
|
||||
var serviceOptions = JsonSerializer.Deserialize<ServiceOptions>(
|
||||
await File.ReadAllTextAsync(configPath, shutdown.Token), ServiceHost.ConfigurationJson)
|
||||
?? throw new ArgumentException("A service configuration is required.");
|
||||
await using var app = ServiceHost.Build(serviceOptions, new WindowsAgentBackend(new AccountBindingStore(serviceOptions), serviceOptions),
|
||||
logPath: Path.Combine(Path.GetDirectoryName(configPath)!, "wxagent.log"));
|
||||
await app.StartAsync(shutdown.Token);
|
||||
try { await Task.Delay(Timeout.InfiniteTimeSpan, shutdown.Token); }
|
||||
catch (OperationCanceledException) when (shutdown.IsCancellationRequested) { }
|
||||
await app.StopAsync(CancellationToken.None);
|
||||
return 0;
|
||||
}
|
||||
throw new WxAgentException(WxAgentErrorCode.InvalidArgument,
|
||||
"Windows Agent must be started by double-clicking WxAgent.Tray.exe; configuration is GUI-only.");
|
||||
|
||||
var defaultTimeoutSeconds = ValidateCommandLine(args);
|
||||
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(shutdown.Token);
|
||||
@@ -1030,14 +1018,12 @@ static object ToMessageOutput(ChatMessageSnapshot message, bool includeContent)
|
||||
static int CountNodes(UiNodeSnapshot node) => 1 + node.Children.Sum(CountNodes);
|
||||
|
||||
static void PrintHelp() => Console.WriteLine("""
|
||||
WxAgent.Host commands:
|
||||
serve --config <service.json>
|
||||
remote auth show|set|clear --config <remote.json>
|
||||
auth set options: --address <url> --token <token> | --token-file <path> --node <id>
|
||||
[--server-ca-file <pem>] [--client-certificate-file <pem> --client-certificate-key-file <pem>]
|
||||
remote status show --config <remote.json> [--data-dir <dir>]
|
||||
remote probe run --config <remote.json> [--timeout 60]
|
||||
remote reporting show|enable|disable|account-add|account-enable|account-disable|allow|deny --config <remote.json>
|
||||
WxAgent.Host commands (diagnostics/read-only only; configuration is GUI-only):
|
||||
remote auth show --config <remote.json>
|
||||
remote status show --config <remote.json> [--data-dir <dir>]
|
||||
remote probe run --config <remote.json> [--timeout 60]
|
||||
remote reporting show --config <remote.json>
|
||||
WxAgent.Tray.exe must be started by double-click; use its 服务设置... window for configuration.
|
||||
doctor [--timeout 30]
|
||||
diagnose --output <dir> [--baseline <ui-tree.json>] [--timeout 60]
|
||||
inspect-ui --output <path> [--window-title <title>] [--timeout 30]
|
||||
|
||||
Reference in New Issue
Block a user