@leo-alvarenga/pi-zen-frame 0.16.1 → 0.17.0

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.
@@ -0,0 +1,13 @@
1
+ import type { SegmentDef } from "./types";
2
+
3
+ /** Box bottom (left): pi-notify bell, right before the model segment.
4
+ * Accent when notifications are on, muted bell-off otherwise */
5
+ export const notifySegment: SegmentDef = {
6
+ id: "notify",
7
+ slot: "topLeft",
8
+ render: (d, { icons, theme }) => {
9
+ const color = d.notifyEnabled && !d.zenMode ? d.accentColor : "muted";
10
+
11
+ return theme.fg(color, ` ${d.notifyEnabled ? icons.bell : icons.bellOff} `);
12
+ },
13
+ };
@@ -5,6 +5,7 @@
5
5
  * The frame calls `segmentsFor(slot, ...)` and handles all width/joining.
6
6
  */
7
7
  import { modelSegment } from "./model";
8
+ import { notifySegment } from "./notify";
8
9
  import { reasoningSegment } from "./reasoning";
9
10
  import { spinnerSegment } from "./spinner";
10
11
  import { tokenCountSegment } from "./token-count";
@@ -14,6 +15,7 @@ import type { FrameData, SegmentContext, SegmentDef, Slot } from "./types";
14
15
 
15
16
  export const segments: SegmentDef[] = [
16
17
  agentModeSegment,
18
+ notifySegment,
17
19
  modelSegment,
18
20
  reasoningSegment,
19
21
  spinnerSegment,
@@ -56,6 +56,9 @@ export interface FrameData {
56
56
  agentMode: AgentMode;
57
57
 
58
58
  context: TokenUsage | null;
59
+
60
+ /** pi-notify toggle state (true = notifications enabled). */
61
+ notifyEnabled: boolean;
59
62
  }
60
63
 
61
64
  /** Data + rendering helpers handed to every segment. */
@@ -94,4 +97,5 @@ export interface ExternalData {
94
97
  modelProvider: string | undefined;
95
98
  thinkingLevel: string | undefined;
96
99
  spinnerPhase: SpinnerPhase | null;
100
+ notifyEnabled: boolean;
97
101
  }
@@ -5,6 +5,9 @@
5
5
  export const PI_AGENT_MANAGER_AGENT_EVENT = "pi-agent-manager:agent-changed";
6
6
  export const PI_AGENT_MANAGER_AGENT_DATA_KEY = "pi-agent-manager-agent";
7
7
 
8
+ /** pi-notify integration (optional — no hard dependency). */
9
+ export const PI_NOTIFY_TOGGLE_EVENT = "pi-notify:toggle-changed";
10
+
8
11
  /** Keybinding id users bind in keybindings.json to toggle zen mode. */
9
12
  export const ZEN_MODE_SHORTCUT_ID = "piZenFrame.zenMode";
10
13
  /** Default key when the user hasn't bound one (override or disable via
@@ -21,6 +21,8 @@ export const DEFAULT_ICONS: FrameIcons = {
21
21
  gitDirty: "",
22
22
  thinking: "󰌶",
23
23
  gitBranch: "",
24
+ bell: "󰂚",
25
+ bellOff: "󰂛",
24
26
  };
25
27
 
26
28
  /** Thinking level → theme token, mirroring pi's own border-color mapping. */
@@ -19,6 +19,8 @@ export interface FrameIcons {
19
19
  thinking: string;
20
20
  gitDirty: string;
21
21
  gitBranch: string;
22
+ bell: string;
23
+ bellOff: string;
22
24
  }
23
25
 
24
26
  /**
@@ -98,6 +98,7 @@ export class BlockyEditor extends CustomEditor {
98
98
  thinkingLevel: ext.thinkingLevel,
99
99
  spinnerFrame: this.spinnerFrame(),
100
100
  accentColor: this.opts.accentColor,
101
+ notifyEnabled: ext.notifyEnabled,
101
102
  };
102
103
 
103
104
  let prefix = "┃";
@@ -21,6 +21,7 @@ import type { KeyId } from "@earendil-works/pi-tui";
21
21
  import {
22
22
  DEFAULT_SETTINGS,
23
23
  PI_AGENT_MANAGER_AGENT_EVENT,
24
+ PI_NOTIFY_TOGGLE_EVENT,
24
25
  SPINNER_FRAMES,
25
26
  ZEN_MODE_DEFAULT_KEY,
26
27
  ZEN_MODE_SHORTCUT_ID,
@@ -44,6 +45,7 @@ let currentCtx: ExtensionContext | null = null;
44
45
  let settings: Settings = DEFAULT_SETTINGS;
45
46
  let spinnerPhase: SpinnerPhase | null = null;
46
47
  let agentMode: AgentMode = null;
48
+ let notifyEnabled = false;
47
49
  let zenMode = true;
48
50
  let git: GitInfo = {
49
51
  branch: undefined,
@@ -99,6 +101,7 @@ function provideExternal(pi: ExtensionAPI): ExternalData {
99
101
  thinkingLevel: pi.getThinkingLevel(),
100
102
  modelName: model?.name ?? model?.id ?? "Unknown",
101
103
  modelProvider: capitalize(model?.provider ?? "unknown"),
104
+ notifyEnabled,
102
105
  };
103
106
  }
104
107
 
@@ -174,6 +177,13 @@ export default async function (pi: ExtensionAPI) {
174
177
  editor?.refresh();
175
178
  });
176
179
 
180
+ // Optional pi-notify integration (no hard dependency).
181
+ pi.events.on(PI_NOTIFY_TOGGLE_EVENT, (event) => {
182
+ const enabled = (event as { enabled?: unknown } | undefined)?.enabled;
183
+ if (typeof enabled === "boolean") notifyEnabled = enabled;
184
+ editor?.refresh();
185
+ });
186
+
177
187
  pi.on("session_start", async (_event, ctx) => {
178
188
  currentCtx = ctx;
179
189
  agentMode = readAgentModeFromSession(ctx) || agentMode;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@leo-alvarenga/pi-zen-frame",
3
3
  "description": "A pi-coding-agent extension that gives the TUI editor a simple yet polished look and feel",
4
4
  "author": "Leonardo A. Alvarenga",
5
- "version": "0.16.1",
5
+ "version": "0.17.0",
6
6
  "license": "MIT",
7
7
  "repository": "github.com/leo-alvarenga/pi-mono",
8
8
  "publishConfig": {