pi-open-agents 0.1.12 → 0.1.13
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 +1 -1
- package/src/subagent/executor.ts +10 -4
package/package.json
CHANGED
package/src/subagent/executor.ts
CHANGED
|
@@ -556,10 +556,16 @@ export async function runSubagent(options: RunSubagentOptions): Promise<AgentRes
|
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
if (event.type === "message_end" && event.message) {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
// pi 0.83.0+ emits message_end for EVERY role (user, assistant, toolResult),
|
|
560
|
+
// not just assistant. Only capture text/usage/model from assistant messages —
|
|
561
|
+
// otherwise the echoed user task ("Task: ...") and raw tool results leak into
|
|
562
|
+
// the subagent output when the final assistant turn has no text part.
|
|
563
|
+
if ((event.message as { role?: unknown }).role === "assistant") {
|
|
564
|
+
const text = textFromMessage(event.message);
|
|
565
|
+
if (text !== undefined) output = text;
|
|
566
|
+
updateUsage(usage, usageFromMessage(event.message, modelRegistry));
|
|
567
|
+
model = modelFromMessage(event.message) ?? model;
|
|
568
|
+
}
|
|
563
569
|
emit();
|
|
564
570
|
return;
|
|
565
571
|
}
|