summaryrefslogtreecommitdiff
path: root/src/Agent.Mcp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Agent.Mcp')
-rw-r--r--src/Agent.Mcp/AgentTools.cs6
-rw-r--r--src/Agent.Mcp/McpHost.cs4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/Agent.Mcp/AgentTools.cs b/src/Agent.Mcp/AgentTools.cs
index 6a5759f..623c6a4 100644
--- a/src/Agent.Mcp/AgentTools.cs
+++ b/src/Agent.Mcp/AgentTools.cs
@@ -40,7 +40,7 @@ public sealed class AgentTools(TaskRegistry registry, LocaleCatalog locale, Visi
if (mcpTaskId is null) return queued;
using CancellationTokenRegistration registration = cancellationToken.Register(() => registry.Cancel(task.TaskId));
- TaskSnapshot terminal = await registry.WaitForTerminalAsync(task.TaskId, cancellationToken).ConfigureAwait(false);
+ TaskSnapshot terminal = await registry.WaitForTerminalAsync(task.TaskId, CancellationToken.None).ConfigureAwait(false);
if (terminal.State == AgentTaskState.Failed) throw new InvalidOperationException(terminal.Result ?? "Agent task failed.");
if (terminal.State == AgentTaskState.Cancelled) throw new OperationCanceledException("Agent task was cancelled.", cancellationToken);
return FormatStatus(terminal);
@@ -94,6 +94,10 @@ public sealed class AgentTools(TaskRegistry registry, LocaleCatalog locale, Visi
$"current_task: {task.CurrentTask ?? string.Empty}",
$"token_usage: input={task.InputTokens} output={task.OutputTokens} total={task.InputTokens + task.OutputTokens}",
$"critical_path_tokens: {task.CriticalPathTokens.ToString(System.Globalization.CultureInfo.InvariantCulture)}",
+ $"iterations: {task.Iterations}",
+ $"replans: {task.Replans}",
+ $"last_error_code: {task.LastErrorCode ?? string.Empty}",
+ $"last_error: {task.LastError ?? string.Empty}",
$"message: {locale.Get("mcp.status." + state)}",
terminal ? $"result: {task.Result}" : "result:");
}
diff --git a/src/Agent.Mcp/McpHost.cs b/src/Agent.Mcp/McpHost.cs
index 8ae25d5..bfb6d66 100644
--- a/src/Agent.Mcp/McpHost.cs
+++ b/src/Agent.Mcp/McpHost.cs
@@ -36,7 +36,7 @@ public static class McpHost
var registry = new TaskRegistry(sessionStore);
using var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(10) };
var ollama = new OllamaClient(httpClient, ollamaSettings);
- var runtime = new AgentRuntime(registry, ollama, runtimeSettings, toolDispatcher, observer);
+ var runtime = new AgentRuntime(registry, ollama, runtimeSettings, toolDispatcher, observer, locale: locale);
builder.Services.AddSingleton(locale);
builder.Services.AddSingleton(registry);
builder.Services.AddSingleton(runtime);
@@ -69,7 +69,7 @@ public static class McpHost
builder.WebHost.UseUrls($"http://{listenHost}:{port}");
var registry = new TaskRegistry(sessionStore);
var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(10) };
- var runtime = new AgentRuntime(registry, new OllamaClient(httpClient, ollamaSettings), runtimeSettings, toolDispatcher, observer);
+ var runtime = new AgentRuntime(registry, new OllamaClient(httpClient, ollamaSettings), runtimeSettings, toolDispatcher, observer, locale: locale);
builder.Services.AddSingleton(locale);
builder.Services.AddSingleton(registry);
builder.Services.AddSingleton(runtime);