fix: GatewayClient Tool-Namen + Response-Unwrapping
- sub_agents_list → subagents (action: list)
- cron_list → cron (action: list)
- Ping / → /health
- Unwrap {ok, result} envelope in InvokeToolAsync
This commit is contained in:
@@ -50,7 +50,11 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
|
|||||||
if (string.IsNullOrWhiteSpace(json))
|
if (string.IsNullOrWhiteSpace(json))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return JsonNode.Parse(json);
|
var node = JsonNode.Parse(json);
|
||||||
|
// Unwrap the { ok: true, result: ... } envelope
|
||||||
|
if (node?["ok"]?.GetValue<bool>() == true && node["result"] is not null)
|
||||||
|
return node["result"];
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -91,7 +95,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Also get subagents list
|
// Also get subagents list
|
||||||
var subagentsResult = await InvokeToolAsync("sub_agents_list");
|
var subagentsResult = await InvokeToolAsync("subagents", new { action = "list" });
|
||||||
if (subagentsResult is not null && subagentsResult is JsonArray subArray)
|
if (subagentsResult is not null && subagentsResult is JsonArray subArray)
|
||||||
{
|
{
|
||||||
foreach (var sub in subArray)
|
foreach (var sub in subArray)
|
||||||
@@ -190,7 +194,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await InvokeToolAsync("cron_list");
|
var result = await InvokeToolAsync("cron", new { action = "list" });
|
||||||
if (result is null)
|
if (result is null)
|
||||||
return new List<QueueItem>();
|
return new List<QueueItem>();
|
||||||
|
|
||||||
@@ -226,7 +230,7 @@ public sealed class OpenClawGatewayClient(HttpClient httpClient, IConfiguration
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Check gateway health
|
// Check gateway health
|
||||||
using var pingRequest = new HttpRequestMessage(HttpMethod.Get, "/");
|
using var pingRequest = new HttpRequestMessage(HttpMethod.Get, "/health");
|
||||||
ApplyAuth(pingRequest);
|
ApplyAuth(pingRequest);
|
||||||
using var pingResponse = await httpClient.SendAsync(pingRequest);
|
using var pingResponse = await httpClient.SendAsync(pingRequest);
|
||||||
gatewayOk = pingResponse.IsSuccessStatusCode;
|
gatewayOk = pingResponse.IsSuccessStatusCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user