pi-observational-memory 2.4.0 → 2.4.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 +1 -1
- package/src/serialize.ts +3 -1
package/package.json
CHANGED
package/src/serialize.ts
CHANGED
|
@@ -58,8 +58,10 @@ function textAndPlaceholders(
|
|
|
58
58
|
return parts.join("\n");
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function textOnly(content:
|
|
61
|
+
function textOnly(content: unknown): string {
|
|
62
|
+
if (content == null) return "";
|
|
62
63
|
if (typeof content === "string") return content;
|
|
64
|
+
if (!Array.isArray(content)) return "";
|
|
63
65
|
return content
|
|
64
66
|
.filter((b): b is TextContent => b?.type === "text" && typeof b.text === "string")
|
|
65
67
|
.map((b) => b.text)
|