pi-better-background-tasks 0.2.12 → 0.2.14
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/shared-navigator.ts +23 -8
package/package.json
CHANGED
package/src/shared-navigator.ts
CHANGED
|
@@ -179,7 +179,10 @@ export function ensureBackgroundWorkNavigator(ctx: ExtensionContext, deps: HostD
|
|
|
179
179
|
if (!isNavigatorUiAvailable(ctx)) return;
|
|
180
180
|
const s = state();
|
|
181
181
|
s.uiCtx = ctx;
|
|
182
|
-
s.deps =
|
|
182
|
+
s.deps = {
|
|
183
|
+
...deps,
|
|
184
|
+
createTranscriptComponent: deps.createTranscriptComponent ?? s.deps?.createTranscriptComponent,
|
|
185
|
+
};
|
|
183
186
|
try { (ctx.ui as any).setWidget?.(MAIN_LIST_WIDGET_KEY, undefined); } catch { /* ignore */ }
|
|
184
187
|
s.mainListWidgetInstalled = false;
|
|
185
188
|
s.mainListRequestRender = undefined;
|
|
@@ -918,7 +921,7 @@ function createOverlayComponent(
|
|
|
918
921
|
width,
|
|
919
922
|
deps.truncate,
|
|
920
923
|
fg,
|
|
921
|
-
{ minRows: detailRows, bottomFooter: false, logTailRows },
|
|
924
|
+
{ minRows: detailRows, maxRows: detailRows, bottomFooter: false, logTailRows },
|
|
922
925
|
);
|
|
923
926
|
} else {
|
|
924
927
|
transcriptDetail = null;
|
|
@@ -1003,21 +1006,33 @@ function buildTranscriptDetailLines(
|
|
|
1003
1006
|
width: number,
|
|
1004
1007
|
truncate: (s: string, width: number) => string,
|
|
1005
1008
|
fg: (color: string, value: string) => string,
|
|
1006
|
-
options: { minRows?: number; bottomFooter?: boolean; logTailRows?: number } = {},
|
|
1009
|
+
options: { minRows?: number; maxRows?: number; bottomFooter?: boolean; logTailRows?: number } = {},
|
|
1007
1010
|
): string[] {
|
|
1008
1011
|
const actions = [...(detail.footerActions ?? ["x close"]), "Esc close"].join(" · ");
|
|
1009
1012
|
const tailRows = options.logTailRows ?? DEFAULT_LOG_TAIL_ROWS;
|
|
1010
|
-
|
|
1013
|
+
let shownTranscriptLines = transcriptLines.length ? transcriptLines.slice(-tailRows) : [" (no transcript yet)"];
|
|
1011
1014
|
const lines: string[] = [
|
|
1012
1015
|
fg("accent", rule(detail.title, width)),
|
|
1013
1016
|
dim(` ← main · ${actions}`, fg),
|
|
1014
1017
|
"",
|
|
1015
1018
|
` status ${fg(toneColor(detail.statusTone, detail.status), detail.status)}`,
|
|
1016
1019
|
];
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1020
|
+
const optionalMetadata = [
|
|
1021
|
+
...(detail.subtitle ? [` summary ${detail.subtitle}`] : []),
|
|
1022
|
+
...detail.metadata.map((item) => ` ${item.label.padEnd(8, " ").slice(0, 8)} ${item.value}`),
|
|
1023
|
+
];
|
|
1024
|
+
const transcriptHeader = ["", dim(section(`transcript · latest ${tailRows} rows`, width), fg)];
|
|
1025
|
+
if (detail.transcriptDiagnostic) transcriptHeader.push(` ${dim(detail.transcriptDiagnostic, fg)}`);
|
|
1026
|
+
if (options.maxRows !== undefined) {
|
|
1027
|
+
const fixedRows = lines.length + transcriptHeader.length + 1;
|
|
1028
|
+
const transcriptBudget = Math.max(1, options.maxRows - fixedRows);
|
|
1029
|
+
shownTranscriptLines = shownTranscriptLines.slice(-transcriptBudget);
|
|
1030
|
+
const metadataBudget = Math.max(0, options.maxRows - fixedRows - shownTranscriptLines.length);
|
|
1031
|
+
lines.push(...optionalMetadata.slice(0, metadataBudget));
|
|
1032
|
+
} else {
|
|
1033
|
+
lines.push(...optionalMetadata);
|
|
1034
|
+
}
|
|
1035
|
+
lines.push(...transcriptHeader);
|
|
1021
1036
|
lines.push(...shownTranscriptLines);
|
|
1022
1037
|
lines.push("");
|
|
1023
1038
|
if (options.bottomFooter === false) return lines.map((line) => safeTruncate(line, width, truncate));
|