@ch4acko3/dsh-turn-fold 0.4.3 → 0.5.0
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/inline-source.cjs +31 -2
- package/package.json +1 -1
package/inline-source.cjs
CHANGED
|
@@ -834,6 +834,19 @@ function __ch4acko3DshTurnFoldHasToolCallBlock(node) {
|
|
|
834
834
|
var blocks = node.data === void 0 ? void 0 : node.data.blocks;
|
|
835
835
|
return Array.isArray(blocks) && blocks.some(function (block) { return block !== void 0 && block.kind === "tool-call"; });
|
|
836
836
|
}
|
|
837
|
+
// An image tool result is a primary visual artifact, not an intermediate step, so
|
|
838
|
+
// it should stay visible when the surrounding agent activity folds. Detection is
|
|
839
|
+
// content-based (any tool-result carrying an image block) rather than tied to a
|
|
840
|
+
// particular tool name, so it keeps working for any plugin that emits images.
|
|
841
|
+
function __ch4acko3DshTurnFoldIsPromotableImageResult(node) {
|
|
842
|
+
if (node === void 0 || node.kind !== "tool-call" || node.data === void 0) return false;
|
|
843
|
+
var root = node.data.root;
|
|
844
|
+
if (root === void 0 || root.kind !== "tool-result" || !Array.isArray(root.content)) return false;
|
|
845
|
+
for (var index = 0; index < root.content.length; index++) {
|
|
846
|
+
if (root.content[index] !== void 0 && root.content[index].type === "image") return true;
|
|
847
|
+
}
|
|
848
|
+
return false;
|
|
849
|
+
}
|
|
837
850
|
function __ch4acko3DshTurnFoldIsActivityNode(node) {
|
|
838
851
|
if (node.kind === "tool-call" || node.kind === "context") return true;
|
|
839
852
|
if (node.kind !== "assistant-step" || __ch4acko3DshTurnFoldReasoningTexts(node).length === 0) return false;
|
|
@@ -872,7 +885,18 @@ function __ch4acko3DshTurnFoldRenderEntries(entries, nodeStore, renderNode, sess
|
|
|
872
885
|
activityEntries.push(next);
|
|
873
886
|
j++;
|
|
874
887
|
}
|
|
875
|
-
var
|
|
888
|
+
var foldKeyPrefix = "activity:" + String(sessionId) + ":" + String(turn) + ":";
|
|
889
|
+
var foldKey = foldKeyPrefix + String(entry.key);
|
|
890
|
+
// Preserve an open group's identity when earlier activity joins it during streaming.
|
|
891
|
+
if (!__ch4acko3DshTurnFoldOpenKeys.has(foldKey)) {
|
|
892
|
+
for (var foldKeyIndex = 1; foldKeyIndex < activityEntries.length; foldKeyIndex++) {
|
|
893
|
+
var openFoldKey = foldKeyPrefix + String(activityEntries[foldKeyIndex].key);
|
|
894
|
+
if (__ch4acko3DshTurnFoldOpenKeys.has(openFoldKey)) {
|
|
895
|
+
foldKey = openFoldKey;
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
876
900
|
// Focus inside an already-open group belongs to its native disclosure rows.
|
|
877
901
|
// Keep their parent stable when a streaming Session snapshot renders again.
|
|
878
902
|
var selected = !__ch4acko3DshTurnFoldOpenKeys.has(foldKey) && activityEntries.some(function (activityEntry) { return interactionKeys.has(activityEntry.key); });
|
|
@@ -1197,8 +1221,10 @@ function __ch4acko3DshTurnFoldRender(props) {
|
|
|
1197
1221
|
}, "ch4acko3-dsh-turn-fold-summary-" + String(sessionId) + "-" + plan.turn) });
|
|
1198
1222
|
}
|
|
1199
1223
|
if (foldable && key === plan.closingKey) {
|
|
1224
|
+
var promotedImageKeys = plan.activity.filter(function (activityKey) { return __ch4acko3DshTurnFoldIsPromotableImageResult(nodeStore.get(activityKey)); });
|
|
1225
|
+
var foldedActivityKeys = plan.activity.filter(function (activityKey) { return promotedImageKeys.indexOf(activityKey) < 0; });
|
|
1200
1226
|
entries.push({ type: "element", element: react_jsx_runtime.jsx(__ch4acko3DshTurnFoldDisclosure, {
|
|
1201
|
-
activity:
|
|
1227
|
+
activity: foldedActivityKeys,
|
|
1202
1228
|
closingReasoning: plan.closingReasoning,
|
|
1203
1229
|
completed: plan.endReason === "completed",
|
|
1204
1230
|
metrics: __ch4acko3DshTurnFoldPlanMetrics(plan, nodeStore, timeline),
|
|
@@ -1210,6 +1236,9 @@ function __ch4acko3DshTurnFoldRender(props) {
|
|
|
1210
1236
|
renderNode: renderNode,
|
|
1211
1237
|
t: props.t
|
|
1212
1238
|
}, "ch4acko3-dsh-turn-fold-" + String(sessionId) + "-" + plan.turn) });
|
|
1239
|
+
for (var promotedImageIndex = 0; promotedImageIndex < promotedImageKeys.length; promotedImageIndex++) {
|
|
1240
|
+
entries.push({ type: "element", element: renderNode(promotedImageKeys[promotedImageIndex]) });
|
|
1241
|
+
}
|
|
1213
1242
|
}
|
|
1214
1243
|
entries.push({
|
|
1215
1244
|
type: "node",
|