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

v1.5.3

Published

DeepSeek Harness 插件:在 DSH 设置页一键完成广东移动 MaaS(cmtoken)的 OAuth 2.0 Device Grant + PKCE 认证,自动发现模型并写入 llm-pi-ai provider 配置(视觉模型自动声明图片输入模态);粘贴识图让纯文本模型直接收图(Qwen3.8 / Qwen3.x / Kimi K2.x / MiniMax M3 自动识读),另有 cmtoken_read_image 工具与可选的 cmtoken-vision 包装路由;凭据安全保存并自

Readme

dsh-cmtoken-oauth

DeepSeek Harness(DSH)插件:在 DSH 设置页内一键认证广东移动 MaaS(cmtoken),自动发现并接入模型,无需手动填写 API Key 或模型列表。

功能

  • 一键认证:基于 OAuth 2.0 Device Authorization Grant(RFC 8628)+ PKCE (S256),扫码或输入用户码即可完成,无需配置脚本。
  • 内联二维码:认证流程内置 QR 生成(零依赖),无需额外安装二维码工具。
  • 自动发现模型:认证成功后自动拉取可用模型列表,写入 llm-pi-aiproviders.cmtoken 配置(merge,不影响其他 provider)。
  • 原生视觉:视觉模型(Qwen3.8 27B / Qwen3.x / Kimi K2.x 非 code / MiniMax M3)写入配置时自动声明 input: ["text","image"] 模态,DSH 直接放行图片输入(经持久附件服务直达模型),粘贴/拖入图片即可用。
  • 粘贴/拖图(普通模型直接收图):纯文本模型(如 deepseekv4-flash)贴图/拖图时,client 端拦截并把图片(自动压缩到 ~1080p:长边 ≤1920)存到 ~/.dsh/cmtoken-pastes/——输入框和会话气泡不出现路径文本:输入框上方显示「cmtoken识图」胶囊缩略图条(与输入卡片左对齐,✕ 可撤回),发送时刻由 host 的 agent/pre-step 钩子把 [Image: 路径] 追加到最后一条用户消息(仅模型上下文可见)。识图延迟到模型按需调用 cmtoken_read_image 工具时完成;粘贴后 30 分钟内未随消息发出的图片自动放弃注入。视觉模型不接管,保留原生缩略图体验。
  • 视觉回退模型可选:设置 → cmtoken 认证页可指定识图引擎(默认「自动」按优先级 qwen38 > qwen3.x > kimi k2.x 非 code > minimax-m3),选择持久化在 ~/.dsh/cmtoken-oauth.json,工具与判定路由均遵循。
  • 视觉回退工具:注册 cmtoken_read_image 工具——任何模型把图片路径(本地路径或 http(s) URL)交给工具,host 侧自动选用优先级最高的视觉模型识图,返回结构化取证(概述 / 全文转写 / 版面 / 语义 / 不确定项)。无需外部识图服务,凭据与配额都在 cmtoken 体系内。
  • 可选包装路由(默认关闭):profile 插件 config 设 visionRoute: true 可注册 cmtoken-vision 分组——把纯文本模型镜像成声明图片输入的条目,贴图以真实图片气泡进入会话、请求时自动转证据文本。需要图片气泡原样展示的会话可开启。
  • 自动配置上下文:按模型名称关键词自动匹配各模型的上下文与最大输出长度(DeepSeek V4 / MiniMax M3 / Qwen / GLM / Kimi / MiniMax 2.x / hy 等),无需手动填写。
  • 安全存储:token 存入 DSH 凭据服务(OS keyring / env),不落盘明文。
  • 自动续期 / 注销:令牌临近过期自动 refresh;可随时注销清空凭据。
  • 订购算力豆套餐:设置页内一键跳转广东移动 H5 订购页,直达算力豆套餐购买。

零第三方运行时依赖(仅使用 Node 内置模块)。

安装

在 DSH profile 目录(默认 ~/.dsh/profiles/web)执行:

# npm 安装
dsh plugin --profile web add dsh-cmtoken-oauth

# 或从 GitHub 仓库安装(若已发布到 GitHub)
dsh plugin --profile web add github:your-username/dsh-cmtoken-oauth

dsh plugin add 会自动:

  1. 安装依赖;
  2. 根据 dsh.bundle.patch 声明,自动加入 profile 的 dsh.profile.bundles
  3. 重启 dsh web 后生效。

使用

  1. 打开 DSH Web → 设置(左下角齿轮)→ 左侧导航选择「cmtoken 认证」。
  2. 点击「开始一键认证」→ 用手机扫描二维码(或打开链接输入用户码),在广东移动 IDaaS 页面确认授权。
  3. 插件自动完成:发现模型 → 按名称配置各模型上下文 → 写入 llm-pi-ai.providers.cmtoken → 保存凭据。
  4. 套餐不足时,点设置页里的「订购算力豆套餐」跳转到广东移动 H5 订购页购买。
  5. 在 DSH 的模型选择器中选择 cmtoken 模型即可使用。
  6. 视觉,日常零配置:任何 cmtoken 模型直接粘贴/拖入图片——视觉模型(Qwen3.8 / Qwen3.x / Kimi K2.x / MiniMax M3)原生收图;纯文本模型贴图时出现「cmtoken识图」胶囊缩略图条,发送后模型自动经视觉模型识读。也可在任何模型下把图片路径给助手调用 cmtoken_read_image 工具。

数据与配置

| 项目 | 说明 | |---|---| | 授权服务器 | https://agentlink.idaas.cmpassport.com/oauth2-service | | 设备码 / 令牌端点 | POST /oauth/device/codePOST /oauth/device/token | | 模型发现端点 | GET https://maas.gd.chinamobile.com:36007/ai/uifm/open/v1/models | | 凭据引用 | CMTOKEN_API_KEY / CMTOKEN_REFRESH_TOKEN / CMTOKEN_EXPIRES | | 写配置 | llm-pi-ai 设置 namespace 的 providers.cmtoken(merge,不覆盖其他 provider) | | 视觉模态 | 模型写入时声明 input:qwen38 / qwen3.x / kimi k2.x(非 code)/ minimax-m3 → ["text","image"],其余 ["text"] | | 粘贴转路径 | GET/POST /cmtoken-oauth/paste(client 拦截纯文本模型贴图/拖图,压缩到 ~1080p 后落盘 ~/.dsh/cmtoken-pastes/ 返回路径;7 天自动清理) | | 视觉回退模型 | 设置页选择,持久化 ~/.dsh/cmtoken-oauth.jsonvisionModel,null = 自动) | | 视觉优先级 | qwen38 > qwen3.x > kimi k2.x(非 code)> minimax-m3;识图走 {baseURL}/chat/completions | | 视觉回退工具 | cmtoken_read_image 工具;输入本地路径或 http(s) URL | | 包装路由(可选) | config visionRoute: true 启用 cmtoken-vision 分组(默认关闭) |

开发

lib/index.js    host:OAuth 核心(PKCE / 设备码 / 轮询 / 刷新 / 模型发现)+ RPC + 粘贴识图路由 + cmtoken_read_image 工具 + 可选 cmtoken-vision 包装路由
lib/client.js   web:设置页「cmtoken 认证」向导(视觉模型标 👁)+ 粘贴识图拦截
lib/qr-core.cjs 内联 QR 编码器(输出 SVG)

变更记录

1.5.3(2026-09-11)

  • 修复 DSH 0.1.5+(desktop 0.1.5-rc.1 起)下插件树加载失败: cannot get property "webServer" without inject
  • 根因:新版 connection.rpc.handle(channel, handler) 在注册时执行 owner.webServer.register(route),而 owner 恒为 connection 插件自身的 ctx (其 inject 只有 credentials),第三方插件调用必然抛错。
  • 改法:在 ctx.inject(['webServer']) 子上下文用 ctx.webServer.register({ kind: 'prefix', path: '/cmtoken-oauth', handler }) 自注册 RPC 前缀路由,并沿用 connection 的 client-request / server-response 信封协议,客户端代码无需改动; 另加 loopback 来源校验。

License

MIT