token-stats-timer 1.0.2 → 1.0.3
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/notify.ts +4 -5
- package/package.json +1 -1
package/notify.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// enabled 总开关(默认 true)
|
|
10
10
|
// minDurationSec 时长低于该秒数的 run 不通知(默认 0 = 每次都通知)
|
|
11
11
|
// sound 通知声音(默认 "Glass","" 表示静音)
|
|
12
|
-
// onSuccess / onFailure / onAbort / onSessionEnd
|
|
12
|
+
// onSuccess / onFailure / onAbort / onSessionEnd 各类通知开关
|
|
13
13
|
//
|
|
14
14
|
// 命令:/notify on | off | status
|
|
15
15
|
|
|
@@ -145,25 +145,24 @@ export function createNotifier(pi: ExtensionAPI): void {
|
|
|
145
145
|
const durationMs = startMs !== undefined ? Date.now() - startMs : 0;
|
|
146
146
|
if (durationMs < config.minDurationSec * 1000) return;
|
|
147
147
|
|
|
148
|
-
const where = `「${cwdName()}」`;
|
|
149
148
|
const dur = startMs !== undefined ? ` · ${formatDuration(durationMs)}` : "";
|
|
150
149
|
|
|
151
150
|
if (runFailed && config.onFailure) {
|
|
152
151
|
notify(
|
|
153
152
|
"❌ pi 执行失败",
|
|
154
|
-
|
|
153
|
+
`耗时:${dur}\n${truncate(runErrorMsg || "未知错误")}`,
|
|
155
154
|
config.sound,
|
|
156
155
|
);
|
|
157
156
|
} else if (runAborted && config.onAbort) {
|
|
158
157
|
notify(
|
|
159
158
|
"⏹ pi 已中止",
|
|
160
|
-
|
|
159
|
+
`耗时:${dur}\n${truncate(runErrorMsg || "执行被中止")}`,
|
|
161
160
|
config.sound,
|
|
162
161
|
);
|
|
163
162
|
} else if (config.onSuccess) {
|
|
164
163
|
notify(
|
|
165
164
|
"✅ pi 执行完成",
|
|
166
|
-
|
|
165
|
+
`耗时:${dur}`,
|
|
167
166
|
config.sound,
|
|
168
167
|
);
|
|
169
168
|
}
|