@pi-unipi/notify 2.2.1 → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/notify",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Cross-platform notification extension for Pi — native OS, Gotify, and Telegram notifications for agent lifecycle events",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@pi-unipi/core": "2.2.0",
37
+ "@pi-unipi/core": "2.3.0",
38
38
  "node-notifier": "^10.0.1"
39
39
  },
40
40
  "peerDependencies": {
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { Component } from "@earendil-works/pi-tui";
10
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
10
+ import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
11
11
  import type { Theme } from "@earendil-works/pi-coding-agent";
12
12
  import { sendGotifyNotification } from "../platforms/gotify.js";
13
13
  import { updateConfig, loadConfig } from "../settings.js";
@@ -59,7 +59,7 @@ export class GotifySetupOverlay implements Component {
59
59
  case "instructions":
60
60
  if (data === "\r" || data === " ") {
61
61
  this.phase = this.serverUrl ? "app-token" : "server-url";
62
- } else if (data === "\x1b") {
62
+ } else if (matchesKey(data, "escape")) {
63
63
  this.onClose?.();
64
64
  }
65
65
  break;
@@ -79,7 +79,7 @@ export class GotifySetupOverlay implements Component {
79
79
  case "priority":
80
80
  if (data === "\r" && this.isValidPriority()) {
81
81
  this.testConnection();
82
- } else if (data === "\x1b") {
82
+ } else if (matchesKey(data, "escape")) {
83
83
  this.onClose?.();
84
84
  } else if (data === "\x7f" || data === "\b") {
85
85
  this.priority = this.priority.slice(0, -1);
@@ -92,7 +92,7 @@ export class GotifySetupOverlay implements Component {
92
92
  break;
93
93
 
94
94
  case "testing":
95
- if (data === "\x1b") {
95
+ if (matchesKey(data, "escape")) {
96
96
  this.onClose?.();
97
97
  }
98
98
  break;
@@ -100,7 +100,7 @@ export class GotifySetupOverlay implements Component {
100
100
  case "success":
101
101
  case "error":
102
102
  case "test-failed":
103
- if (data === "\r" || data === " " || data === "\x1b") {
103
+ if (data === "\r" || data === " " || matchesKey(data, "escape")) {
104
104
  this.onClose?.();
105
105
  }
106
106
  break;
@@ -137,7 +137,7 @@ export class GotifySetupOverlay implements Component {
137
137
  }
138
138
  if (data === "\r") {
139
139
  onEnter();
140
- } else if (data === "\x1b") {
140
+ } else if (matchesKey(data, "escape")) {
141
141
  this.onClose?.();
142
142
  } else if (data === "\x7f" || data === "\b") {
143
143
  if (target === "server-url") {
package/tui/ntfy-setup.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { Component } from "@earendil-works/pi-tui";
10
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
10
+ import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
11
11
  import type { Theme } from "@earendil-works/pi-coding-agent";
12
12
  import { sendNtfyNotification } from "../platforms/ntfy.js";
13
13
  import { loadNtfyConfig, saveNtfyConfig, getNtfyConfigScope } from "../ntfy-config.js";
@@ -70,7 +70,7 @@ export class NtfySetupOverlay implements Component {
70
70
  case "instructions":
71
71
  if (data === "\r" || data === " ") {
72
72
  this.phase = "scope";
73
- } else if (data === "\x1b") {
73
+ } else if (matchesKey(data, "escape")) {
74
74
  this.onClose?.();
75
75
  }
76
76
  break;
@@ -85,7 +85,7 @@ export class NtfySetupOverlay implements Component {
85
85
  } else if (data === "\r" || data === " ") {
86
86
  this.scope = this.scopeIndex === 1 ? "project" : "global";
87
87
  this.phase = this.serverUrl ? "topic" : "server-url";
88
- } else if (data === "\x1b") {
88
+ } else if (matchesKey(data, "escape")) {
89
89
  this.onClose?.();
90
90
  }
91
91
  break;
@@ -114,7 +114,7 @@ export class NtfySetupOverlay implements Component {
114
114
  case "priority":
115
115
  if (data === "\r" && this.isValidPriority()) {
116
116
  this.testConnection();
117
- } else if (data === "\x1b") {
117
+ } else if (matchesKey(data, "escape")) {
118
118
  this.onClose?.();
119
119
  } else if (data === "\x7f" || data === "\b") {
120
120
  this.priority = this.priority.slice(0, -1);
@@ -127,7 +127,7 @@ export class NtfySetupOverlay implements Component {
127
127
  break;
128
128
 
129
129
  case "testing":
130
- if (data === "\x1b") {
130
+ if (matchesKey(data, "escape")) {
131
131
  this.onClose?.();
132
132
  }
133
133
  break;
@@ -135,7 +135,7 @@ export class NtfySetupOverlay implements Component {
135
135
  case "success":
136
136
  case "error":
137
137
  case "test-failed":
138
- if (data === "\r" || data === " " || data === "\x1b") {
138
+ if (data === "\r" || data === " " || matchesKey(data, "escape")) {
139
139
  this.onClose?.();
140
140
  }
141
141
  break;
@@ -173,7 +173,7 @@ export class NtfySetupOverlay implements Component {
173
173
  }
174
174
  if (data === "\r") {
175
175
  onEnter();
176
- } else if (data === "\x1b") {
176
+ } else if (matchesKey(data, "escape")) {
177
177
  // Escape during token phase — skip token (optional field)
178
178
  if (target === "token") {
179
179
  this.phase = "priority";
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { Component } from "@earendil-works/pi-tui";
9
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
9
+ import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
10
10
  import type { Theme } from "@earendil-works/pi-coding-agent";
11
11
  import { readModelCache, type CachedModel, boxInnerWidth } from "@pi-unipi/core";
12
12
  import { loadConfig, saveConfig } from "../settings.js";
@@ -56,7 +56,7 @@ export class RecapModelSelectorOverlay implements Component {
56
56
  this.filterMode = false;
57
57
  return;
58
58
  }
59
- if (data === "\x1b") {
59
+ if (matchesKey(data, "escape")) {
60
60
  // Escape — clear filter and exit filter mode
61
61
  this.filter = "";
62
62
  this.filterMode = false;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { Component } from "@earendil-works/pi-tui";
9
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
9
+ import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
10
10
  import type { Theme } from "@earendil-works/pi-coding-agent";
11
11
  import { pollForChatId } from "../platforms/telegram.js";
12
12
  import { updateConfig } from "../settings.js";
@@ -48,7 +48,7 @@ export class TelegramSetupOverlay implements Component {
48
48
  case "instructions":
49
49
  if (data === "\r" || data === " ") {
50
50
  this.phase = "token";
51
- } else if (data === "\x1b") {
51
+ } else if (matchesKey(data, "escape")) {
52
52
  this.cleanup();
53
53
  this.onClose?.();
54
54
  }
@@ -75,7 +75,7 @@ export class TelegramSetupOverlay implements Component {
75
75
  }
76
76
  if (data === "\r" && this.botToken.length > 0) {
77
77
  this.startPolling();
78
- } else if (data === "\x1b") {
78
+ } else if (matchesKey(data, "escape")) {
79
79
  this.cleanup();
80
80
  this.onClose?.();
81
81
  } else if (data === "\x7f" || data === "\b") {
@@ -85,7 +85,7 @@ export class TelegramSetupOverlay implements Component {
85
85
  }
86
86
  break;
87
87
  case "polling":
88
- if (data === "\x1b") {
88
+ if (matchesKey(data, "escape")) {
89
89
  this.cleanup();
90
90
  this.onClose?.();
91
91
  }
@@ -93,7 +93,7 @@ export class TelegramSetupOverlay implements Component {
93
93
  case "success":
94
94
  case "error":
95
95
  case "timeout":
96
- if (data === "\r" || data === " " || data === "\x1b") {
96
+ if (data === "\r" || data === " " || matchesKey(data, "escape")) {
97
97
  this.cleanup();
98
98
  this.onClose?.();
99
99
  }