@ch4acko3/dsh-turn-fold 0.4.2 → 0.4.4

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 +18 -2
  2. package/package.json +1 -1
package/inline-source.cjs CHANGED
@@ -318,6 +318,7 @@ function __ch4acko3DshTurnFoldActivityGroup(props) {
318
318
  "data-ch4acko3-dsh-turn-fold-activity-open": open ? "true" : "false",
319
319
  "data-dsh-fold-owner": "@ch4acko3/dsh-turn-fold",
320
320
  "data-dsh-fold-scope": "activity-run",
321
+ "data-dsh-fold-keys": JSON.stringify(props.nodeKeys),
321
322
  "data-state": state,
322
323
  children: [
323
324
  react_jsx_runtime.jsx(_deepseek_ai_dsh_client_ui_primitives.DisclosureRow, {
@@ -871,7 +872,21 @@ function __ch4acko3DshTurnFoldRenderEntries(entries, nodeStore, renderNode, sess
871
872
  activityEntries.push(next);
872
873
  j++;
873
874
  }
874
- var selected = activityEntries.some(function (activityEntry) { return interactionKeys.has(activityEntry.key); });
875
+ var foldKeyPrefix = "activity:" + String(sessionId) + ":" + String(turn) + ":";
876
+ var foldKey = foldKeyPrefix + String(entry.key);
877
+ // Preserve an open group's identity when earlier activity joins it during streaming.
878
+ if (!__ch4acko3DshTurnFoldOpenKeys.has(foldKey)) {
879
+ for (var foldKeyIndex = 1; foldKeyIndex < activityEntries.length; foldKeyIndex++) {
880
+ var openFoldKey = foldKeyPrefix + String(activityEntries[foldKeyIndex].key);
881
+ if (__ch4acko3DshTurnFoldOpenKeys.has(openFoldKey)) {
882
+ foldKey = openFoldKey;
883
+ break;
884
+ }
885
+ }
886
+ }
887
+ // Focus inside an already-open group belongs to its native disclosure rows.
888
+ // Keep their parent stable when a streaming Session snapshot renders again.
889
+ var selected = !__ch4acko3DshTurnFoldOpenKeys.has(foldKey) && activityEntries.some(function (activityEntry) { return interactionKeys.has(activityEntry.key); });
875
890
  if (turn === null || activityEntries.length < 2 || selected) {
876
891
  for (var k = 0; k < activityEntries.length; k++) out.push(__ch4acko3DshTurnFoldRenderNativeEntry(activityEntries[k], renderNode, false));
877
892
  } else {
@@ -891,11 +906,11 @@ function __ch4acko3DshTurnFoldRenderEntries(entries, nodeStore, renderNode, sess
891
906
  }
892
907
  if (__ch4acko3DshTurnFoldHasVisibleNonReasoning(entry.node)) out.push(__ch4acko3DshTurnFoldRenderNativeEntry(entry, renderNode, true));
893
908
  var facts = __ch4acko3DshTurnFoldToolFacts(toolKeys, nodeStore);
894
- var foldKey = "activity:" + String(sessionId) + ":" + String(turn) + ":" + String(entry.key);
895
909
  out.push(react_jsx_runtime.jsx(__ch4acko3DshTurnFoldActivityGroup, {
896
910
  failed: facts.failed,
897
911
  foldKey: foldKey,
898
912
  items: items,
913
+ nodeKeys: activityEntries.map(function (activityEntry) { return activityEntry.key; }),
899
914
  renderNode: renderNode,
900
915
  running: facts.running,
901
916
  t: t
@@ -982,6 +997,7 @@ function __ch4acko3DshTurnFoldDisclosure(props) {
982
997
  "data-ch4acko3-dsh-turn-fold-open": expanded ? "true" : "false",
983
998
  "data-dsh-fold-owner": "@ch4acko3/dsh-turn-fold",
984
999
  "data-dsh-fold-scope": "turn",
1000
+ "data-dsh-fold-keys": JSON.stringify(activity),
985
1001
  children: [
986
1002
  react_jsx_runtime.jsx("button", {
987
1003
  type: "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ch4acko3/dsh-turn-fold",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
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": {