dsh-plugin-desktop-notify 0.6.4 → 0.6.5
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.md +4 -3
- package/lib/client.js +29 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- **等待你操作**——工具审批、提问、执行计划确认
|
|
17
17
|
- **任务失败**——这一轮出错时提示
|
|
18
18
|
- **说清楚怎么结束的**——正常完成、被拦截、输出到上限、被中止,各自一句话,不把中断说成「已完成」
|
|
19
|
-
-
|
|
19
|
+
- **还在进行的排在前面**——正在跑、等你审批/回答、刚出错 的会话排到**手动置顶的下面、其余会话的上面**,处理完自动放回原位;完成未读只进小红点,不搬动列表
|
|
20
20
|
- **小红点**——应用图标上显示「需要你的会话数」,你看过之后才清零
|
|
21
21
|
- **点击通知**——切到对应会话,而不是只把应用叫到前面
|
|
22
22
|
|
|
@@ -46,7 +46,7 @@ dsh-plugin-desktop-notify
|
|
|
46
46
|
| `notifyViewed` | `false` | 正在看的会话也通知(默认跳过) |
|
|
47
47
|
| `badge` | `true` | 显示小红点 |
|
|
48
48
|
| `excludeSubagents` | `true` | 忽略子智能体会话 |
|
|
49
|
-
| `orderAttention` | `true` |
|
|
49
|
+
| `orderAttention` | `true` | 把仍在进行中的会话排到手动置顶下面(不改置顶状态;关掉后完全不碰排序) |
|
|
50
50
|
| `titleComplete` / `titlePending` / `titleError` | 空 | 自定义标题,空 = 用内置文案 |
|
|
51
51
|
| `maxBodyChars` | `140` | 正文长度上限 |
|
|
52
52
|
|
|
@@ -112,7 +112,8 @@ urllib.request.urlopen(request, timeout=3).read()
|
|
|
112
112
|
|
|
113
113
|
- 重启或刷新窗口时,已经存在的「未读 / 待审批」只恢复小红点,不再补弹横幅
|
|
114
114
|
- 这个排序是插件接管「手动排序」实现的:插件只写「需要你」那几条的顺序,其余会话仍然按最近更新往后排,
|
|
115
|
-
|
|
115
|
+
所以视觉上和「最近更新」一样,只是多了一条仍在进行中的带状区域。切换窗口焦点不会触发重排。
|
|
116
|
+
代价是侧栏的排序方式会显示成「手动」,
|
|
116
117
|
而且你把会话拖动排序后,下一次有会话需要你时会被重排覆盖。不想要就 `orderAttention: false`
|
|
117
118
|
|
|
118
119
|
- **Windows**:点通知会切到对应会话,但窗口不一定到前台——`AppUserModelID` 和主进程 focus 通道属于桌面端,渲染层插件做不到
|
package/lib/client.js
CHANGED
|
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
factory: (require) => {
|
|
31
31
|
const NS = "dsh-plugin-desktop-notify"
|
|
32
32
|
/** Reported by capabilities(); keep in step with package.json (cross-machine support). */
|
|
33
|
-
const VERSION = "0.6.
|
|
33
|
+
const VERSION = "0.6.5"
|
|
34
34
|
const PREFERENCES_KEY = `${NS}:preferences`
|
|
35
35
|
|
|
36
36
|
/** Defaults; override per field with the localStorage JSON described in README. */
|
|
@@ -374,6 +374,9 @@ window.__ModuleLoader__.load({
|
|
|
374
374
|
const snapshot = workspaceSnapshot()
|
|
375
375
|
const list = ctx.sessions.list.getSnapshot()
|
|
376
376
|
if (snapshot === undefined || list?.phase !== "ready") return
|
|
377
|
+
// The workspace registry hydrates separately; writing before it is ready
|
|
378
|
+
// would file every session under "" and then rewrite them a moment later.
|
|
379
|
+
if (snapshot.phase !== "ready" || snapshot.state === "loading") return
|
|
377
380
|
const archived = new Set(Array.isArray(snapshot.archivedSessionIds) ? snapshot.archivedSessionIds : [])
|
|
378
381
|
const live = tier.filter((sessionId) => !archived.has(sessionId))
|
|
379
382
|
const active = preferences.orderAttention && live.length > 0
|
|
@@ -393,7 +396,10 @@ window.__ModuleLoader__.load({
|
|
|
393
396
|
const members = new Set(memberIds)
|
|
394
397
|
const order = active ? live.filter((sessionId) => members.has(sessionId)) : []
|
|
395
398
|
const signature = order.join("\n")
|
|
399
|
+
// Never touch a group this plugin has not seated before: writing an
|
|
400
|
+
// empty order there would wipe the user's own drag arrangement.
|
|
396
401
|
if (lastOrderByKey.get(key) === signature) continue
|
|
402
|
+
if (signature === "" && !lastOrderByKey.has(key)) continue
|
|
397
403
|
try {
|
|
398
404
|
view.setSessionOrder(key, order, {})
|
|
399
405
|
lastOrderByKey.set(key, signature)
|
|
@@ -716,10 +722,14 @@ window.__ModuleLoader__.load({
|
|
|
716
722
|
})
|
|
717
723
|
}
|
|
718
724
|
|
|
719
|
-
//
|
|
720
|
-
//
|
|
725
|
+
// Only what is still in flight is seated: a running turn, a question
|
|
726
|
+
// waiting on you, or a failure. An unread completion stays in the
|
|
727
|
+
// badge instead — promoting it would move the list every time you
|
|
728
|
+
// read a session, and it is exactly what made the band churn.
|
|
729
|
+
// Focus is deliberately not part of this: a running turn keeps its
|
|
730
|
+
// seat while you tab away, so the band never reshuffles on blur.
|
|
721
731
|
const current = attention.get(sessionId) ?? {}
|
|
722
|
-
if (
|
|
732
|
+
if (running || pendingKind !== undefined || current.error !== undefined) {
|
|
723
733
|
wanted.add(sessionId)
|
|
724
734
|
}
|
|
725
735
|
|
|
@@ -823,6 +833,21 @@ window.__ModuleLoader__.load({
|
|
|
823
833
|
}
|
|
824
834
|
}, "dsh-plugin-desktop-notify: badge release")
|
|
825
835
|
|
|
836
|
+
/* Give the sidebar back the order this plugin took when it unloads. */
|
|
837
|
+
ctx.effect(() => () => {
|
|
838
|
+
const view = ctx.uiWorkspace?.view
|
|
839
|
+
if (typeof view?.setSessionOrder !== "function") return
|
|
840
|
+
for (const [key, signature] of lastOrderByKey) {
|
|
841
|
+
if (signature === "") continue
|
|
842
|
+
try {
|
|
843
|
+
view.setSessionOrder(key, [], {})
|
|
844
|
+
} catch {
|
|
845
|
+
/* a torn-down view keeps whatever it had */
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
lastOrderByKey.clear()
|
|
849
|
+
}, "dsh-plugin-desktop-notify: order release")
|
|
850
|
+
|
|
826
851
|
/*
|
|
827
852
|
* Diagnostic surface for DevTools (⌘⌥I):
|
|
828
853
|
* __DSH_DESKTOP_NOTIFY__.capabilities() — what this renderer supports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-desktop-notify",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Desktop notifications and a Dock/taskbar badge for DeepSeek Harness: a finished turn, a pending approval or question, and a failure, with click-through back to the session",
|
|
6
6
|
"license": "MIT",
|