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-xai-oauth

v0.1.5

Published

xAI (Grok/X subscription) OAuth login plugin for DeepSeek Harness

Readme

dsh-xai-oauth

Native xAI(Grok / X 订阅)OAuth 登录插件 for DeepSeek Harness。

用 SuperGrok 或 X Premium 订阅登录 xAI,不需要 API key。插件完成 xAI 设备码(RFC 8628 device-code)授权,把 access token 注入 DSH 凭据 (XAI_OAUTH_TOKEN),并在 token 接近过期时用 refresh token 自动续期, 让 llm-pi-ai 的 xai provider 路由每次请求都能拿到有效令牌。

安装

从 npm 安装(推荐):

dsh plugin --profile web add dsh-xai-oauth

或从 GitHub 安装:

dsh plugin --profile web add github:tonylee2022/dsh-xai-oauth

本地源码安装(开发调试用):

dsh plugin --profile web add ./dsh-xai-oauth

然后重启 web profile(dsh --profile web)。重启后在 设置 → 模型提供方 旁会出现 xAI(Grok/X) 设置页:点击“登录 xAI”→ 复制用户码 → 点“打开授权页”在 xAI 官方页面登录并批准 → 自动完成授权。

兼容性

  • dsh web / 普通浏览器:页面 origin 是 http://127.0.0.1:<port>。
  • DSH Desktop 0.2.1 起:Web UI 从特权 scheme dsh-app://app 加载,页面 fetch 本机控制服务时带的是这个 origin。0.1.5 起接受该 origin; 更早的版本会因 CORS 预检被拒而在登录时显示 “Failed to fetch”。

原理

  1. 插件向 https://auth.x.ai/oauth2/device/code 申请设备码(客户端 id 与 scope 与 xAI CLI / pi-ai 一致,scope 含 grok-cli:access api:access)。
  2. 轮询 https://auth.x.ai/oauth2/token 直到用户批准,得到 access token + refresh token,原子写入 $DSH_HOME/xai-oauth.json (0600 / 0700)。
  3. 通过 ctx.credentials 把当前 access token 写入 XAI_OAUTH_TOKEN; bundle patch 给 llm-pi-ai 的 xai 路由配置 apiKeyEnv: XAI_OAUTH_TOKEN,每次请求解析最新值。
  4. 每 60 秒检查一次,距过期不足 5 分钟时用 refresh token 续期并重新写入。

配置(可选)

- id: xai-oauth
  config:
    path: /secure/path/xai-oauth.json   # 默认 $DSH_HOME/xai-oauth.json
    controlPort: 1457                    # 本机状态服务端口

安全边界

  • 令牌只保存在 Host 侧文件(owner-only 权限);Web 页面不接触令牌。
  • 本机控制服务只监听 127.0.0.1:1457,仅接受本地 DSH Web origin (http://127.0.0.1:*、http://localhost:*、http://[::1]:*,以及 DSH Desktop 的 dsh-app://app);登出请求带 CSRF token。
  • access token 等效于该订阅的 API 凭据,请勿外泄。

License

MIT