dsh-bark-push 0.3.0 → 0.3.1
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/CHANGELOG.md +4 -0
- package/README.md +7 -1
- package/docs/settings-browser-persistence-mobile.png +0 -0
- package/docs/settings-browser-persistence.png +0 -0
- package/lib/client.js +16 -1
- package/lib/config.js +9 -0
- package/lib/ui.js +35 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- 通知发送完全异步:任一渠道故障不会阻塞对话、工具调用或审批流程。
|
|
8
8
|
- 配置页、测试推送、静音管理都在 DSH 的 **Settings → 通知** 中完成;页面使用顶部 Tab,把概览、推送渠道、通知规则、浏览器通知和静音管理分成五个独立工作区。
|
|
9
9
|
|
|
10
|
-
当前版本 **0.3.0
|
|
10
|
+
当前版本 **0.3.1**:在 0.3.0 浏览器通知与顶部 Tab 设置页基础上,新增按类型设置通知停留。
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
@@ -204,6 +204,9 @@ Settings → **通知** 采用顶部 Tab + 工作区的产品化布局。页面
|
|
|
204
204
|
| `browserNotifyOnReply` | `true` | 浏览器通知:回复完成 |
|
|
205
205
|
| `browserNotifyOnApproval` | `true` | 浏览器通知:需要批准 |
|
|
206
206
|
| `browserNotifyOnQuestion` | `true` | 浏览器通知:等待选择 |
|
|
207
|
+
| `browserNotifyReplyPersistent` | `false` | 回复通知常驻;关闭时自动消失 |
|
|
208
|
+
| `browserNotifyApprovalPersistent` | `true` | 批准通知常驻;关闭时自动消失 |
|
|
209
|
+
| `browserNotifyQuestionPersistent` | `true` | 选择通知常驻;关闭时自动消失 |
|
|
207
210
|
| `browserNotifySkipForeground` | `true` | 当前会话且页面在前台时不提醒 |
|
|
208
211
|
| `browserNotifyUsePushMutes` | `true` | 复用推送通知的工作区/会话静音;关闭后使用独立浏览器静音集合 |
|
|
209
212
|
| `browserNotifyReplyBody` | `{status} · {summary}` | 回复完成正文模板 |
|
|
@@ -297,10 +300,13 @@ channels:
|
|
|
297
300
|
|
|
298
301
|
浏览器通知是独立的 Web Notification 通道,默认关闭,不依赖 Bark Device Key 或任何推送渠道。它只在 DSH 页面打开时工作;页面关闭、浏览器退出或移动端 Safari 页面通知请继续使用 Bark。
|
|
299
302
|
|
|
303
|
+

|
|
304
|
+
|
|
300
305
|
特点:
|
|
301
306
|
|
|
302
307
|
- **独立控制**:`browserNotifyEnabled` 与 Bark 的 `enabled` 分离,三个类型开关也独立于推送通知规则。
|
|
303
308
|
- **前台免打扰**:默认在“当前会话且页面可见、窗口有焦点”时跳过通知;可关闭该开关。
|
|
309
|
+
- **通知停留**:回复完成、需要批准、等待选择三类通知可分别选择「自动消失」或「常驻」;自动消失的具体时长由浏览器和操作系统决定,常驻会保留到手动关闭(部分平台仍可能按系统通知策略收起)。
|
|
304
310
|
- **正文模板**:三个类型分别支持 `{status}`、`{session}`、`{summary}`、`{turn}`、`{tool}`、`{reason}`、`{question}`、`{questionCount}`、`{description}` 占位符;未知占位符原样保留,空模板回退默认值。
|
|
305
311
|
- **短内容**:正文只包含状态和短描述,不发送完整回复正文、工具参数、命令或图片。
|
|
306
312
|
- **静音策略**:默认复用推送通知的工作区/会话静音;关闭 `browserNotifyUsePushMutes` 后使用独立的浏览器静音集合,可在设置页单独管理。
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -90,6 +90,11 @@ window.__ModuleLoader__.load({
|
|
|
90
90
|
browserConfig: {
|
|
91
91
|
enabled: false,
|
|
92
92
|
skipForeground: true,
|
|
93
|
+
persistent: {
|
|
94
|
+
reply: false,
|
|
95
|
+
approval: true,
|
|
96
|
+
question: true,
|
|
97
|
+
},
|
|
93
98
|
},
|
|
94
99
|
listeners: new Set(),
|
|
95
100
|
};
|
|
@@ -161,6 +166,14 @@ window.__ModuleLoader__.load({
|
|
|
161
166
|
return best;
|
|
162
167
|
}
|
|
163
168
|
|
|
169
|
+
function browserPersistenceOf(config) {
|
|
170
|
+
return {
|
|
171
|
+
reply: config.browserNotifyReplyPersistent === true,
|
|
172
|
+
approval: config.browserNotifyApprovalPersistent !== false,
|
|
173
|
+
question: config.browserNotifyQuestionPersistent !== false,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
164
177
|
function adopt(payload) {
|
|
165
178
|
if (!payload || !payload.mute) return;
|
|
166
179
|
store.workspaces = new Set(Array.isArray(payload.mute.workspaces) ? payload.mute.workspaces : []);
|
|
@@ -169,6 +182,7 @@ window.__ModuleLoader__.load({
|
|
|
169
182
|
store.browserConfig = {
|
|
170
183
|
enabled: payload.config.browserNotifyEnabled === true,
|
|
171
184
|
skipForeground: payload.config.browserNotifySkipForeground !== false,
|
|
185
|
+
persistent: browserPersistenceOf(payload.config),
|
|
172
186
|
};
|
|
173
187
|
}
|
|
174
188
|
if (payload.catalog && typeof payload.catalog === "object") {
|
|
@@ -548,7 +562,7 @@ window.__ModuleLoader__.load({
|
|
|
548
562
|
body,
|
|
549
563
|
tag: `dsh-bark:${event.kind || "notice"}:${event.sessionId || ""}`,
|
|
550
564
|
renotify: true,
|
|
551
|
-
requireInteraction: event.kind
|
|
565
|
+
requireInteraction: store.browserConfig.persistent[event.kind] === true,
|
|
552
566
|
data: { sessionId: event.sessionId, kind: event.kind },
|
|
553
567
|
});
|
|
554
568
|
notification.onclick = () => {
|
|
@@ -689,6 +703,7 @@ window.__ModuleLoader__.load({
|
|
|
689
703
|
store.browserConfig = {
|
|
690
704
|
enabled: config.browserNotifyEnabled === true,
|
|
691
705
|
skipForeground: config.browserNotifySkipForeground !== false,
|
|
706
|
+
persistent: browserPersistenceOf(config),
|
|
692
707
|
};
|
|
693
708
|
}
|
|
694
709
|
};
|
package/lib/config.js
CHANGED
|
@@ -80,6 +80,9 @@ export const CONFIG_KEYS = Object.freeze([
|
|
|
80
80
|
'browserNotifyOnReply',
|
|
81
81
|
'browserNotifyOnApproval',
|
|
82
82
|
'browserNotifyOnQuestion',
|
|
83
|
+
'browserNotifyReplyPersistent',
|
|
84
|
+
'browserNotifyApprovalPersistent',
|
|
85
|
+
'browserNotifyQuestionPersistent',
|
|
83
86
|
'browserNotifySkipForeground',
|
|
84
87
|
'browserNotifyUsePushMutes',
|
|
85
88
|
'browserNotifyReplyBody',
|
|
@@ -121,6 +124,9 @@ export const DEFAULTS = Object.freeze({
|
|
|
121
124
|
browserNotifyOnReply: true,
|
|
122
125
|
browserNotifyOnApproval: true,
|
|
123
126
|
browserNotifyOnQuestion: true,
|
|
127
|
+
browserNotifyReplyPersistent: false,
|
|
128
|
+
browserNotifyApprovalPersistent: true,
|
|
129
|
+
browserNotifyQuestionPersistent: true,
|
|
124
130
|
browserNotifySkipForeground: true,
|
|
125
131
|
browserNotifyUsePushMutes: true,
|
|
126
132
|
browserNotifyReplyBody: BROWSER_BODY_TEMPLATES.reply,
|
|
@@ -429,6 +435,9 @@ function normalizeFields(raw, base, warnings) {
|
|
|
429
435
|
browserNotifyOnReply: booleanOf(raw.browserNotifyOnReply, base.browserNotifyOnReply),
|
|
430
436
|
browserNotifyOnApproval: booleanOf(raw.browserNotifyOnApproval, base.browserNotifyOnApproval),
|
|
431
437
|
browserNotifyOnQuestion: booleanOf(raw.browserNotifyOnQuestion, base.browserNotifyOnQuestion),
|
|
438
|
+
browserNotifyReplyPersistent: booleanOf(raw.browserNotifyReplyPersistent, base.browserNotifyReplyPersistent),
|
|
439
|
+
browserNotifyApprovalPersistent: booleanOf(raw.browserNotifyApprovalPersistent, base.browserNotifyApprovalPersistent),
|
|
440
|
+
browserNotifyQuestionPersistent: booleanOf(raw.browserNotifyQuestionPersistent, base.browserNotifyQuestionPersistent),
|
|
432
441
|
browserNotifySkipForeground: booleanOf(raw.browserNotifySkipForeground, base.browserNotifySkipForeground),
|
|
433
442
|
browserNotifyUsePushMutes: booleanOf(raw.browserNotifyUsePushMutes, base.browserNotifyUsePushMutes),
|
|
434
443
|
browserNotifyReplyBody: textOf(raw.browserNotifyReplyBody, base.browserNotifyReplyBody, 300),
|
package/lib/ui.js
CHANGED
|
@@ -127,6 +127,13 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
127
127
|
.rule .rt { display: flex; flex-direction: column; gap: 1px; }
|
|
128
128
|
.rule .rt b { font-size: 13px; font-weight: 600; }
|
|
129
129
|
.rule .rt small { color: var(--muted); font-size: 12px; }
|
|
130
|
+
.stay-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 26px; margin-top: 8px; }
|
|
131
|
+
.stay { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 0; min-width: 0; }
|
|
132
|
+
.stay .rt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
|
|
133
|
+
.stay .rt b { font-size: 13px; font-weight: 600; }
|
|
134
|
+
.stay .rt small { color: var(--muted); font-size: 12px; }
|
|
135
|
+
.stay select { width: auto; min-width: 112px; max-width: 132px; min-height: 32px; padding: 4px 7px; }
|
|
136
|
+
.subhead { margin: 18px 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
|
|
130
137
|
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; }
|
|
131
138
|
.save-status { color: var(--muted); font-size: 12px; margin-left: 4px; }
|
|
132
139
|
.save-status.ok { color: var(--ok); }
|
|
@@ -232,6 +239,7 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
232
239
|
.row, .row.wide { grid-template-columns: 1fr; gap: 5px; }
|
|
233
240
|
.row > label { padding-top: 0; }
|
|
234
241
|
.rule-grid, .lists, .overview-summary { grid-template-columns: 1fr; }
|
|
242
|
+
.stay-grid { grid-template-columns: 1fr; }
|
|
235
243
|
.channel-field { grid-template-columns: 1fr; }
|
|
236
244
|
.stage-head { flex-direction: column; }
|
|
237
245
|
}
|
|
@@ -455,6 +463,22 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
455
463
|
<label class="rule"><input id="browserNotifyOnQuestion" type="checkbox"><span class="rt"><b>等待选择</b><small>等待你回答时提醒</small></span></label>
|
|
456
464
|
<label class="rule"><input id="browserNotifySkipForeground" type="checkbox"><span class="rt"><b>前台免打扰</b><small>当前会话且页面在前台时不提醒</small></span></label>
|
|
457
465
|
</div>
|
|
466
|
+
<h3 class="subhead">通知停留</h3>
|
|
467
|
+
<p class="hint">自动消失的时长由浏览器和操作系统决定;常驻会保留到手动关闭。</p>
|
|
468
|
+
<div class="stay-grid">
|
|
469
|
+
<label class="stay"><span class="rt"><b>回复完成</b></span><select id="browserNotifyReplyPersistent" aria-label="回复完成通知停留">
|
|
470
|
+
<option value="auto">自动消失</option>
|
|
471
|
+
<option value="persistent">常驻</option>
|
|
472
|
+
</select></label>
|
|
473
|
+
<label class="stay"><span class="rt"><b>需要批准</b></span><select id="browserNotifyApprovalPersistent" aria-label="需要批准通知停留">
|
|
474
|
+
<option value="auto">自动消失</option>
|
|
475
|
+
<option value="persistent">常驻</option>
|
|
476
|
+
</select></label>
|
|
477
|
+
<label class="stay"><span class="rt"><b>等待选择</b></span><select id="browserNotifyQuestionPersistent" aria-label="等待选择通知停留">
|
|
478
|
+
<option value="auto">自动消失</option>
|
|
479
|
+
<option value="persistent">常驻</option>
|
|
480
|
+
</select></label>
|
|
481
|
+
</div>
|
|
458
482
|
<p class="hint">浏览器通知的静音策略在「静音管理」中设置。</p>
|
|
459
483
|
</section>
|
|
460
484
|
|
|
@@ -749,7 +773,8 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
749
773
|
channels: ['channels'],
|
|
750
774
|
browser: [
|
|
751
775
|
'browserNotifyEnabled', 'browserNotifyOnReply', 'browserNotifyOnApproval',
|
|
752
|
-
'browserNotifyOnQuestion', '
|
|
776
|
+
'browserNotifyOnQuestion', 'browserNotifyReplyPersistent', 'browserNotifyApprovalPersistent',
|
|
777
|
+
'browserNotifyQuestionPersistent', 'browserNotifySkipForeground',
|
|
753
778
|
'browserNotifyReplyBody', 'browserNotifyApprovalBody', 'browserNotifyQuestionBody',
|
|
754
779
|
'browserNotifyMaxBodyLength',
|
|
755
780
|
],
|
|
@@ -1208,6 +1233,9 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
1208
1233
|
$('browserNotifyOnReply').checked = config.browserNotifyOnReply !== false;
|
|
1209
1234
|
$('browserNotifyOnApproval').checked = config.browserNotifyOnApproval !== false;
|
|
1210
1235
|
$('browserNotifyOnQuestion').checked = config.browserNotifyOnQuestion !== false;
|
|
1236
|
+
$('browserNotifyReplyPersistent').value = config.browserNotifyReplyPersistent === true ? 'persistent' : 'auto';
|
|
1237
|
+
$('browserNotifyApprovalPersistent').value = config.browserNotifyApprovalPersistent !== false ? 'persistent' : 'auto';
|
|
1238
|
+
$('browserNotifyQuestionPersistent').value = config.browserNotifyQuestionPersistent !== false ? 'persistent' : 'auto';
|
|
1211
1239
|
$('browserNotifySkipForeground').checked = config.browserNotifySkipForeground !== false;
|
|
1212
1240
|
$('browserNotifyUsePushMutes').checked = config.browserNotifyUsePushMutes !== false;
|
|
1213
1241
|
$('browserNotifyReplyBody').value = config.browserNotifyReplyBody || '{status} · {summary}';
|
|
@@ -1487,6 +1515,9 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
1487
1515
|
browserNotifyOnReply: $('browserNotifyOnReply').checked,
|
|
1488
1516
|
browserNotifyOnApproval: $('browserNotifyOnApproval').checked,
|
|
1489
1517
|
browserNotifyOnQuestion: $('browserNotifyOnQuestion').checked,
|
|
1518
|
+
browserNotifyReplyPersistent: $('browserNotifyReplyPersistent').value === 'persistent',
|
|
1519
|
+
browserNotifyApprovalPersistent: $('browserNotifyApprovalPersistent').value === 'persistent',
|
|
1520
|
+
browserNotifyQuestionPersistent: $('browserNotifyQuestionPersistent').value === 'persistent',
|
|
1490
1521
|
browserNotifySkipForeground: $('browserNotifySkipForeground').checked,
|
|
1491
1522
|
browserNotifyUsePushMutes: $('browserNotifyUsePushMutes').checked,
|
|
1492
1523
|
browserNotifyReplyBody: $('browserNotifyReplyBody').value,
|
|
@@ -1524,6 +1555,9 @@ export function renderUiPage({ version, embedded = false }) {
|
|
|
1524
1555
|
config: {
|
|
1525
1556
|
browserNotifyEnabled: config.browserNotifyEnabled === true,
|
|
1526
1557
|
browserNotifySkipForeground: config.browserNotifySkipForeground !== false,
|
|
1558
|
+
browserNotifyReplyPersistent: config.browserNotifyReplyPersistent === true,
|
|
1559
|
+
browserNotifyApprovalPersistent: config.browserNotifyApprovalPersistent !== false,
|
|
1560
|
+
browserNotifyQuestionPersistent: config.browserNotifyQuestionPersistent !== false,
|
|
1527
1561
|
},
|
|
1528
1562
|
}, window.location.origin);
|
|
1529
1563
|
} catch (_) { /* optional parent bridge */ }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-bark-push",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Push and browser notifications for DeepSeek Harness: reply summaries, approval requests, and user questions via Bark, Gotify, ntfy, PushDeer, Server酱, PushPlus, extra Bark servers, and generic webhooks, with per-workspace/session mute and independent browser notification settings.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Diana <1072486605@qq.com>",
|