@jaggerxtrm/pi-extensions 0.7.20 → 0.7.21

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.
@@ -252,7 +252,7 @@ type PatchableToolExecutionComponent = {
252
252
  type ExternalToolFrameKind = "serena" | "gitnexus" | "structured" | "process" | "external";
253
253
 
254
254
  const PATCHED_EXTERNAL_TOOL_FRAME = "__xtrmUiExternalToolFrame";
255
- const EXTERNAL_TOOL_FRAME_PATCH_VERSION = 10;
255
+ const EXTERNAL_TOOL_FRAME_PATCH_VERSION = 11;
256
256
  const ANSI_PATTERN = /\x1b\[[0-9;?]*[ -/]*[@-~]/g;
257
257
 
258
258
  function stripAnsi(text: string): string {
@@ -326,39 +326,22 @@ function trimRenderedToolLines(lines: string[]): string[] {
326
326
  return lines.slice(start, end).map((line) => line.replace(/\s+$/u, ""));
327
327
  }
328
328
 
329
- function externalToolBgRgb(kind: ExternalToolFrameKind): [number, number, number] {
330
- const bgColors: Record<ExternalToolFrameKind, [number, number, number]> = {
331
- serena: [13, 34, 49],
332
- gitnexus: [31, 23, 55],
333
- structured: [35, 23, 55],
334
- process: [10, 42, 52],
335
- external: [27, 33, 43],
336
- };
337
- return bgColors[kind];
338
- }
339
-
340
- function externalToolBgColor(kind: ExternalToolFrameKind, text: string): string {
341
- const [r, g, b] = externalToolBgRgb(kind);
342
- return `\x1b[48;2;${r};${g};${b}m${text}\x1b[49m`;
343
- }
344
-
345
329
  function externalToolBadgeColor(kind: ExternalToolFrameKind, text: string): string {
346
330
  const bgColors: Record<ExternalToolFrameKind, [number, number, number]> = {
347
- serena: [26, 96, 132],
348
- gitnexus: [82, 58, 150],
349
- structured: [105, 61, 150],
350
- process: [17, 118, 145],
351
- external: [74, 88, 112],
331
+ serena: [82, 210, 255],
332
+ gitnexus: [178, 154, 255],
333
+ structured: [205, 166, 255],
334
+ process: [92, 226, 255],
335
+ external: [178, 190, 210],
352
336
  };
353
337
  const [badgeR, badgeG, badgeB] = bgColors[kind];
354
- const [rowR, rowG, rowB] = externalToolBgRgb(kind);
355
- return `\x1b[1m\x1b[48;2;${badgeR};${badgeG};${badgeB}m${text}\x1b[22m\x1b[48;2;${rowR};${rowG};${rowB}m`;
338
+ return `\x1b[38;2;3;8;12m\x1b[48;2;${badgeR};${badgeG};${badgeB}m${text}\x1b[39m\x1b[49m`;
356
339
  }
357
340
 
358
341
  function highlightExternalToolBadge(kind: ExternalToolFrameKind, line: string): string {
359
- const match = line.match(/^(•\s+(?:serena\s+\S+|gitnexus(?:_\S+)?|structured_return|process|\S+))/u);
360
- if (!match?.[1]) return line;
361
- return externalToolBadgeColor(kind, match[1]) + line.slice(match[1].length);
342
+ const match = line.match(/^(•\s+)(\S+)/u);
343
+ if (!match?.[1] || !match[2]) return line;
344
+ return match[1] + externalToolBadgeColor(kind, match[2]) + line.slice(match[1].length + match[2].length);
362
345
  }
363
346
 
364
347
  function externalToolBorderColor(kind: ExternalToolFrameKind, text: string): string {
@@ -388,9 +371,8 @@ function renderExternalToolBackgroundLines(
388
371
  const visibleLines = collapsedExternalToolLines(contentLines, expanded);
389
372
 
390
373
  return visibleLines.map((rawLine) => {
391
- const line = truncateToWidth(rawLine, Math.max(1, renderWidth - 2));
392
- const highlighted = highlightExternalToolBadge(kind, line);
393
- return externalToolBgColor(kind, ` ${padVisible(highlighted, Math.max(1, renderWidth - 2))} `);
374
+ const line = truncateToWidth(rawLine, Math.max(1, renderWidth));
375
+ return highlightExternalToolBadge(kind, line);
394
376
  });
395
377
  }
396
378
 
@@ -1421,7 +1403,10 @@ function registerXtrmUiTools(pi: ExtensionAPI, getPrefs: () => XtrmUiPrefs): voi
1421
1403
 
1422
1404
  pi.on("tool_result", async (event: ToolResultEvent, _ctx) => {
1423
1405
  if (event.isError) return undefined;
1424
- if (XTRM_BUILTIN_TOOLS.has(event.toolName)) return undefined;
1406
+ if (XTRM_BUILTIN_TOOLS.has(event.toolName)) {
1407
+ trackToolCallEnd(event.toolCallId);
1408
+ return undefined;
1409
+ }
1425
1410
  if (!getPrefs().compactExternalToolResults) return undefined;
1426
1411
 
1427
1412
  const text = getTextContent({ content: event.content as Array<{ type: string; text?: string }> });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaggerxtrm/pi-extensions",
3
- "version": "0.7.20",
3
+ "version": "0.7.21",
4
4
  "description": "Unified Pi extension entrypoint for xtrm-managed extensions",
5
5
  "type": "module",
6
6
  "publishConfig": {