@ch4acko3/dsh-turn-fold 0.4.4 → 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.
Files changed (2) hide show
  1. package/inline-source.cjs +19 -1
  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;
@@ -1208,8 +1221,10 @@ function __ch4acko3DshTurnFoldRender(props) {
1208
1221
  }, "ch4acko3-dsh-turn-fold-summary-" + String(sessionId) + "-" + plan.turn) });
1209
1222
  }
1210
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; });
1211
1226
  entries.push({ type: "element", element: react_jsx_runtime.jsx(__ch4acko3DshTurnFoldDisclosure, {
1212
- activity: plan.activity,
1227
+ activity: foldedActivityKeys,
1213
1228
  closingReasoning: plan.closingReasoning,
1214
1229
  completed: plan.endReason === "completed",
1215
1230
  metrics: __ch4acko3DshTurnFoldPlanMetrics(plan, nodeStore, timeline),
@@ -1221,6 +1236,9 @@ function __ch4acko3DshTurnFoldRender(props) {
1221
1236
  renderNode: renderNode,
1222
1237
  t: props.t
1223
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
+ }
1224
1242
  }
1225
1243
  entries.push({
1226
1244
  type: "node",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ch4acko3/dsh-turn-fold",
3
- "version": "0.4.4",
3
+ "version": "0.5.0",
4
4
  "description": "Codex-style turn folding for the DSH WebUI conversation, implemented as a dsh-harmony provider.",
5
5
  "main": "./index.cjs",
6
6
  "engines": {