@giladbarnea/pi-simple-team 1.0.4 → 1.0.5

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/package.json +1 -1
  2. package/render.ts +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giladbarnea/pi-simple-team",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A flat, live team of Pi agents.",
5
5
  "keywords": [
6
6
  "pi-package",
package/render.ts CHANGED
@@ -64,6 +64,10 @@ function wrapTeamLine(line: TeamLine, width: number): string[] {
64
64
  return parts.map((part) => `${line.prefix}${part}`.trimEnd());
65
65
  }
66
66
 
67
+ function clipToWidth(line: string, width: number): string {
68
+ return truncateToWidth(line, Math.max(1, width), glyphs().ellipsis);
69
+ }
70
+
67
71
  /** Clips each logical line to the render width (collapsed) or wraps it (expanded). */
68
72
  export class TeamLines {
69
73
  private cachedWidth?: number;
@@ -84,7 +88,7 @@ export class TeamLines {
84
88
  const targetWidth = Math.max(1, stableRenderWidth(width));
85
89
  this.cachedLines =
86
90
  this.mode === "clip"
87
- ? this.lines.map((line) => truncateToWidth(teamLineText(line), targetWidth, glyphs().ellipsis))
91
+ ? this.lines.map((line) => clipToWidth(teamLineText(line), targetWidth))
88
92
  : this.lines.flatMap((line) => wrapTeamLine(line, targetWidth));
89
93
  this.cachedWidth = width;
90
94
  return this.cachedLines;
@@ -545,17 +549,18 @@ class TeamSendView {
545
549
  }
546
550
 
547
551
  render(width: number): string[] {
552
+ const header = clipToWidth(this.headerStr, width);
548
553
  const bodyWidth = Math.max(10, width - this.barWidth);
549
554
  const bodyLines = this.md.render(bodyWidth);
550
555
  const barred = bodyLines.map((line) => `${this.barStr}${line}`);
551
- if (this.expanded) return [this.headerStr, ...barred];
556
+ if (this.expanded) return [header, ...barred];
552
557
  const shown = barred.slice(0, SEND_PREVIEW_LINES);
553
558
  const hidden = barred.length - SEND_PREVIEW_LINES;
554
559
  if (hidden > 0) {
555
560
  const g = glyphs();
556
561
  shown.push(`${this.barStr}${this.theme.fg("dim", `${g.ellipsis} ${hidden} more line${hidden === 1 ? "" : "s"}${g.dot}ctrl+o to expand`)}`);
557
562
  }
558
- return [this.headerStr, ...shown];
563
+ return [header, ...shown];
559
564
  }
560
565
  }
561
566
 
@@ -579,7 +584,7 @@ class TeamMessageView {
579
584
  render(width: number): string[] {
580
585
  const bodyWidth = Math.max(10, width - this.barWidth);
581
586
  const bodyLines = this.md.render(bodyWidth);
582
- return [this.headerLine, ...bodyLines.map((line) => `${this.barStr}${line}`)];
587
+ return [clipToWidth(this.headerLine, width), ...bodyLines.map((line) => `${this.barStr}${line}`)];
583
588
  }
584
589
  }
585
590