@hienlh/ppm 0.9.13 → 0.9.14
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
|
@@ -1355,9 +1355,10 @@ function parseSessionMessage(msg: { uuid: string; type: string; message: unknown
|
|
|
1355
1355
|
if (message && Array.isArray(message.content)) {
|
|
1356
1356
|
for (const block of message.content as Array<Record<string, unknown>>) {
|
|
1357
1357
|
if (block.type === "text" && typeof block.text === "string") {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1358
|
+
const cleaned = role === "assistant" ? stripTeammateXml(block.text) : block.text;
|
|
1359
|
+
textContent += cleaned;
|
|
1360
|
+
if (role === "assistant" && cleaned) {
|
|
1361
|
+
events.push({ type: "text", content: cleaned, ...(parentId && { parentToolUseId: parentId }) });
|
|
1361
1362
|
}
|
|
1362
1363
|
} else if (block.type === "tool_use") {
|
|
1363
1364
|
events.push({
|
|
@@ -1445,3 +1446,10 @@ function extractText(message: unknown): string {
|
|
|
1445
1446
|
}
|
|
1446
1447
|
return "";
|
|
1447
1448
|
}
|
|
1449
|
+
|
|
1450
|
+
/** Strip SDK teammate-message XML tags from assistant text */
|
|
1451
|
+
const TEAMMATE_MSG_RE = /<teammate-message[^>]*>[\s\S]*?<\/teammate-message>/g;
|
|
1452
|
+
function stripTeammateXml(text: string): string {
|
|
1453
|
+
if (!text.includes("<teammate-message")) return text;
|
|
1454
|
+
return text.replace(TEAMMATE_MSG_RE, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1455
|
+
}
|