feat: support long text and safe attachment batches
Build web service image / build (push) Successful in 1m15s

This commit is contained in:
2026-09-30 09:16:36 +08:00
parent a977902b25
commit edba7d0d38
26 changed files with 720 additions and 82 deletions
@@ -841,7 +841,7 @@ public sealed class RemoteAgentHostedService(
JsonElement Content,
IReadOnlyList<RemoteReportingScope> ChatScopes);
private static async Task ReplayUnreportedResultsAsync(
private async Task ReplayUnreportedResultsAsync(
RemoteControlClient client,
RemoteTaskLedger ledger,
ReportingConfig reporting,
@@ -851,7 +851,7 @@ public sealed class RemoteAgentHostedService(
await ReportResultAsync(client, ledger, pending.Result, reporting, cancellationToken, pending.ReportingScopes);
}
private static async Task ReportResultAsync(
private async Task ReportResultAsync(
RemoteControlClient client,
RemoteTaskLedger ledger,
RemoteTaskResult result,
@@ -859,8 +859,16 @@ public sealed class RemoteAgentHostedService(
CancellationToken cancellationToken,
IReadOnlyList<RemoteReportingScope>? chatScopes = null)
{
await client.SendTaskResultAsync(result, reporting, chatScopes: chatScopes, cancellationToken: cancellationToken);
ledger.MarkReported(result.TaskId);
try
{
await client.SendTaskResultAsync(result, reporting, chatScopes: chatScopes, cancellationToken: cancellationToken);
ledger.MarkReported(result.TaskId);
}
catch (RemoteClientException exception) when (exception.StatusCode == 404 && exception.Code == "TaskNotFound")
{
ledger.MarkResultTaskNotFound(result.TaskId);
logger.LogWarning("Remote task result no longer exists on the control plane; result retained locally and will not be retried.");
}
}
private async Task<BackendSnapshot> ReadSnapshotAsync(RemoteAgentOptions remote, CancellationToken cancellationToken)
@@ -972,8 +980,16 @@ public sealed class RemoteAgentHostedService(
|| confirmed.ValueKind != JsonValueKind.True)
return false;
targetId = target.GetString() ?? "";
text = content.GetString() ?? "";
return targetId.Length is > 0 and <= 512 && text.Length is > 0 and <= 4000;
if (targetId.Length is 0 or > 512) return false;
try
{
text = WechatTextInput.PrepareLongText(content.GetString() ?? "");
return true;
}
catch (WxAgentException)
{
return false;
}
}
private static bool GetBoolean(JsonElement value, string propertyName) =>