pi-powerline-footer 0.2.9 → 0.2.11

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/index.ts +30 -28
  3. package/package.json +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ### Changed
6
+ - Added `pi` manifest to package.json for pi v0.50.0 package system compliance
7
+ - Added `pi-package` keyword for npm discoverability
8
+
9
+ ## [0.2.10] - 2026-01-17
10
+
11
+ ### Fixed
12
+ - Welcome overlay now properly dismisses for `p "command"` case by:
13
+ - Adding `tool_call` event listener (fires before stream_start)
14
+ - Checking `isStreaming` flag when overlay is about to show
15
+ - Checking session for existing activity (assistant messages, tool calls)
16
+ - Refactored dismissal logic into `dismissWelcome()` helper
17
+
3
18
  ## [0.2.9] - 2026-01-17
4
19
 
5
20
  ### Fixed
package/index.ts CHANGED
@@ -158,6 +158,16 @@ export default function powerlineFooter(pi: ExtensionAPI) {
158
158
  // Also dismiss welcome when agent starts responding (handles `p "command"` case)
159
159
  pi.on("stream_start", async (_event, ctx) => {
160
160
  isStreaming = true;
161
+ dismissWelcome(ctx);
162
+ });
163
+
164
+ // Also dismiss on tool calls (agent is working)
165
+ pi.on("tool_call", async (_event, ctx) => {
166
+ dismissWelcome(ctx);
167
+ });
168
+
169
+ // Helper to dismiss welcome overlay/header
170
+ function dismissWelcome(ctx: any) {
161
171
  if (dismissWelcomeOverlay) {
162
172
  dismissWelcomeOverlay();
163
173
  dismissWelcomeOverlay = null;
@@ -169,7 +179,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
169
179
  welcomeHeaderActive = false;
170
180
  ctx.ui.setHeader(undefined);
171
181
  }
172
- });
182
+ }
173
183
 
174
184
  pi.on("stream_end", async () => {
175
185
  isStreaming = false;
@@ -177,17 +187,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
177
187
 
178
188
  // Dismiss welcome overlay/header on first user message
179
189
  pi.on("user_message", async (_event, ctx) => {
180
- if (dismissWelcomeOverlay) {
181
- dismissWelcomeOverlay();
182
- dismissWelcomeOverlay = null;
183
- } else {
184
- // Overlay not set up yet (100ms delay) - mark for immediate dismissal when it does
185
- welcomeOverlayShouldDismiss = true;
186
- }
187
- if (welcomeHeaderActive) {
188
- welcomeHeaderActive = false;
189
- ctx.ui.setHeader(undefined);
190
- }
190
+ dismissWelcome(ctx);
191
191
  });
192
192
 
193
193
  // Command to toggle/configure
@@ -304,19 +304,8 @@ export default function powerlineFooter(pi: ExtensionAPI) {
304
304
  // Override handleInput to dismiss welcome on first keypress
305
305
  const originalHandleInput = editor.handleInput.bind(editor);
306
306
  editor.handleInput = (data: string) => {
307
- // Dismiss welcome overlay/header on first keypress
308
- if (dismissWelcomeOverlay) {
309
- const dismiss = dismissWelcomeOverlay;
310
- dismissWelcomeOverlay = null;
311
- setTimeout(dismiss, 0);
312
- } else {
313
- // Overlay not set up yet (100ms delay) - mark for immediate dismissal when it does
314
- welcomeOverlayShouldDismiss = true;
315
- }
316
- if (welcomeHeaderActive) {
317
- welcomeHeaderActive = false;
318
- ctx.ui.setHeader(undefined);
319
- }
307
+ // Dismiss welcome overlay/header on first keypress (use setTimeout to avoid re-entrancy)
308
+ setTimeout(() => dismissWelcome(ctx), 0);
320
309
  originalHandleInput(data);
321
310
  };
322
311
 
@@ -510,13 +499,26 @@ export default function powerlineFooter(pi: ExtensionAPI) {
510
499
 
511
500
  // Small delay to let pi-mono finish initialization
512
501
  setTimeout(() => {
513
- // Skip overlay entirely if dismissal was requested during the delay
514
- // (e.g., `p "command"` triggers stream_start before this runs)
515
- if (welcomeOverlayShouldDismiss) {
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) {
516
507
  welcomeOverlayShouldDismiss = false;
517
508
  return;
518
509
  }
519
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
+
520
522
  ctx.ui.custom(
521
523
  (tui: any, _theme: any, _keybindings: any, done: (result: void) => void) => {
522
524
  const welcome = new WelcomeComponent(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-powerline-footer",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Powerline-style status bar extension for pi coding agent",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "cli.js"
13
13
  ],
14
14
  "keywords": [
15
+ "pi-package",
15
16
  "pi",
16
17
  "coding-agent",
17
18
  "powerline",
@@ -23,5 +24,10 @@
23
24
  "repository": {
24
25
  "type": "git",
25
26
  "url": "git+https://github.com/nicobailon/pi-powerline-footer.git"
27
+ },
28
+ "pi": {
29
+ "extensions": [
30
+ "./index.ts"
31
+ ]
26
32
  }
27
33
  }