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

@fuxi-ailabs/dsh-provider-auth

v1.1.0

Published

Shared provider/auth resolver for DSH plugins: explicit config, environment variables, and DSH credentials

Readme

@fuxi-ailabs/dsh-provider-auth

DSH 插件共享的 provider/auth resolver。它不直接调用模型,也不保存密钥;只把 “某个消费者应该用哪一组 baseUrl / apiKey / model”按统一优先级解析出来。

为什么单独拆插件

dsh-insight 的评分能力已经有一份 显式配置 → 环境变量 → DSH credentials 的解析逻辑。dsh-audit 需要同样一套规则,但协议和默认值不同:

  • dsh-insight 评分:OpenAI-compatible,默认 https://api.deepseek.com
  • dsh-audit:Anthropic Messages,默认 https://api.deepseek.com/anthropic

共享 resolver 只负责“从哪拿”,协议映射和探活仍留在各自插件。

服务

插件向宿主提供:

ctx.provide('providerAuth', service)

消费方软取:

const auth = ctx.get('providerAuth')

resolve(request)

const resolved = await auth.resolve({
  id: 'sift',
  protocol: 'anthropic-messages',
  explicit: { baseUrl, apiKey, model },
  env: {
    baseUrl: ['DSH_SIFT_BASE_URL', 'ANTHROPIC_BASE_URL'],
    apiKey: ['DSH_SIFT_AUTH_TOKEN', 'ANTHROPIC_AUTH_TOKEN'],
    model: ['DSH_SIFT_MODEL', 'ANTHROPIC_MODEL'],
  },
  dsh: {
    apiKeyRef: 'DEEPSEEK_API_KEY',
    baseUrl: 'https://api.deepseek.com/anthropic',
    model: 'deepseek-chat',
  },
})

优先级:

显式配置
  > 环境变量
  > DSH credentials

describe(request)

返回不包含密钥的状态:

{
  configured: true,
  source: 'dsh-credentials',
  sourceDetail: 'DSH credentials DEEPSEEK_API_KEY (file)',
  maskedKey: 'sk-d…6789',
  note: '来源:DSH credentials DEEPSEEK_API_KEY (file)',
  skipped: []
}

供 /score --probe-provider 和后续独立的环境检查插件使用。

mask(secret)

默认保留前 4 位和后 4 位;短 key 直接返回 ****。

配置

- id: dsh-provider-auth
  name: '@fuxi-ailabs/dsh-provider-auth'
  config:
    allowDshCredentials: true
    maskHead: 4
    maskTail: 4
    providers:
      anthropic-messages:
        baseUrl: https://api.deepseek.com/anthropic
        model: deepseek-chat
        apiKeyRef: DEEPSEEK_API_KEY
      openai-chat:
        baseUrl: https://api.deepseek.com
        model: deepseek-chat
        apiKeyRef: DEEPSEEK_API_KEY

消费插件可以只传协议,不再重复写 endpoint/model/key 引用:

providerAuth.resolve({
  id: 'sift',
  protocol: 'anthropic-messages',
})

解析优先级:

显式请求配置
  > 环境变量
  > providerAuth providers[protocol]
  > 消费方传入的 DSH 兼容模板

边界

  • 不保存密钥;密钥来自配置、环境变量或 DSH credentials 服务
  • 不缓存密钥;每次 resolve() 现取现用
  • 不做协议转换
  • 不负责模型探活
  • 不向 client 暴露 secret
  • 不是 dsh-insight 评分能力 / dsh-audit 的硬依赖;两个消费方应在服务缺席时保留自己的 fallback

开发

npm install
npm test
npm run typecheck
npm run pack