pi-better-server 0.8.2 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-server",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Daemon that hosts Pi agent sessions behind a local Unix socket with session-addressed Pi RPC.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -693,21 +693,22 @@ function providerGroupLabel(label, fg) {
693
693
  }
694
694
  function formatMainListRow(row, selected, fg, width) {
695
695
  const prefix = (selected ? fg("accent", "› ") : " ") + (row.treeDepth === 1 ? dim(` ${row.lastChild ? "└─" : "├─"} `, fg) : "");
696
- const name = row.name || row.id;
696
+ const name = rowDisplayName(row);
697
+ const summary = singleLine(rowSummary(row));
697
698
  const indicator = statusIndicator(row);
698
699
  const status = fg(indicator.color, indicator.glyph);
699
700
  const elapsed = singleLine(row.elapsed || "-");
700
- const available = Math.max(24, width || MAIN_LIST_FALLBACK_WIDTH);
701
701
  const elapsedWidth = Math.min(Math.max(piVisibleWidth(elapsed), 4), 12);
702
702
  const statusWidth = 2;
703
703
  const leftPrefixWidth = piVisibleWidth(prefix) + statusWidth + 1;
704
- const maxNameWidth = Math.max(8, Math.floor(available * 0.36));
705
- const nameWidth = Math.max(8, Math.min(44, maxNameWidth, available - leftPrefixWidth - elapsedWidth - 10));
706
- const rightWidth = Math.max(8, available - leftPrefixWidth - nameWidth - 1);
707
- const summaryWidth = Math.max(1, rightWidth - elapsedWidth - 1);
708
- const left = `${prefix}${fit(status, statusWidth)} ${fit(name, nameWidth)}`;
709
- const right = `${dim(fitRight(rowSummary(row), summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
710
- const gap = Math.max(1, available - piVisibleWidth(left) - piVisibleWidth(right));
704
+ const textWidth = Math.max(0, width - leftPrefixWidth - elapsedWidth - 2);
705
+ // Reserve a readable title when both texts are long. Each side can use the other's spare cells.
706
+ const preferredNameWidth = Math.max(8, Math.ceil(textWidth / 3), textWidth - piVisibleWidth(summary));
707
+ const nameWidth = Math.min(piVisibleWidth(name), textWidth, preferredNameWidth);
708
+ const summaryWidth = textWidth - nameWidth;
709
+ const left = `${prefix}${fit(status, statusWidth)} ${piTruncateToWidth(name, nameWidth)}`;
710
+ const right = `${dim(fitRight(summary, summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
711
+ const gap = Math.max(1, width - piVisibleWidth(left) - piVisibleWidth(right));
711
712
  return `${left}${" ".repeat(gap)}${right}`;
712
713
  }
713
714
  function statusGlyph(row) {
@@ -778,21 +778,22 @@ function providerGroupLabel(label: string, fg: (color: string, value: string) =>
778
778
 
779
779
  function formatMainListRow(row: InternalRow, selected: boolean, fg: (color: string, value: string) => string, width: number): string {
780
780
  const prefix = (selected ? fg("accent", "› ") : " ") + (row.treeDepth === 1 ? dim(` ${row.lastChild ? "└─" : "├─"} `, fg) : "");
781
- const name = row.name || row.id;
781
+ const name = rowDisplayName(row);
782
+ const summary = singleLine(rowSummary(row));
782
783
  const indicator = statusIndicator(row);
783
784
  const status = fg(indicator.color, indicator.glyph);
784
785
  const elapsed = singleLine(row.elapsed || "-");
785
- const available = Math.max(24, width || MAIN_LIST_FALLBACK_WIDTH);
786
786
  const elapsedWidth = Math.min(Math.max(piVisibleWidth(elapsed), 4), 12);
787
787
  const statusWidth = 2;
788
788
  const leftPrefixWidth = piVisibleWidth(prefix) + statusWidth + 1;
789
- const maxNameWidth = Math.max(8, Math.floor(available * 0.36));
790
- const nameWidth = Math.max(8, Math.min(44, maxNameWidth, available - leftPrefixWidth - elapsedWidth - 10));
791
- const rightWidth = Math.max(8, available - leftPrefixWidth - nameWidth - 1);
792
- const summaryWidth = Math.max(1, rightWidth - elapsedWidth - 1);
793
- const left = `${prefix}${fit(status, statusWidth)} ${fit(name, nameWidth)}`;
794
- const right = `${dim(fitRight(rowSummary(row), summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
795
- const gap = Math.max(1, available - piVisibleWidth(left) - piVisibleWidth(right));
789
+ const textWidth = Math.max(0, width - leftPrefixWidth - elapsedWidth - 2);
790
+ // Reserve a readable title when both texts are long. Each side can use the other's spare cells.
791
+ const preferredNameWidth = Math.max(8, Math.ceil(textWidth / 3), textWidth - piVisibleWidth(summary));
792
+ const nameWidth = Math.min(piVisibleWidth(name), textWidth, preferredNameWidth);
793
+ const summaryWidth = textWidth - nameWidth;
794
+ const left = `${prefix}${fit(status, statusWidth)} ${piTruncateToWidth(name, nameWidth)}`;
795
+ const right = `${dim(fitRight(summary, summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
796
+ const gap = Math.max(1, width - piVisibleWidth(left) - piVisibleWidth(right));
796
797
  return `${left}${" ".repeat(gap)}${right}`;
797
798
  }
798
799
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-subagents",
3
- "version": "0.39.2",
3
+ "version": "0.39.3",
4
4
  "description": "Pi extension for detached, sandboxed subagent runs that keep the foreground session free.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -693,21 +693,22 @@ function providerGroupLabel(label, fg) {
693
693
  }
694
694
  function formatMainListRow(row, selected, fg, width) {
695
695
  const prefix = (selected ? fg("accent", "› ") : " ") + (row.treeDepth === 1 ? dim(` ${row.lastChild ? "└─" : "├─"} `, fg) : "");
696
- const name = row.name || row.id;
696
+ const name = rowDisplayName(row);
697
+ const summary = singleLine(rowSummary(row));
697
698
  const indicator = statusIndicator(row);
698
699
  const status = fg(indicator.color, indicator.glyph);
699
700
  const elapsed = singleLine(row.elapsed || "-");
700
- const available = Math.max(24, width || MAIN_LIST_FALLBACK_WIDTH);
701
701
  const elapsedWidth = Math.min(Math.max(piVisibleWidth(elapsed), 4), 12);
702
702
  const statusWidth = 2;
703
703
  const leftPrefixWidth = piVisibleWidth(prefix) + statusWidth + 1;
704
- const maxNameWidth = Math.max(8, Math.floor(available * 0.36));
705
- const nameWidth = Math.max(8, Math.min(44, maxNameWidth, available - leftPrefixWidth - elapsedWidth - 10));
706
- const rightWidth = Math.max(8, available - leftPrefixWidth - nameWidth - 1);
707
- const summaryWidth = Math.max(1, rightWidth - elapsedWidth - 1);
708
- const left = `${prefix}${fit(status, statusWidth)} ${fit(name, nameWidth)}`;
709
- const right = `${dim(fitRight(rowSummary(row), summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
710
- const gap = Math.max(1, available - piVisibleWidth(left) - piVisibleWidth(right));
704
+ const textWidth = Math.max(0, width - leftPrefixWidth - elapsedWidth - 2);
705
+ // Reserve a readable title when both texts are long. Each side can use the other's spare cells.
706
+ const preferredNameWidth = Math.max(8, Math.ceil(textWidth / 3), textWidth - piVisibleWidth(summary));
707
+ const nameWidth = Math.min(piVisibleWidth(name), textWidth, preferredNameWidth);
708
+ const summaryWidth = textWidth - nameWidth;
709
+ const left = `${prefix}${fit(status, statusWidth)} ${piTruncateToWidth(name, nameWidth)}`;
710
+ const right = `${dim(fitRight(summary, summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
711
+ const gap = Math.max(1, width - piVisibleWidth(left) - piVisibleWidth(right));
711
712
  return `${left}${" ".repeat(gap)}${right}`;
712
713
  }
713
714
  function statusGlyph(row) {
@@ -778,21 +778,22 @@ function providerGroupLabel(label: string, fg: (color: string, value: string) =>
778
778
 
779
779
  function formatMainListRow(row: InternalRow, selected: boolean, fg: (color: string, value: string) => string, width: number): string {
780
780
  const prefix = (selected ? fg("accent", "› ") : " ") + (row.treeDepth === 1 ? dim(` ${row.lastChild ? "└─" : "├─"} `, fg) : "");
781
- const name = row.name || row.id;
781
+ const name = rowDisplayName(row);
782
+ const summary = singleLine(rowSummary(row));
782
783
  const indicator = statusIndicator(row);
783
784
  const status = fg(indicator.color, indicator.glyph);
784
785
  const elapsed = singleLine(row.elapsed || "-");
785
- const available = Math.max(24, width || MAIN_LIST_FALLBACK_WIDTH);
786
786
  const elapsedWidth = Math.min(Math.max(piVisibleWidth(elapsed), 4), 12);
787
787
  const statusWidth = 2;
788
788
  const leftPrefixWidth = piVisibleWidth(prefix) + statusWidth + 1;
789
- const maxNameWidth = Math.max(8, Math.floor(available * 0.36));
790
- const nameWidth = Math.max(8, Math.min(44, maxNameWidth, available - leftPrefixWidth - elapsedWidth - 10));
791
- const rightWidth = Math.max(8, available - leftPrefixWidth - nameWidth - 1);
792
- const summaryWidth = Math.max(1, rightWidth - elapsedWidth - 1);
793
- const left = `${prefix}${fit(status, statusWidth)} ${fit(name, nameWidth)}`;
794
- const right = `${dim(fitRight(rowSummary(row), summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
795
- const gap = Math.max(1, available - piVisibleWidth(left) - piVisibleWidth(right));
789
+ const textWidth = Math.max(0, width - leftPrefixWidth - elapsedWidth - 2);
790
+ // Reserve a readable title when both texts are long. Each side can use the other's spare cells.
791
+ const preferredNameWidth = Math.max(8, Math.ceil(textWidth / 3), textWidth - piVisibleWidth(summary));
792
+ const nameWidth = Math.min(piVisibleWidth(name), textWidth, preferredNameWidth);
793
+ const summaryWidth = textWidth - nameWidth;
794
+ const left = `${prefix}${fit(status, statusWidth)} ${piTruncateToWidth(name, nameWidth)}`;
795
+ const right = `${dim(fitRight(summary, summaryWidth), fg)} ${fitRight(elapsed, elapsedWidth)}`;
796
+ const gap = Math.max(1, width - piVisibleWidth(left) - piVisibleWidth(right));
796
797
  return `${left}${" ".repeat(gap)}${right}`;
797
798
  }
798
799
 
package/src/version.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Kept equal to package.json `version`; a test pins that. */
2
- export const SERVER_VERSION = "0.8.2";
2
+ export const SERVER_VERSION = "0.8.3";
3
3
 
4
4
  export const SERVER_EXTENSION_VERSIONS: Readonly<Record<string, string>> = { "pi-better-server": SERVER_VERSION };