@huaqiu/dsh-tool-symbol-footprint 0.3.2 → 0.3.3

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/lib/client.js CHANGED
@@ -76,6 +76,39 @@ window.__ModuleLoader__.load({
76
76
  return dark ? "var(--dsw-alias-bg-layer-1, #20242c)" : "var(--dsw-alias-bg-layer-1, #ffffff)";
77
77
  }
78
78
  //#endregion
79
+ //#region ../dsh-tool-uncollapse/lib/index.mjs
80
+ function keepToolCardVisible(cardRootSelector, options) {
81
+ if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => {};
82
+ const skipSelector = options?.skipWhenContains;
83
+ const root = document.documentElement;
84
+ const revealSeat = (seat) => {
85
+ if (!seat.querySelector(cardRootSelector)) return;
86
+ if (skipSelector && seat.querySelector(skipSelector)) return;
87
+ seat.removeAttribute("hidden");
88
+ };
89
+ let scheduled = false;
90
+ const sweep = () => {
91
+ scheduled = false;
92
+ for (const seat of root.querySelectorAll("[data-turn-process-hidden]")) revealSeat(seat);
93
+ };
94
+ const observer = new MutationObserver(() => {
95
+ if (scheduled) return;
96
+ scheduled = true;
97
+ requestAnimationFrame(sweep);
98
+ });
99
+ observer.observe(root, {
100
+ subtree: true,
101
+ childList: true,
102
+ attributes: true,
103
+ attributeFilter: ["hidden", "data-turn-process-hidden"]
104
+ });
105
+ sweep();
106
+ return () => {
107
+ observer.disconnect();
108
+ scheduled = false;
109
+ };
110
+ }
111
+ //#endregion
79
112
  //#region src/client/theme.ts
80
113
  /**
81
114
  * Host UI environment (theme + locale) store + the scoped card stylesheet.
@@ -96,6 +129,13 @@ window.__ModuleLoader__.load({
96
129
  *
97
130
  * Stylesheet: uniquely-prefixed classes only, token colors, no !important,
98
131
  * no DSH-internal selectors. The style tag is removed on dispose.
132
+ *
133
+ * Compact-transcript un-collapse: DSH's `ui-chat` hides a `tool-call` node's
134
+ * wrapper with `hidden="until-found"` once the turn closes. We cannot opt out
135
+ * from inside the card and must not patch DSH, so `installGenHitUncollapser()`
136
+ * delegates to `@huaqiu/dsh-tool-uncollapse`, which undoes it from this
137
+ * plugin's client half (scoped to our `.hq-genhit` cards; no DSH source
138
+ * touched). See that package for the full mechanism.
99
139
  */
100
140
  const PLUGIN_ID = "@huaqiu/dsh-tool-symbol-footprint";
101
141
  const STYLE_ID = "hq-genhit-styles";
@@ -276,6 +316,17 @@ window.__ModuleLoader__.load({
276
316
  const style = document.getElementById(STYLE_ID);
277
317
  if (style && style.parentNode) style.parentNode.removeChild(style);
278
318
  }
319
+ /**
320
+ * Keep our GenHit preview visible in DSH's compact transcript.
321
+ *
322
+ * Delegates to `@huaqiu/dsh-tool-uncollapse` (shared across the
323
+ * `@huaqiu/dsh-tool-*` plugins) — see that package for the mechanism and
324
+ * trade-offs. Scoped to our `.hq-genhit` cards; other tools keep collapsing.
325
+ * Returns a disposer.
326
+ */
327
+ function installGenHitUncollapser() {
328
+ return keepToolCardVisible(".hq-genhit", { skipWhenContains: ".hq-genhit__login" });
329
+ }
279
330
  //#endregion
280
331
  //#region src/client/i18n.ts
281
332
  /**
@@ -201722,11 +201773,13 @@ ${indent})`;
201722
201773
  }, GenHitView)));
201723
201774
  }
201724
201775
  injectStyles();
201776
+ const uncollapseDispose = installGenHitUncollapser();
201725
201777
  const cleanup = () => {
201726
201778
  for (const dispose of disposers) try {
201727
201779
  dispose();
201728
201780
  } catch {}
201729
201781
  disposers.length = 0;
201782
+ uncollapseDispose();
201730
201783
  removeStyles();
201731
201784
  disposeThemeObserver();
201732
201785
  };