@bivy/bivy 0.16.23-staging.2 → 0.16.23
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.
|
@@ -22,6 +22,7 @@ function readContent(content) {
|
|
|
22
22
|
const tools = [];
|
|
23
23
|
let sawText = false;
|
|
24
24
|
let sawToolResult = false;
|
|
25
|
+
let images = 0;
|
|
25
26
|
for (const raw of content) {
|
|
26
27
|
const type = raw?.type;
|
|
27
28
|
if (type === "text" && typeof raw.text === "string") {
|
|
@@ -35,8 +36,21 @@ function readContent(content) {
|
|
|
35
36
|
sawToolResult = true;
|
|
36
37
|
tools.push({ name: undefined, summary: `→ ${compactValue(raw.content)}` });
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
else if (type === "image") {
|
|
40
|
+
// Image bytes don't round-trip across runtimes (each has its own store
|
|
41
|
+
// and content schema), but the turn itself must never silently vanish —
|
|
42
|
+
// an image-only user turn would otherwise be dropped whole. Record a
|
|
43
|
+
// textual placeholder so the turn survives the fork and the new agent is
|
|
44
|
+
// told an image was in the conversation, pointing at the full transcript
|
|
45
|
+
// for the actual bytes (same treatment as compacted tool payloads).
|
|
46
|
+
images += 1;
|
|
47
|
+
}
|
|
48
|
+
// "thinking" and other unknown block types are intentionally dropped:
|
|
49
|
+
// internal reasoning is neither portable across runtimes nor needed for
|
|
50
|
+
// continuity.
|
|
51
|
+
}
|
|
52
|
+
if (images > 0) {
|
|
53
|
+
texts.push(`[${images} image attachment${images === 1 ? "" : "s"} omitted — see the full transcript]`);
|
|
40
54
|
}
|
|
41
55
|
return { text: texts.join("\n").trim(), tools, toolResultOnly: sawToolResult && !sawText };
|
|
42
56
|
}
|