pi-better-background-tasks 0.12.1 → 0.12.2

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-background-tasks",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Pi extension for durable background shell tasks, watchers, logs, and status inspection.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -175,18 +175,15 @@ export function isNavigatorUiAvailable(ctx: ExtensionContext | undefined): boole
175
175
  }
176
176
 
177
177
  export function navigatorFooterHint(_count: number): string | null {
178
- // Retain the compatibility helper so refresh/reload clears any old badge.
178
+ // Retain the compatibility helper without publishing a badge.
179
179
  return null;
180
180
  }
181
181
 
182
182
  export function applyNavigatorFooter(ui: { setStatus(key: string, value: string | undefined): void }, count: number): string | null {
183
- const hint = navigatorFooterHint(count);
184
- ui.setStatus(NAVIGATOR_STATUS_KEY, hint ?? undefined);
185
- return hint;
183
+ return navigatorFooterHint(count);
186
184
  }
187
185
 
188
186
  export function applyCloseConfirmFooter(ui: { setStatus(key: string, value: string | undefined): void }, hint: string | null | undefined): string | null {
189
- ui.setStatus(CLOSE_CONFIRM_STATUS_KEY, hint ?? undefined);
190
187
  return hint ?? null;
191
188
  }
192
189
 
@@ -219,8 +216,6 @@ export function disposeBackgroundWorkNavigator(ctx?: ExtensionContext): void {
219
216
  s.uiCtx = undefined;
220
217
  if (activeCtx && isNavigatorUiAvailable(activeCtx)) {
221
218
  const ui = activeCtx.ui;
222
- try { applyNavigatorFooter(ui as any, 0); } catch { /* ignore */ }
223
- try { applyCloseConfirmFooter(ui as any, null); } catch { /* ignore */ }
224
219
  try { (ui as any).setWidget?.(MAIN_LIST_WIDGET_KEY, undefined); } catch { /* ignore */ }
225
220
  }
226
221
  s.lastHint = undefined;
@@ -241,12 +236,6 @@ export function refreshBackgroundWorkNavigator(ctx?: ExtensionContext): void {
241
236
  const activeCtx = isNavigatorUiAvailable(ctx) ? ctx : s.uiCtx;
242
237
  if (!isNavigatorUiAvailable(activeCtx)) return;
243
238
  try {
244
- const count = visibleCount();
245
- const hint = navigatorFooterHint(count);
246
- if (hint !== s.lastHint) {
247
- applyNavigatorFooter(activeCtx!.ui as any, count);
248
- s.lastHint = hint;
249
- }
250
239
  refreshMainListWidget();
251
240
  } catch { /* ignore */ }
252
241
  }
@@ -271,7 +260,6 @@ function clearMainListCloseArm(): void {
271
260
  s.mainListCloseArmTimer = undefined;
272
261
  if (!s.mainListCloseArm) return;
273
262
  s.mainListCloseArm = undefined;
274
- try { applyCloseConfirmFooter((s.uiCtx as any).ui, null); } catch { /* ignore */ }
275
263
  }
276
264
 
277
265
  function refreshMainListWidget(): void {
@@ -293,6 +281,7 @@ function refreshMainListWidget(): void {
293
281
  const nextSignature = rows.length ? mainListSignature(rows, {
294
282
  selectedId: s.mainListFocused ? s.mainListSelectedId : undefined,
295
283
  focused: s.mainListFocused === true,
284
+ closeHint: closeHintFor(rows.find((row) => row.navigatorId === s.mainListCloseArm?.id)),
296
285
  }) : undefined;
297
286
  const changed = nextSignature !== s.lastMainListSignature;
298
287
  s.lastMainListSignature = nextSignature;
@@ -416,6 +405,9 @@ function createMainListWidget(tui: { requestRender?(): void }, theme: unknown, d
416
405
  selectedId: state().mainListFocused ? state().mainListSelectedId : undefined,
417
406
  focused: state().mainListFocused === true,
418
407
  });
408
+ const armedRow = rows.find((row) => row.navigatorId === state().mainListCloseArm?.id);
409
+ const hint = closeHintFor(armedRow);
410
+ if (hint) { layout.lines.push(deps.truncate(` ${hint}`, renderWidth(width))); layout.owners.push(undefined); }
419
411
  lineWidth = renderWidth(width);
420
412
  // The leading gap line belongs to the widget too, so its slot stays ownerless.
421
413
  lineOwners = [undefined, ...layout.owners];
@@ -630,9 +622,10 @@ function statusIndicator(row: InternalRow, now = Date.now()): { glyph: string; c
630
622
  return { glyph: RUNNING_DOT_GLYPH, color: "accent" };
631
623
  }
632
624
 
633
- function mainListSignature(rows: InternalRow[], options: { selectedId?: string; focused?: boolean } = {}): string {
625
+ function mainListSignature(rows: InternalRow[], options: { selectedId?: string; focused?: boolean; closeHint?: string | null } = {}): string {
634
626
  return JSON.stringify({
635
627
  focused: options.focused === true,
628
+ closeHint: options.closeHint ?? null,
636
629
  selectedId: options.focused === true ? options.selectedId ?? null : null,
637
630
  rows: rows.map((row) => ({
638
631
  navigatorId: row.navigatorId,
@@ -863,7 +856,6 @@ function handleMainListCloseKey(): void {
863
856
  }
864
857
  clearMainListCloseArm();
865
858
  s.mainListCloseArm = { id: row.navigatorId, armedAt: now };
866
- try { applyCloseConfirmFooter((s.uiCtx as any).ui, closeHintFor(row)); } catch { /* ignore */ }
867
859
  s.mainListCloseArmTimer = setTimeout(() => {
868
860
  clearMainListCloseArm();
869
861
  refreshMainListWidget();
@@ -1034,7 +1026,6 @@ function createOverlayComponent(
1034
1026
  closeArmTimer = undefined;
1035
1027
  if (closeArm) {
1036
1028
  closeArm = undefined;
1037
- try { applyCloseConfirmFooter((state().uiCtx as any).ui, null); } catch { /* ignore */ }
1038
1029
  }
1039
1030
  }
1040
1031
 
@@ -1108,11 +1099,9 @@ function createOverlayComponent(
1108
1099
  }
1109
1100
  clearCloseArm();
1110
1101
  closeArm = { id: row.navigatorId, armedAt: now };
1111
- try { applyCloseConfirmFooter((state().uiCtx as any).ui, closeHintFor(row)); } catch { /* ignore */ }
1112
1102
  closeArmTimer = setTimeout(() => {
1113
1103
  closeArmTimer = undefined;
1114
1104
  closeArm = undefined;
1115
- try { applyCloseConfirmFooter((state().uiCtx as any).ui, null); } catch { /* ignore */ }
1116
1105
  requestRender();
1117
1106
  }, CLOSE_ARM_MS);
1118
1107
  closeArmTimer.unref?.();
@@ -1149,6 +1138,9 @@ function createOverlayComponent(
1149
1138
  selectedId: selectedRow()?.navigatorId,
1150
1139
  focused: true,
1151
1140
  });
1141
+ const armedRow = overlayState.rows.find((row) => row.navigatorId === closeArm?.id);
1142
+ const hint = closeHintFor(armedRow);
1143
+ if (hint) { rail.lines.push(deps.truncate(` ${hint}`, renderWidth(width))); rail.owners.push(undefined); }
1152
1144
  const railLines = rail.lines;
1153
1145
  const editorLines = renderEditorLines(width);
1154
1146
  const bottomLines = [...railLines, ...editorLines];