dsh-calendar
Verified@necokeine/dsh-calendar · v0.1.1 · MIT · Web UI
Session-interaction calendar plugin for DeepSeek Harness: a root-scope calendar surface aggregating every session's interaction events across the harness
Install
dsh plugin add @necokeine/dsh-calendar Confirm the layer applied with dsh --profile default --dump-config — see the install guide.
Source
Creators
Readme
dsh-calendar
面向 DeepSeek Harness 的会话交互日历插件:一个根作用域的日历界面,展示整个 harness 中所有 session 的交互事件。侧边栏底部入口打开全视口月视图;每个日期格带当天交互数的徽标,选中某天列出其事件(时间、事件类型、session id、一行摘要)。实时 append 的事件会即时流入已打开的日历。
English | 中文
特性
- 全 harness 视图 —— 一个日历覆盖所有 session(用户消息、助手回复、工具调用、回合边界),而不仅是当前会话。
- 实时 —— host 端 SSE 通道在事件 append 的瞬间推送到已打开的日历。
- 历史回填 —— 启动时灌入已存活的 sessions,并通过
sessionPersistence尽力读取持久化日志。 - 可扩展 —— 未知(插件合并的)事件类型回退到类型名;无需维护按类型的注册表。
- 内存有界 —— 滚动 90 天窗口,每天上限 2000 条事件。
安装
插件面向 DeepSeek Harness 的 web 界面(
dsh web)。
用 dsh plugin(会转发给 profile 目录内的 pnpm)把插件装进 profile。本包声明了
dsh.bundle,因此 dsh 会自动把它追加到 profile 的 dsh.profile.bundles 列表:
dsh plugin --profile web add @necokeine/dsh-calendar
重启 dsh web 并刷新页面——侧边栏底部会出现日历入口,并替换
@deepseek-ai/dsh-web-app 内置挂载的 ui-calendar 行(本 bundle 会禁用该行并插入
自己的行,因此只会运行一个日历)。
用下面的命令移除:
dsh plugin --profile web remove @necokeine/dsh-calendar
其他安装方式同样可用:
- 本地源码 ——
dsh plugin --profile web add ./path/to/dsh-calendar(或link:./path/to/dsh-calendar)。 - 打包 tarball —— 先
pnpm pack,再dsh plugin --profile web add ./dsh-calendar-0.1.0.tgz;已预构建lib/,无需构建权限。 - Git 安装 ——
dsh plugin --profile web add github:necokeine/dsh-calendar#<sha>;这会拉取源码(无lib/),pnpm ≥10 会阻止构建,需先在 profile 的pnpm-workspace.yaml的allowBuilds中允许该包,且源码 checkout 需自行产出lib/。
开发
pnpm install
pnpm test # vitest:node half + browser half 数据层 + 组件测试
pnpm build # tsc -b && tsdown → lib/(node half + browser client bundle)
pnpm lint # oxlint(src + tests)
footer-action 的集成测试(在真实
SlotRegistry和 locale 插件上的槽位注册)需要在 DeepSeek Harness checkout 中运行:发布的@deepseek-ai/dsh-client-runtime/dsh-client-localenpm 产物是浏览器格式的 bundle,无法在纯 node/vitest 下加载。这里的独立测试通过本地createSnapshotStorestub(tests/stubs/runtime-client.ts)覆盖同样的代码;集成测试请在 harness monorepo 内运行,那里 workspace 的 tsconfig paths 会把这两个包解析到源码。
本包是像 harness 自带的 dsh-client-hmr 那样的双面包插件:
- Node half(
src/index.ts)—— 注入sessions+webServer的 host 插件。订阅session/event事件流,把每个事件总结为一条简短 wire 记录{ sessionId, seq, time, type, summary }(由 host 生成、中文产品文案),用foldSessionTitle从session/title事件折叠每个 session 的标题,并按 session×天聚合——每天分桶列出每个活跃 session 的CalendarSessionWire(标题、当天时间跨度、事件数,以及展开视图用的原始事件列表)。注册两条路由:GET /calendar/events?from=YYYY-MM-DD&to=YYYY-MM-DD—— 指定本地日期范围内按 session 分桶的 JSON。GET /calendar/stream—— SSE 通道:连接时先发 backlog 帧,之后每次实时 append 发一条event帧(浏览器把它们折叠进对应 session 行)。
- Browser half(
src/client/index.ts)—— 注册sidebar.footer.action条目和calendarlocale 命名空间。CalendarController拥有视图 store(绑定为useCalendar)、按月的/calendar/events请求,以及/calendar/streamEventSource 的生命周期(面板打开时连接、关闭时断开)。月视图显示每天交互总数;日详情区按 session 列出(标题 + 时长 + 事件数),点击展开原始事件列表——展开状态是组件本地状态。
仓库结构
src/
index.ts # node half:聚合器、索引、路由、SSE
events.ts # 共享 wire 协议(两个 half)
invariant.ts # 包的不变量伴侣
client/
index.ts # browser half 入口(footer action 注册)
calendar-controller.ts # store + wire 调用 + SSE 生命周期
CalendarAction.tsx # footer 触发器 + 月视图 + 日详情
calendar-action.module.css
locales.ts # 中英文词典
tests/ # vitest 测试(node half、controller、组件)
tsdown.config.ts # 独立构建(CSS modules 内联 + loader banner)
许可证
MIT