@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 +1 -1
- package/src/thinking-block-merger.ts +16 -5
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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
|
|
192
|
+
for (const child of contentNodes(row)) {
|
|
182
193
|
const textChild = child as TextLikeChild | undefined;
|
|
183
194
|
if (
|
|
184
195
|
typeof textChild?.text !== "string" ||
|