@pi-kaush/pi-tool-call-markers 0.3.8 → 0.3.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-kaush/pi-tool-call-markers",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Compact and group Pi tool calls, with a bundled extension for adjacent thinking blocks.",
5
5
  "license": "MIT",
6
6
  "author": "Kaushik Gopal",
@@ -148,10 +148,23 @@ type MarkdownLikeChild = {
148
148
  // the italic default style is what identifies the trace: Pi passes it for
149
149
  // thinking content and for nothing else. Callers gate on the row actually
150
150
  // carrying thinking, so no other italic block is touched.
151
- function unitalicizeSettledThinking(row: AssistantMessageRow): void {
151
+ // Pi 1.0 wraps each thinking child in a MouseRegion (click toggles
152
+ // visibility); older versions hang the Markdown/Text directly. Walk both
153
+ // shapes so the restyle reaches the node either way.
154
+ function contentNodes(row: AssistantMessageRow): unknown[] {
152
155
  const children = row.contentContainer?.children;
153
- if (!Array.isArray(children)) return;
156
+ if (!Array.isArray(children)) return [];
157
+ const nodes: unknown[] = [];
154
158
  for (const child of children) {
159
+ nodes.push(child);
160
+ const inner = (child as { child?: unknown } | undefined)?.child;
161
+ if (inner !== undefined && inner !== null) nodes.push(inner);
162
+ }
163
+ return nodes;
164
+ }
165
+
166
+ function unitalicizeSettledThinking(row: AssistantMessageRow): void {
167
+ for (const child of contentNodes(row)) {
155
168
  const markdown = child as MarkdownLikeChild | undefined;
156
169
  const style = markdown?.defaultTextStyle;
157
170
  if (style?.italic !== true) continue;
@@ -174,11 +187,9 @@ function restyleHiddenThinkingLabel(row: AssistantMessageRow): void {
174
187
  return;
175
188
  }
176
189
  const label = row.hiddenThinkingLabel;
177
- const children = row.contentContainer?.children;
178
- if (!Array.isArray(children)) return;
179
190
  if (!stylesThinkingLabels()) return;
180
191
  const styled = visibleThoughtLabel(label);
181
- for (const child of children) {
192
+ for (const child of contentNodes(row)) {
182
193
  const textChild = child as TextLikeChild | undefined;
183
194
  if (
184
195
  typeof textChild?.text !== "string" ||