pi-powerline-footer 0.2.8 → 0.2.10
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/CHANGELOG.md +15 -0
- package/index.ts +50 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.10] - 2026-01-17
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Welcome overlay now properly dismisses for `p "command"` case by:
|
|
7
|
+
- Adding `tool_call` event listener (fires before stream_start)
|
|
8
|
+
- Checking `isStreaming` flag when overlay is about to show
|
|
9
|
+
- Checking session for existing activity (assistant messages, tool calls)
|
|
10
|
+
- Refactored dismissal logic into `dismissWelcome()` helper
|
|
11
|
+
|
|
12
|
+
## [0.2.9] - 2026-01-17
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Welcome overlay/header now dismisses when agent starts streaming (fixes `p "command"` case where welcome would briefly flash)
|
|
16
|
+
- Race condition where dismissal request could be lost due to 100ms setup delay in overlay
|
|
17
|
+
|
|
3
18
|
## [0.2.8] - 2026-01-16
|
|
4
19
|
|
|
5
20
|
### Changed
|
package/index.ts
CHANGED
|
@@ -89,6 +89,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
89
89
|
let tuiRef: any = null; // Store TUI reference for forcing re-renders
|
|
90
90
|
let dismissWelcomeOverlay: (() => void) | null = null; // Callback to dismiss welcome overlay
|
|
91
91
|
let welcomeHeaderActive = false; // Track if welcome header should be cleared on first input
|
|
92
|
+
let welcomeOverlayShouldDismiss = false; // Track early dismissal request (before overlay setup completes)
|
|
92
93
|
|
|
93
94
|
// Track session start
|
|
94
95
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -154,24 +155,39 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
154
155
|
});
|
|
155
156
|
|
|
156
157
|
// Track streaming state (footer only shows status during streaming)
|
|
157
|
-
|
|
158
|
+
// Also dismiss welcome when agent starts responding (handles `p "command"` case)
|
|
159
|
+
pi.on("stream_start", async (_event, ctx) => {
|
|
158
160
|
isStreaming = true;
|
|
161
|
+
dismissWelcome(ctx);
|
|
159
162
|
});
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
// Also dismiss on tool calls (agent is working)
|
|
165
|
+
pi.on("tool_call", async (_event, ctx) => {
|
|
166
|
+
dismissWelcome(ctx);
|
|
163
167
|
});
|
|
164
168
|
|
|
165
|
-
//
|
|
166
|
-
|
|
169
|
+
// Helper to dismiss welcome overlay/header
|
|
170
|
+
function dismissWelcome(ctx: any) {
|
|
167
171
|
if (dismissWelcomeOverlay) {
|
|
168
172
|
dismissWelcomeOverlay();
|
|
169
173
|
dismissWelcomeOverlay = null;
|
|
174
|
+
} else {
|
|
175
|
+
// Overlay not set up yet (100ms delay) - mark for immediate dismissal when it does
|
|
176
|
+
welcomeOverlayShouldDismiss = true;
|
|
170
177
|
}
|
|
171
178
|
if (welcomeHeaderActive) {
|
|
172
179
|
welcomeHeaderActive = false;
|
|
173
180
|
ctx.ui.setHeader(undefined);
|
|
174
181
|
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
pi.on("stream_end", async () => {
|
|
185
|
+
isStreaming = false;
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Dismiss welcome overlay/header on first user message
|
|
189
|
+
pi.on("user_message", async (_event, ctx) => {
|
|
190
|
+
dismissWelcome(ctx);
|
|
175
191
|
});
|
|
176
192
|
|
|
177
193
|
// Command to toggle/configure
|
|
@@ -288,16 +304,8 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
288
304
|
// Override handleInput to dismiss welcome on first keypress
|
|
289
305
|
const originalHandleInput = editor.handleInput.bind(editor);
|
|
290
306
|
editor.handleInput = (data: string) => {
|
|
291
|
-
// Dismiss welcome overlay/header on first keypress
|
|
292
|
-
|
|
293
|
-
const dismiss = dismissWelcomeOverlay;
|
|
294
|
-
dismissWelcomeOverlay = null;
|
|
295
|
-
setTimeout(dismiss, 0);
|
|
296
|
-
}
|
|
297
|
-
if (welcomeHeaderActive) {
|
|
298
|
-
welcomeHeaderActive = false;
|
|
299
|
-
ctx.ui.setHeader(undefined);
|
|
300
|
-
}
|
|
307
|
+
// Dismiss welcome overlay/header on first keypress (use setTimeout to avoid re-entrancy)
|
|
308
|
+
setTimeout(() => dismissWelcome(ctx), 0);
|
|
301
309
|
originalHandleInput(data);
|
|
302
310
|
};
|
|
303
311
|
|
|
@@ -491,6 +499,26 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
491
499
|
|
|
492
500
|
// Small delay to let pi-mono finish initialization
|
|
493
501
|
setTimeout(() => {
|
|
502
|
+
// Skip overlay if:
|
|
503
|
+
// 1. Dismissal was explicitly requested (stream_start/user_message fired)
|
|
504
|
+
// 2. Agent is already streaming
|
|
505
|
+
// 3. Session already has assistant messages (agent already responded)
|
|
506
|
+
if (welcomeOverlayShouldDismiss || isStreaming) {
|
|
507
|
+
welcomeOverlayShouldDismiss = false;
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Check if session already has activity (handles p "command" case)
|
|
512
|
+
const sessionEvents = ctx.sessionManager?.getBranch?.() ?? [];
|
|
513
|
+
const hasActivity = sessionEvents.some((e: any) =>
|
|
514
|
+
(e.type === "message" && e.message?.role === "assistant") ||
|
|
515
|
+
e.type === "tool_call" ||
|
|
516
|
+
e.type === "tool_result"
|
|
517
|
+
);
|
|
518
|
+
if (hasActivity) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
|
|
494
522
|
ctx.ui.custom(
|
|
495
523
|
(tui: any, _theme: any, _keybindings: any, done: (result: void) => void) => {
|
|
496
524
|
const welcome = new WelcomeComponent(
|
|
@@ -514,6 +542,13 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
514
542
|
// Store dismiss callback so user_message/keypress can trigger it
|
|
515
543
|
dismissWelcomeOverlay = dismiss;
|
|
516
544
|
|
|
545
|
+
// Double-check: dismissal might have been requested between the outer check
|
|
546
|
+
// and this callback running
|
|
547
|
+
if (welcomeOverlayShouldDismiss) {
|
|
548
|
+
welcomeOverlayShouldDismiss = false;
|
|
549
|
+
dismiss();
|
|
550
|
+
}
|
|
551
|
+
|
|
517
552
|
const interval = setInterval(() => {
|
|
518
553
|
if (dismissed) return;
|
|
519
554
|
countdown--;
|