@mono-agent/agent-runtime 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-agent/agent-runtime",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "Agent runtime supporting Claude SDK/CLI, Codex, OpenCode, and Pi SDK bridges out of the box",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-only",
@@ -785,6 +785,11 @@ export async function initPiMcpTools(mcpConfig, reservedNames = new Set(), {
785
785
  details: {
786
786
  server: serverName,
787
787
  tool: sourceTool.name,
788
+ // pi-agent-core treats a resolved execute() call as successful.
789
+ // Preserve the MCP protocol's explicit error bit in details so
790
+ // the harness after-tool hook can replace that default without
791
+ // throwing away the bounded content or structuredContent below.
792
+ ...(out?.isError === true ? { mcp_result_is_error: true } : {}),
788
793
  mcp_call_duration_ms: mcpCallDurationMs,
789
794
  result_truncated: mcpContentWasTruncated(out, { textLimit, imageInlineMaxBytes }),
790
795
  raw: compactRawMcpResult(out),
@@ -191,6 +191,14 @@ export function buildTurnHarness(runState, {
191
191
  steeringMode,
192
192
  followUpMode: steeringMode,
193
193
  });
194
+ // MCP `CallToolResult.isError` is a successful protocol response, so pi's
195
+ // execute() promise resolves. The bridge records that bit in result details;
196
+ // this after-tool hook restores the error flag while preserving the already
197
+ // bounded content/details verbatim. Downstream tool_execution_end and timing
198
+ // events therefore report the failure accurately.
199
+ harness.on("tool_result", (event) => /** @type {any} */ (event?.details)?.mcp_result_is_error === true
200
+ ? { isError: true }
201
+ : undefined);
194
202
  runState.harness = harness;
195
203
 
196
204
  harness.subscribe(createStreamSubscriber(runState, { onEvent, options, toolLimits, harness }));