@oh-my-pi/pi-agent-core 14.9.3 → 14.9.5
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/CHANGELOG.md +6 -0
- package/package.json +4 -4
- package/src/agent-loop.ts +7 -2
- package/src/types.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [14.9.5] - 2026-05-12
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added an `isError?: boolean` field on `AgentToolResult` so tools can flag a non-throwing failure (e.g. an aggregator that catches per-entry errors). `coerceToolResult` preserves the flag and the agent loop surfaces it as a tool error on the wire.
|
|
10
|
+
|
|
5
11
|
## [14.9.3] - 2026-05-10
|
|
6
12
|
### Added
|
|
7
13
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-agent-core",
|
|
4
|
-
"version": "14.9.
|
|
4
|
+
"version": "14.9.5",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"fmt": "biome format --write ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oh-my-pi/pi-ai": "14.9.
|
|
39
|
-
"@oh-my-pi/pi-natives": "14.9.
|
|
40
|
-
"@oh-my-pi/pi-utils": "14.9.
|
|
38
|
+
"@oh-my-pi/pi-ai": "14.9.5",
|
|
39
|
+
"@oh-my-pi/pi-natives": "14.9.5",
|
|
40
|
+
"@oh-my-pi/pi-utils": "14.9.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@sinclair/typebox": "^0.34.49",
|
package/src/agent-loop.ts
CHANGED
|
@@ -58,12 +58,17 @@ function coerceToolResult(raw: unknown): { result: AgentToolResult<any>; malform
|
|
|
58
58
|
const rawObj = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : null;
|
|
59
59
|
const rawContent = rawObj?.content;
|
|
60
60
|
const details = rawObj && "details" in rawObj ? rawObj.details : {};
|
|
61
|
+
// Tools may flag a non-throwing failure on the result itself (e.g. an
|
|
62
|
+
// aggregator that catches per-entry errors and synthesizes a combined
|
|
63
|
+
// result). Preserve the flag so agent-loop can surface it on the wire.
|
|
64
|
+
const explicitError = Boolean(rawObj && "isError" in rawObj && rawObj.isError);
|
|
61
65
|
|
|
62
66
|
if (!Array.isArray(rawContent)) {
|
|
63
67
|
return {
|
|
64
68
|
result: {
|
|
65
69
|
content: [{ type: "text", text: "Tool returned an invalid result: missing content array." }],
|
|
66
70
|
details,
|
|
71
|
+
isError: true,
|
|
67
72
|
},
|
|
68
73
|
malformed: true,
|
|
69
74
|
};
|
|
@@ -82,7 +87,7 @@ function coerceToolResult(raw: unknown): { result: AgentToolResult<any>; malform
|
|
|
82
87
|
content.push(block as { type: "image"; data: string; mimeType: string });
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
|
-
return { result: { content, details }, malformed: false };
|
|
90
|
+
return { result: { content, details, ...(explicitError ? { isError: true } : {}) }, malformed: false };
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
/**
|
|
@@ -827,7 +832,7 @@ async function executeToolCalls(
|
|
|
827
832
|
);
|
|
828
833
|
const coerced = coerceToolResult(rawResult);
|
|
829
834
|
result = coerced.result;
|
|
830
|
-
if (coerced.malformed) isError = true;
|
|
835
|
+
if (coerced.malformed || result.isError) isError = true;
|
|
831
836
|
} catch (e) {
|
|
832
837
|
result = {
|
|
833
838
|
content: [{ type: "text", text: e instanceof Error ? e.message : String(e) }],
|
package/src/types.ts
CHANGED
|
@@ -223,6 +223,9 @@ export interface AgentToolResult<T = any, _TInput = unknown> {
|
|
|
223
223
|
content: (TextContent | ImageContent)[];
|
|
224
224
|
// Details to be displayed in a UI or logged
|
|
225
225
|
details?: T;
|
|
226
|
+
// Marks a non-throwing failure (e.g. an aggregator catching per-entry errors).
|
|
227
|
+
// agent-loop honors this and surfaces it as a tool error on the wire.
|
|
228
|
+
isError?: boolean;
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
// Callback for streaming tool execution updates
|