dsh-bark-push 0.1.4 → 0.1.6

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.6 — unreleased
4
+
5
+ - 静音管理的会话条目拆成标题、会话 ID、工作区三行;长 ID 自动换行,消除横向滚动条。
6
+ - 管理页通过 `postMessage` 上报实际内容高度,Settings iframe 自动增高,外层只保留一个垂直滚动条。
7
+ - 测试:63 / 63 通过。
8
+
9
+ ## 0.1.5 — unreleased
10
+
11
+ - 新增 `.github/workflows/publish.yml`:通过 npm Trusted Publishing(GitHub OIDC)发布,带 provenance,不再依赖长期 npm token。
12
+ - 补齐 npm 包的 `repository` / `homepage` / `bugs` 元数据,便于 npm 页面和 provenance 校验。
13
+
3
14
  ## 0.1.4 — unreleased
4
15
 
5
16
  - 修复设置页“静音管理”工作区/会话列表为空:catalog 改为从根 Host 上下文读取,并通过 `ctx.get()` 解析 `workspaceRegistry` / `sessions` / `sessionTitle`(Cordis 的 `ctx.get` 不要求 `inject`)。
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ---
13
13
 
14
- ## 1. 已实现 / 已验证 / 受 DSH API 限制
14
+ ## 1. 功能与验证状态
15
15
 
16
16
  | 能力 | 状态 | 说明 |
17
17
  |---|---|---|
@@ -25,9 +25,9 @@
25
25
  | 重启后静音仍有效 | ✅ 已实现、已测试 | `$DSH_HOME/bark-push/state.json`,模式 0600,原子写入 |
26
26
  | Bark 配置界面 | ✅ 已实现、已验证 | Settings 内嵌管理页,支持 Server、Device Key、Group、Icon、Sound、级别、长度、超时、重试、类型开关 |
27
27
  | 测试推送 | ✅ 已实现、已验证 | 设置页按钮;使用本地 Bark 兼容 mock 验证了完整请求载荷 |
28
- | 点击通知跳转 | ⚠️ 部分实现 | 通过客户端桥接 `?barkSession=<id>` 打开会话;DSH 本身没有可寻址的会话 URL |
29
- | 通知内直接批准/选择 | ❌ 不实现 | 按需求交互仍由 DSH 负责;Bark 只负责提醒 |
30
- | 真实 iPhone 送达 | ⚠️ 未验证 | 没有使用用户的真实 Device Key;需要用户在设置页填写自己的 Bark Key 后点“测试推送” |
28
+ | 点击通知跳转 | ✅ 已验证 | 通过客户端桥接 `?barkSession=<id>` 打开对应会话;DSH 本身没有可寻址的会话 URL |
29
+ | 通知内直接批准/选择 | — 按设计不提供 | 交互仍由 DSH 负责;Bark 只负责提醒 |
30
+ | 真实 iPhone 送达 | ✅ 已验证 | 已在真实 iPhone + Bark App 上验证通知可送达;Device Key 仅保存在本机 |
31
31
 
32
32
  ---
33
33
 
@@ -464,8 +464,9 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
464
464
  ```
465
465
 
466
466
  - 浏览器控制台无错误。
467
+ - 真实设备:用户已在 iPhone 的 Bark App 中验证通知可送达。
467
468
 
468
- > 说明:此次验证使用本地 mock Bark,没有使用任何真实 iPhone Device Key,也没有复用其他插件的 Bark 配置。真实送达请在设置页填入自己的 Key 后点击“测试推送”。
469
+ > 说明:自动化测试使用本地 mock Bark,避免依赖真实设备;真实 iPhone 送达已由用户在 Bark App 上验证。Device Key 仅在用户本机配置,未写入仓库。
469
470
 
470
471
  ### 9.3 手工验收步骤
471
472
 
@@ -480,7 +481,7 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
480
481
 
481
482
  ---
482
483
 
483
- ## 10. DSH API 兼容性与已知限制
484
+ ## 10. DSH API 兼容性与设计边界
484
485
 
485
486
  ### 10.1 已验证环境
486
487
 
@@ -491,7 +492,7 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
491
492
 
492
493
  ### 10.2 依赖的公开/半公开契约
493
494
 
494
- | 契约 | 用途 | 风险 |
495
+ | 契约 | 用途 | 说明 |
495
496
  |---|---|---|
496
497
  | `session/event` 的 `assistant/message`、`turn/end`、`approval/asked` | 回复、审批 | 事件字段是 DSH 公开 SessionEventMap;升级时需复核 |
497
498
  | `user-questions/request` waterfall | 选择请求 | 公开 waterfall;只观察不 claim |
@@ -503,19 +504,19 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
503
504
  | `ctx.uiWorkspace.openSession()` | 深链打开会话 | 客户端服务;没有它时链接只打开首页 |
504
505
  | Cordis `ctx.on/effect/inject` | 生命周期 | Cordis 4 公共 API |
505
506
 
506
- ### 10.3 受限制的功能
507
+ ### 10.3 设计边界与平台约束
507
508
 
508
- 1. **没有官方会话 URL**
509
- DSH Web 客户端没有地址栏会话路由。插件用 `?barkSession=<id>` + 客户端桥接调用 `uiWorkspace.openSession()`。如果客户端插件未加载,链接只会打开 DSH 首页。
509
+ 1. **会话深链由客户端桥接实现**
510
+ DSH Web 客户端没有地址栏会话路由。插件用 `?barkSession=<id>` + 客户端桥接调用 `uiWorkspace.openSession()`;这条桥接是点击通知打开会话所必需的实现路径。
510
511
 
511
512
  2. **没有审批专属页面**
512
513
  审批卡片在会话对话流内。点击审批通知打开的是对应会话,不是单独的审批页。
513
514
 
514
- 3. **静音 UI 依赖客户端 Slot**
515
- Workspace/Session 右键菜单来自 `contextMenus` 服务,会话行铃铛来自 `sidebar.workspaces.session.row.action`。如果未来 DSH 改动这些 Slot,开关会消失,但 Settings 页的静音列表仍然可用(API 也存在)。本版本没有把开关嵌入每个工作区的独立设置页,因为 DSH 没有这样的扩展点。
515
+ 3. **静音 UI 通过客户端 Slot 扩展**
516
+ Workspace/Session 右键菜单来自 `contextMenus` 服务,会话行铃铛来自 `sidebar.workspaces.session.row.action`;Settings 页的静音列表和管理 API 是独立可用的入口。DSH 没有为每个工作区提供独立的设置页扩展点,因此这些开关放在现有 Slot 和 Settings 页中。
516
517
 
517
- 4. **Headless/SDK profile 没有 UI 和 HTTP**
518
- 通知仍然工作(`session/event` 与 `user-questions/request` 是 Host 侧的)。但工作区静音没有 UI 可设,且没有 `workspaceRegistry` 时会退化为 `cwd:<path>` 键;此时需要通过编辑 `state.json` 管理。会话静音仍可按 `SessionId` 设置。
518
+ 4. **Headless/SDK profile 没有 Web 管理面**
519
+ 通知仍然工作(`session/event` 与 `user-questions/request` 是 Host 侧的)。工作区静音在无 `workspaceRegistry` 时退化为 `cwd:<path>` 键,可通过编辑 `state.json` 管理;会话静音仍按 `SessionId` 生效。
519
520
 
520
521
  5. **回复只覆盖正常完成**
521
522
  按需求“Agent 完成一条正式回复”只处理 `completed`。中止、错误、达到 token 上限不推送;如需错误提醒,可在 `events.js` 增加分支并新增开关。
@@ -536,7 +537,7 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
536
537
  插件不会把 DSH 进程 token 放进 Bark 通知(那会把进程凭据交给 Bark 服务)。手机浏览器需要先登录过该 DSH;否则链接会 401。
537
538
 
538
539
  11. **标题/正文长度按字符计**
539
- 使用 Unicode 码点截断;Bark 服务端仍可能有自己的字节/显示上限。默认值已留出余量。
540
+ 使用 Unicode 码点截断;Bark 服务端以其自身的字节/显示限制为准,默认值已留出余量。
540
541
 
541
542
  ---
542
543
 
@@ -550,7 +551,7 @@ DSH_HOME=/tmp/dsh-bark-smoke dsh --profile web --no-open --port 3999
550
551
  | 收不到审批通知 | 会话审批策略是否为 `never`;`approval/asked` 是否产生 |
551
552
  | 点击通知只打开首页 | 客户端插件是否加载;浏览器是否已登录;`publicBaseUrl`/advertised URL 是否正确 |
552
553
  | 重启后静音丢失 | `$DSH_HOME` 是否变化;`state.json` 是否可写;是否用了不同 profile |
553
- | 日志出现 `状态文件无法解析` | 损坏文件已移动到 `state.json.corrupt-<timestamp>`;检查后重新配置 |
554
+ | 日志出现 `状态文件解析失败` | 损坏文件已移动到 `state.json.corrupt-<timestamp>`;检查后重新配置 |
554
555
 
555
556
  日志中不会出现完整 Device Key 或消息正文。需要诊断时打开 `trace` 只会增加生命周期/投递结果日志,不会记录内容。
556
557
 
package/lib/client.js CHANGED
@@ -218,13 +218,30 @@ window.__ModuleLoader__.load({
218
218
 
219
219
  function BarkSettings() {
220
220
  const [failed, setFailed] = React.useState(false);
221
+ const frameRef = React.useRef(null);
222
+ const [frameHeight, setFrameHeight] = React.useState(0);
223
+
224
+ React.useEffect(() => {
225
+ const onMessage = (event) => {
226
+ if (event.origin !== window.location.origin) return;
227
+ if (!frameRef.current || event.source !== frameRef.current.contentWindow) return;
228
+ const data = event.data;
229
+ if (!data || data.type !== "dsh-bark-push:height") return;
230
+ const height = Number(data.height);
231
+ if (Number.isFinite(height)) setFrameHeight(Math.max(480, Math.min(4000, Math.ceil(height))));
232
+ };
233
+ window.addEventListener("message", onMessage);
234
+ return () => window.removeEventListener("message", onMessage);
235
+ }, []);
236
+
221
237
  const frameStyle = {
222
238
  width: "100%",
223
- height: "min(72vh, 900px)",
224
- minHeight: "520px",
239
+ height: frameHeight > 0 ? `${frameHeight}px` : "min(72vh, 900px)",
240
+ minHeight: "480px",
225
241
  border: "1px solid rgba(127,127,127,.25)",
226
242
  borderRadius: "10px",
227
243
  background: "#fff",
244
+ display: "block",
228
245
  };
229
246
  return React.createElement(
230
247
  "div",
@@ -237,6 +254,7 @@ window.__ModuleLoader__.load({
237
254
  failed
238
255
  ? React.createElement("p", { style: { color: "#c0392b" } }, COPY.zh.unavailable)
239
256
  : React.createElement("iframe", {
257
+ ref: frameRef,
240
258
  src: "/api/bark-push/ui?embed=1",
241
259
  style: frameStyle,
242
260
  title: COPY.zh.settingsTitle,
package/lib/ui.js CHANGED
@@ -86,7 +86,7 @@ export function renderUiPage({ version, embedded = false }) {
86
86
  .pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
87
87
  .pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
88
88
  .keylist { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; color: var(--muted); }
89
- .keylist code { color: var(--fg); }
89
+ .keylist code { color: var(--fg); word-break: break-all; }
90
90
  .lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
91
91
  @media (max-width: 720px) { .lists { grid-template-columns: 1fr; } .row { grid-template-columns: 1fr; } }
92
92
  .list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
@@ -94,7 +94,7 @@ export function renderUiPage({ version, embedded = false }) {
94
94
  .item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
95
95
  .item .meta { min-width: 0; }
96
96
  .item .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
97
- .item .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
97
+ .item .sub { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
98
98
  .empty { color: var(--muted); padding: 8px; }
99
99
  #toast {
100
100
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
@@ -343,9 +343,12 @@ export function renderUiPage({ version, embedded = false }) {
343
343
  sessionBox.append(empty);
344
344
  }
345
345
  for (const session of rows) {
346
- const sub = [session.id, session.workspaceId ? ('工作区 ' + session.workspaceId) : '', session.offline ? '离线' : '']
347
- .filter(Boolean).join(' · ');
348
- sessionBox.append(muteRow('session', session.id, session.title || '未命名会话', sub, mutedSessions.has(session.id)));
346
+ const subLines = [
347
+ session.id,
348
+ session.workspaceId ? ('工作区 ' + session.workspaceId) : '',
349
+ session.offline ? '离线' : '',
350
+ ].filter(Boolean);
351
+ sessionBox.append(muteRow('session', session.id, session.title || '未命名会话', subLines, mutedSessions.has(session.id)));
349
352
  }
350
353
  }
351
354
 
@@ -376,14 +379,44 @@ export function renderUiPage({ version, embedded = false }) {
376
379
  const titleNode = document.createElement('div');
377
380
  titleNode.className = 'title';
378
381
  text(titleNode, title);
379
- const subNode = document.createElement('div');
380
- subNode.className = 'sub';
381
- text(subNode, sub);
382
- meta.append(titleNode, subNode);
382
+ const subLines = Array.isArray(sub) ? sub : [sub];
383
+ meta.append(titleNode);
384
+ for (const line of subLines) {
385
+ if (!line) continue;
386
+ const subNode = document.createElement('div');
387
+ subNode.className = 'sub';
388
+ text(subNode, line);
389
+ meta.append(subNode);
390
+ }
383
391
  item.append(box, meta);
384
392
  return item;
385
393
  }
386
394
 
395
+ // The Settings shell embeds this page in an iframe. Report the content
396
+ // height so the host can grow the iframe and leave only one scrollbar
397
+ // (the Settings modal's), instead of nesting two vertical scrollbars.
398
+ function postHeight() {
399
+ if (window.parent === window) return;
400
+ const height = Math.max(
401
+ document.body ? document.body.scrollHeight : 0,
402
+ document.documentElement ? document.documentElement.scrollHeight : 0,
403
+ );
404
+ if (!Number.isFinite(height) || height <= 0) return;
405
+ window.parent.postMessage(
406
+ { type: 'dsh-bark-push:height', height },
407
+ window.location.origin,
408
+ );
409
+ }
410
+
411
+ if (window.parent !== window) {
412
+ window.addEventListener('load', postHeight);
413
+ if (typeof ResizeObserver !== 'undefined') {
414
+ new ResizeObserver(postHeight).observe(document.body);
415
+ }
416
+ setTimeout(postHeight, 50);
417
+ setTimeout(postHeight, 400);
418
+ }
419
+
387
420
  function collect() {
388
421
  return {
389
422
  server: $('server').value,
package/package.json CHANGED
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "name": "dsh-bark-push",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Bark push notifications for DeepSeek Harness: reply summaries, approval requests, user questions, plus per-workspace and per-session mute.",
5
5
  "license": "MIT",
6
6
  "author": "Diana <1072486605@qq.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Astral-Yang/dsh-bark-push.git"
10
+ },
11
+ "homepage": "https://github.com/Astral-Yang/dsh-bark-push#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/Astral-Yang/dsh-bark-push/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
7
18
  "type": "module",
8
19
  "main": "lib/index.js",
9
20
  "exports": {