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-oncall

v0.6.0

Published

Transparent cross-provider failover for DSH Agent main requests: named fallback chains, per-session chain choice, per-route retry overrides.

Readme


功能

  • 按会话选命名链 —— 多条降级链,各自有候选、失败切换规则和预算;直接在 composer 的 chip 里选,不另设会话管理页。
  • 每路由重试次数覆盖 —— 会话可以覆盖某条路由的重试次数:0 = 这条路由不重试,空 = 跟随链。
  • 重试由插件执行 —— switchOn 勾选的失败码,填几次就是几次(不受 provider 重试策略封顶);没勾的仍交给 DSH 的 llm-retry。
  • 立即切换白名单 —— 密钥失效、额度用尽、请求被拒这类"重试注定一样"的失败,不占重试次数、直接切下一条候选;其余失败仍按次数重试。默认名单就是这三个,可在「重试与轮次」里增删。
  • 发起前预校验 —— 每个候选在真实调用前走 ctx.llm.resolveCallConfig(),不能服务的候选直接跳过,不白烧一次调用。
  • 条件路由 —— 按候选的 images / minContextTokens 条件,以及按失败码的 switchOn。
  • 渠道健康工作台 —— 零 Token 的被动延迟与吞吐、按需的 1-token 探测、按路由/按渠道的熔断,以及从 durable 会话日志折叠出的转移历史。
  • 中英双语界面 —— 带未保存修改提示条。
  • 入口(值班) —— 盯一个 GitHub 仓库的 issue,把被授权的要求变成 Case;令牌走环境变量 GITHUB_TOKEN,不落配置。默认关,开启后只建 Case,执行器仍在下一刀。

截图

截图来自隔离实例 + 真实网关;死路由是故意配的。

安装

需要 DSH 0.2.1-rc.3。

dsh plugin add dsh-oncall

从源码安装(包名是 dsh-oncall):

git clone https://github.com/Imzl-zl/dsh-oncall.git
cd dsh-oncall
npm install
npm run bundle --prefix packages/dsh-oncall
dsh plugin --profile web add packages/dsh-oncall

打开侧栏面板列表里的 值班台 配置链。

更新

更新由 DSH 的插件市场(dshmarket)原生处理:在「插件」页打开已安装列表,它会按 npm 上的版本检查并提供 一键更新;有更新时每行还带 更新了什么,内容来自本仓库 GitHub Release 的 notes(即 CHANGELOG.md 的对应小节)。插件不自己启动包管理器,也不复制安装算法。

  • 更新后:新版本第一次打开工作台会弹一次该版本的更新日志;之后点页头的「检查更新」再看(已是最新版时会显示当前版本的说明,离线也能看)。
  • 手动更新(CLI):dsh plugin --profile <profile> remove dsh-oncall,再 dsh plugin --profile <profile> add dsh-oncall@latest。
  • 桌面版:在应用自己的「设置 → 插件」里更新,不要直接改它管理的 profile。
  • 版本记录:CHANGELOG.md。

配置

policyVersion: 2                 # 失败策略版本;插件自己维护,别手改
enabled: true
defaultChainId: default          # 没有单独选链的会话走这条
chains:
  - id: default                  # 稳定 id:会话按它绑定
    name: ""                     # 留空 = 界面显示「默认链」
    candidates:                  # 降级候选;用户当前选中的模型是隐式第一跳
      - { provider: deepseek-official, model: deepseek-v4-flash, maxRetries: 1, needs: { images: false } }
      - { provider: pi-ai-gpt, model: gpt-5, maxRetries: 0, needs: { images: true } }
    switchOn: { rateLimit: true, server: true, timeout: true, transport: true, emptyResponse: true, invalidRequest: true, auth: true, quota: true, other: true }
    immediateSwitch: [auth, quota, invalidRequest]   # 这些码不重试、直接切(键名同上)
    firstHopMaxRetries: 0        # 第一跳首发之后还能重试几次(0 = 失败即降级)
    stickyTurns: 0               # 带图轮之后,继续按识图路由的无图轮数
    strategy: order
  - id: coding
    name: 写代码
    candidates: [...]

policyVersion 缺失的配置会被当成旧版本读一次:emptyResponse/invalidRequest 的 false 与重试次数的 0 是当时的默认值而不是你的选择,会按新默认改写;保存后带标记落盘,之后你的选择(包括刻意填的 0)不再被覆盖。一条降级候选都没有时插件整个不接管——第一跳的重试次数也不生效,由 DSH 自己的重试策略决定。

第一跳永远是你在 DSH 里选中的模型,不在配置里——链只回答「失败之后去哪」。旧的单 chain 配置(以及 2026-10-19 那版的 per-model profiles)在读取时迁成一条命名链,第一次保存写新形状。

入口(值班)

默认关。开启后,插件按 pollSeconds 轮询一个仓库,把被授权的消息变成 Case:

ingress:
  enabled: true
  repository: owner/name          # 只盯一个仓库
  agentLogin: my-bot              # agent 自己的 GitHub 登录名
  allowed: [alice, bob]          # 可以派活的人(GitHub 登录名)
  bots: [ci-bot]                 # 可以产生候选的机器人
  acceptMode: observe             # off / observe / auto;auto 才真干
  pollSeconds: 60

令牌只从环境变量读:GITHUB_TOKEN,不存配置——配置会落进 profile 的 cordis.patch.yml,也会出现在每次打印配置的日志里。

判定规则:人在 issue 里 @ agentLogin、或 issue 指派给 agentLogin,才算候选;陌生人的不点名消息直接拒;observe 只记下本来会做什么。游标回看一分钟,靠 case:<trigger> 幂等,同一事件重读不会开第二个 Case。

现在只建 Case,不执行。 打开入口后你会在日志里看到 oncall: ingress ... opened/observed/refused,但还没有会话被开出来——executor 与回评论是下一刀。

工作原理

插件接管 Agent 循环的两个缝:

  • agent/request(prepend: true)为每次尝试选物理路由。它在 installModelSelection 之外运行,所以用户选的模型永远先试,没有失败就不会切换。
  • agent/request-error(prepend: true,最外层)先看到每次失败:switchOn 里的码,插件自己等一会儿重试,再往前推进;其它码交给 DSH,llm-retry 保留自己的次数与上限。

每次切换都从 durable 会话日志折叠进 oncall/failover-history 投影,在转移历史抽屉里展示。

项目结构

| 路径 | 是什么 | |---|---| | packages/dsh-oncall/src/ | 插件:Host 半包(index.ts、router.ts、bindings.ts、chain.ts…)与浏览器半包(src/client/)。 | | packages/dsh-oncall/tests/ | 11 套:layers(分层守卫)、ingress、github-issue、pass、github-http、ingress-loop、unit、client-controller、remote(进程内生产组合)、handoff-relay(真实 web 组合的接力)、run(真 headless Loader 组合,逐场景)。 | | docs/design/ | 当前设计:路由提案、源码地图、能力边界、按会话选链、发布说明策略。 | | .agents/notes/ | 决策笔记(为什么、否掉了什么、代价是什么)。状态就是目录。 | | spike/ | Phase 1 实证产物,原样保留;不属于包。 |

开发

npm install                                                  # 根目录:DSH CLI 与 peer
npm ci --prefix packages/dsh-oncall --legacy-peer-deps # 包内:tsc、tsdown、typert 生成器
npm run bundle --prefix packages/dsh-oncall           # 构建 lib/(host + client + typert)
npm test                                                     # 四套件

单独跑某一套(组合套可带场景名):

node packages/dsh-oncall/tests/unit.mjs
node packages/dsh-oncall/tests/client-controller.mjs
node packages/dsh-oncall/tests/remote.mjs
node packages/dsh-oncall/tests/run.mjs [scenario]

lib/ 不进 git(在 files 里,npm 会发);改源码后必须先 npm run bundle,浏览器与 Loader 才看得到,组合测试故意加载构建产物。

发布

npm version minor --prefix packages/dsh-oncall   # 0.2.0 → 0.3.0,先不打 tag
# 把 CHANGELOG 的 Unreleased 内容挪到新版本标题下
git add -A && git commit -m "chore(release): 0.3.0"
git tag -a v0.3.0 -m "dsh-oncall 0.3.0" && git push origin master v0.3.0

推 tag 就是发布:

  • .github/workflows/release.yml 校验 tag 与包版本一致、构建 lib/、带 provenance(--provenance,public access)发 npm,并按 CHANGELOG 对应小节建 GitHub Release(scripts/release-notes.mjs)。
  • 认证是 npm trusted publishing(OIDC):npm 包设置里绑定了这个仓库与 workflow,CI 用短期 OIDC token 换发布权限并签名。没有 secret、没有 token 可轮换;npm 账号的 publishing access 设为「必须 2FA、禁止 bypass token」。
  • .github/workflows/ci.yml 在每次 push master 与 PR 跑:构建、host 类型检查、四套件。

版本策略按 CHANGELOG:1.0.0 之前 minor 位是交付里程碑,插件对 DSH 的 peer 范围随之移动。

包名是 dsh-oncall:npm 上的 dsh-oncall 属于别人,所以安装命令、徽章、bundle patch 都用复数名。

限制

  • 只管 Agent 主请求。 压缩与会话标题调用仍走 DSH 自己的配置,不路由。
  • 工具能力不预检。 DSH 没有机器可读的「支持 function calling」元数据;不兼容的候选会在运行时失败,由 switchOn.invalidRequest 处理。
  • 通知是轨迹优先。 切换通知走 durable 日志进「轨迹」;当前 DSH 版本不会在对话里单独渲染上下文行(对话里看到的是模型转述)。
  • fork 不继承会话绑定。 新会话是新 sessionId,绑定按 sessionId 键控,所以 fork 出来回到默认链。
  • 多个 DSH 进程同写一个 home 时,绑定是整文件重写(后写覆盖先写);单进程多会话不受影响。

友情链接

文档

设计理由、源码核实的能力边界与决策记录在 docs/design/;发布历史见 CHANGELOG.md。

许可证

MIT