npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-task-notifier

v1.1.0

Published

DeepSeek Harness web profile bundle: notifies the user when any session task completes, via browser Notification + cross-platform host toast.

Readme

dsh-task-notifier

DeepSeek Harness web profile bundle:当任意会话(Agent)的任务完成时,通过 浏览器通知 + Windows 托盘通知 提醒你,即使页面没有打开也能收到提醒。

这是一个独立发布的 npm 组合包(bundle),通过 pnpm 安装进 web profile 的 node_modules,与官方 dsh-better-sidebar、dsh-subagent-codex 相同的标准形态:

  • 声明 dsh.bundle.patch → 安装后自动加入 profile 的组合层栈;
  • 声明 dsh.client(platform web)→ 浏览器端由 client module system 自动加载;
  • 含 node half(Host 端)与 browser half(Client 端)两端。

功能

  • ✅ 任意会话任务完成即提醒(running → idle 转换)。
  • ✅ 浏览器 Notification:WebUI 打开时,通过 Web Notification API 弹出系统通知。
  • ✅ 跨平台 Host 通知:Host 端监听 agent/status,默认用 node-notifier(Windows / macOS / Linux)弹出系统通知,即使没有浏览器页面也生效。
  • ✅ Windows 托盘兜底(可选):notifier: 'powershell' 或 auto 失败时用 PowerShell System.Windows.Forms.NotifyIcon 弹托盘气泡。
  • ✅ 会话自己的 displayTitle 显示在通知正文中。

安装

# 在 DeepSeek Harness 环境中(或直接对 web profile)
dsh plugin --profile web add dsh-task-notifier

或者手动用 pnpm 装进 profile 的 node_modules 并重启 profile:

cd "$HOME/.dsh/profiles/web"
pnpm add dsh-task-notifier
# 然后重启该 profile(或在 cordis.patch.yml 里手动挂载)

dsh plugin 会在看到包的 dsh.bundle.patch 声明后,自动把 dsh-task-notifier 追加到 dsh.profile.bundles 组合层栈;重启 profile 后生效。


工作原理

任务完成判定

  • Host half 监听 agent/status,当某 Agent running → idle 时判定其会话任务完成。
  • Browser half 订阅 ctx.sessions.list,当某会话记录从 running 翻转为非 running 时判定完成。

浏览器通知(browser half)

订阅会话列表 observable,检测到 running → idle 边时调用:

new Notification('DeepSeek Harness', {
  body: '会话任务已完成: ' + session.displayTitle,
  tag: 'dsh-task-notifier:<sessionId>',
})

仅当浏览器 Notification.permission === 'granted' 时显示。

Host 通知(node half)

Host 半侧在任务完成时展示系统通知,后端由 notifier 配置选择:

  • node-notifier(默认):跨平台,经 node-notifier 包调用各平台原生通知(Windows Toaster、macOS terminal-notifier、Linux notify-send);
  • powershell:仅 Windows,隐藏启动 powershell.exe,用 System.Windows.Forms.NotifyIcon 弹托盘气泡;
  • auto(默认值):先尝试 node-notifier,在 Windows 上失败时回退到 PowerShell 兜底。

PowerShell 后端通过 ctx.subprocess 隐藏启动,标题/正文经 TOAST_TITLE/TOAST_BODY 环境变量传入,避免注入:

Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$ni = New-Object System.Windows.Forms.NotifyIcon
$ni.Icon = [System.Drawing.SystemIcons]::Information
$ni.Visible = $true
$ni.BalloonTipTitle = $env:TOAST_TITLE
$ni.BalloonTipText = $env:TOAST_BODY
$ni.ShowBalloonTip(5000)
for ($i = 0; $i -lt 20; $i++) {
  [System.Windows.Forms.Application]::DoEvents()
  Start-Sleep -Milliseconds 150
}
$ni.Visible = $false
$ni.Dispose()

配置

notifier 后端选择在 cordis 插件行上的 config.notifier 中设置(默认 auto):

# cordis.patch.yml 中挂载该插件时,在插件行上添加 config
- insert:
    - id: dsh-task-notifier
      name: dsh-task-notifier
      # config:
      #   notifier: auto          # 默认:node-notifier,Windows 失败回退 PowerShell
      #   notifier: node-notifier # 只跨平台,绝不使用 PowerShell 兜底
      #   notifier: powershell    # 只 Windows 托盘气泡

不设置任何配置即用默认 auto。


项目结构

dsh-task-notifier/
├── src/
│   ├── index.ts           # node half(Host 端:agent/status → 跨平台通知/Windows 兜底)
│   ├── types.d.ts         # 本地 Ctx 类型
│   └── client/index.ts    # browser half(Client 端:会话完成 → 浏览器通知)
├── lib/                   # 构建产物(index.js / client.js / types)
├── scripts/build.mjs      # tsc 编译 + 浏览器闭包封装
├── test/
│   ├── browser-half.mjs   # 浏览器半侧行为测试(running→idle 触发通知)
│   ├── node-half.mjs      # node 半侧测试(powershell 兜底降级 + node-notifier 路径)
│   └── notify.ps1         # 独立的 Windows 通知脚本(手动验证)
├── cordis.patch.yml       # dsh.bundle.patch 组合层(挂载插件行)
├── package.json
└── README.md

构建

pnpm install
pnpm build   # -> lib/index.js + lib/client.js(tsc 编译并封装浏览器闭包)
node test/browser-half.mjs  # 浏览器半侧行为测试
node test/node-half.mjs     # node 半侧测试

发布

手动发布

pnpm publish --access public   # 或 pnpm pack 产出 tarball

自动发布(GitHub Actions,OIDC)

仓库已配置 .github/workflows/publish.yml:当推送版本标签 vX.Y.Z 且与 package.json 的 version 一致、且该版本尚未发布时,CI 自动构建、测试并 npm publish --provenance。

发布走 npm OIDC(可信发布者):工作流请求 id-token,npm 用它兑换短期发布令牌——无需在 GitHub 存储任何长效 npm token。

一次性设置(在 npm 网站):

  1. 登录 npmjs.com → 头像 → Access Tokens → Generate New Token → 选择 Publish(OIDC)。
  2. 绑定你的 GitHub 仓库与工作流:填 MoRanYue/dsh-task-notifier,environment 留空或选 publish,并确保 workflow 引用 publish.yml(与上面文件一致)。

此后发布新版本(本地已授权发布者,无 token 交互):

# 先改 package.json 的 version,再提交并打标签
git tag v1.1.0
git push origin master
git push origin v1.1.0

工作流会校验 tag 版本与 package.json 一致;已存在的版本会安全跳过,不会报错。


已知限制

  • node-notifier 需要各平台的通知机制可用:macOS 依赖 terminal-notifier、Linux 依赖 notify-send、Windows 依赖行动中心;在无图形会话的机器上可能失败(auto 模式在 Windows 上会自动回退到 PowerShell 托盘)。
  • PowerShell 托盘兜底需要通过 subprocess 服务执行 powershell.exe,仅 Windows 生效。
  • 浏览器通知需要用户授权(Notification.requestPermission);未授权时依赖 node half 通知。