pi-better-subagents 0.1.22 → 0.1.23

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-subagents",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Pi extension for detached, sandboxed subagent runs that keep the foreground session free.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -152,7 +152,12 @@ export function unregisterBackgroundWorkProvider(id: string): void {
152
152
  }
153
153
 
154
154
  export function isNavigatorUiAvailable(ctx: ExtensionContext | undefined): boolean {
155
- return Boolean(ctx && ctx.mode === "tui" && ctx.hasUI === true && ctx.ui);
155
+ if (!ctx) return false;
156
+ try {
157
+ return Boolean(ctx.mode === "tui" && ctx.hasUI === true && ctx.ui);
158
+ } catch {
159
+ return false;
160
+ }
156
161
  }
157
162
 
158
163
  export function navigatorFooterHint(count: number): string | null {
@@ -191,8 +196,10 @@ export function disposeBackgroundWorkNavigator(ctx?: ExtensionContext): void {
191
196
  try { s.dispose?.(); } catch { /* ignore */ }
192
197
  s.dispose = undefined;
193
198
  stopMainListWidget();
194
- const ui = (ctx ?? s.uiCtx)?.ui;
195
- if (ui && isNavigatorUiAvailable(ctx ?? s.uiCtx)) {
199
+ const activeCtx = ctx ?? s.uiCtx;
200
+ s.uiCtx = undefined;
201
+ if (activeCtx && isNavigatorUiAvailable(activeCtx)) {
202
+ const ui = activeCtx.ui;
196
203
  try { applyNavigatorFooter(ui as any, 0); } catch { /* ignore */ }
197
204
  try { applyCloseConfirmFooter(ui as any, null); } catch { /* ignore */ }
198
205
  try { (ui as any).setWidget?.(MAIN_LIST_WIDGET_KEY, undefined); } catch { /* ignore */ }
@@ -207,7 +214,6 @@ export function disposeBackgroundWorkNavigator(ctx?: ExtensionContext): void {
207
214
  s.detailOverlayRows = undefined;
208
215
  s.mainListSelectedId = undefined;
209
216
  s.mainListFocused = false;
210
- if (ctx && s.uiCtx === ctx) s.uiCtx = undefined;
211
217
  }
212
218
 
213
219
  export function refreshBackgroundWorkNavigator(ctx?: ExtensionContext): void {