@telosmaylx/dsh-session-notify 0.1.13 → 0.1.16
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/README.en.md +16 -13
- package/README.ja.md +16 -13
- package/README.ko.md +16 -13
- package/README.md +16 -13
- package/README.zh-TW.md +16 -13
- package/lib/client.js +2541 -2451
- package/lib/index.js +8 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* includeUsage: true
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
import { appendFileSync } from 'node:fs'
|
|
35
|
+
import { appendFileSync, statSync, truncateSync } from 'node:fs'
|
|
36
36
|
import { join } from 'node:path'
|
|
37
37
|
import { homedir } from 'node:os'
|
|
38
38
|
import { createRequire } from 'node:module'
|
|
@@ -429,9 +429,15 @@ function appendNotice(ctx, session, notice, kind, title) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
/** 追加失败时落一个调试文件(~/.dsh/session-complete-notify.log),便于排查。 */
|
|
432
|
+
const LOG_MAX_BYTES = 512 * 1024 // P2-8:超过 512KB 截断,避免长期运行无限增长
|
|
432
433
|
function fileLog(line) {
|
|
433
434
|
try {
|
|
434
|
-
|
|
435
|
+
const file = join(homedir(), '.dsh', 'session-complete-notify.log')
|
|
436
|
+
try {
|
|
437
|
+
const st = statSync(file)
|
|
438
|
+
if (st.size > LOG_MAX_BYTES) truncateSync(file, 0)
|
|
439
|
+
} catch { /* 文件不存在等,忽略 */ }
|
|
440
|
+
appendFileSync(file, `${new Date().toISOString()} ${line}\n`, 'utf8')
|
|
435
441
|
} catch {
|
|
436
442
|
/* 尽力而为 */
|
|
437
443
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telosmaylx/dsh-session-notify",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "DSH session completion notifier: appends a plugin system message to the session log on turn/end and pushes browser notifications (Web Notification + toast), with a fully customizable official settings panel (presets, 5-language templates, cache-hit rate & tok/s from official projections).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|