pi-better-background-tasks 0.2.20 → 0.4.0

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.
@@ -106,7 +106,7 @@ export const CLOSE_CONFIRM_STATUS_KEY = "background-work-close";
106
106
  export const MAIN_LIST_WIDGET_KEY = "background-work-list";
107
107
  export const DETAIL_TICK_MS = 10_000;
108
108
  export const CLOSE_ARM_MS = 3000;
109
- export const DEFAULT_LOG_TAIL_ROWS = 10;
109
+ export const DEFAULT_LOG_TAIL_ROWS = 25;
110
110
  export const LOG_TAIL_ROW_CHOICES = [10, 25] as const;
111
111
  const MAIN_LIST_FALLBACK_WIDTH = 100;
112
112
  const DETAIL_OVERLAY_BOTTOM_MARGIN_ROWS = 0;
@@ -542,7 +542,10 @@ function stableFacts(facts: string[] | undefined): string[] {
542
542
 
543
543
  function rowSummary(row: InternalRow): string {
544
544
  if (row.providerId === "subagents") {
545
+ const attention = row.facts?.map(singleLine).filter(Boolean);
546
+ if (attention?.length) return `${singleLine(row.status)} · ${attention.join(" · ")}`;
545
547
  const parts: string[] = [];
548
+ if (row.statusTone !== "running" && row.kind !== "main agent") parts.push(singleLine(row.status));
546
549
  if (row.model) parts.push(row.effort ? `${singleLine(row.model)} ${singleLine(row.effort)}` : singleLine(row.model));
547
550
  if (row.tool) parts.push(`tool ${singleLine(row.tool)}`);
548
551
  if (row.tokens) parts.push(singleLine(row.tokens));
@@ -928,7 +931,7 @@ function createOverlayComponent(
928
931
  transcriptDetail = null;
929
932
  transcriptComponent = null;
930
933
  contentLines = mode === "detail"
931
- ? buildDetailLines(detail, width, deps.truncate, fg, { expandedSections, logTailRows, minRows: detailRows, bottomFooter: false })
934
+ ? buildDetailLines(detail, width, deps.truncate, fg, { expandedSections, logTailRows, minRows: detailRows, maxRows: detailRows, bottomFooter: false })
932
935
  : buildListLines(overlayState, width, deps.truncate, fg);
933
936
  }
934
937
  if (mode !== "detail") return contentLines;
@@ -1024,14 +1027,11 @@ function buildTranscriptDetailLines(
1024
1027
  ];
1025
1028
  const transcriptHeader = ["", dim(section(`transcript · latest ${tailRows} rows`, width), fg)];
1026
1029
  if (detail.transcriptDiagnostic) transcriptHeader.push(` ${dim(detail.transcriptDiagnostic, fg)}`);
1030
+ // Metadata always renders; the transcript tail takes only the rows left over (the tail size is a cap, not a guarantee).
1031
+ lines.push(...optionalMetadata);
1027
1032
  if (options.maxRows !== undefined) {
1028
- const fixedRows = lines.length + transcriptHeader.length + 1;
1029
- const transcriptBudget = Math.max(1, options.maxRows - fixedRows);
1033
+ const transcriptBudget = Math.max(1, options.maxRows - lines.length - transcriptHeader.length - 1);
1030
1034
  shownTranscriptLines = shownTranscriptLines.slice(-transcriptBudget);
1031
- const metadataBudget = Math.max(0, options.maxRows - fixedRows - shownTranscriptLines.length);
1032
- lines.push(...optionalMetadata.slice(0, metadataBudget));
1033
- } else {
1034
- lines.push(...optionalMetadata);
1035
1035
  }
1036
1036
  lines.push(...transcriptHeader);
1037
1037
  lines.push(...shownTranscriptLines);
@@ -1120,7 +1120,7 @@ function buildDetailLines(
1120
1120
  width: number,
1121
1121
  truncate: (s: string, width: number) => string,
1122
1122
  fg: (color: string, value: string) => string,
1123
- options: { expandedSections?: Set<string>; logTailRows?: number; minRows?: number; bottomFooter?: boolean } = {},
1123
+ options: { expandedSections?: Set<string>; logTailRows?: number; minRows?: number; maxRows?: number; bottomFooter?: boolean } = {},
1124
1124
  ): string[] {
1125
1125
  if (!detail) {
1126
1126
  const lines = [rule("Work unavailable", width), dim(" ← back · Esc close", fg), ""];
@@ -1184,7 +1184,9 @@ function buildDetailLines(
1184
1184
  const wrapped = /log/i.test(detail.evidence.label)
1185
1185
  ? wrapLogText(body, width - 6)
1186
1186
  : wrapEvidenceText(body, width - 6);
1187
- const shown = tailEvidence ? wrapped.slice(-tailRows) : wrapped;
1187
+ let shown = tailEvidence ? wrapped.slice(-tailRows) : wrapped;
1188
+ // Metadata above always renders; a tail that outgrows the remaining rows drops its oldest rows so the newest stay on screen (+1 for the trailing blank).
1189
+ if (tailEvidence && options.maxRows !== undefined) shown = shown.slice(-Math.max(1, options.maxRows - lines.length - 1));
1188
1190
  for (const raw of shown) lines.push(raw ? ` ${raw}` : " ");
1189
1191
  }
1190
1192
  lines.push("");