DeepSeek Harness 插件

dsh-grok-build-auth-bridge

Reuse the official Grok Build CLI subscription login in DeepSeek Harness.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
shaomingbo/dsh-grok-build-auth-bridge
最近更新
2026年8月15日
分类
插件开发工具
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/shaomingbo/dsh-grok-build-auth-bridge
插件名:dsh-grok-build-auth-bridge
作者:shaomingbo

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-grok-build-auth-bridge

Reuse the official Grok Build CLI subscription login in DeepSeek Harness (DSH).

This package is a Host Cordis bundle. It reads Grok Build's local session, delegates refresh-token handling to the official grok binary, synchronizes only the short-lived access token into DSH's credential service, and provisions a pi-ai route for the Grok Build subscription proxy.

It does not contain, upload, or commit any token.

Requirements

  • Node.js 22.19 or later
  • DSH with the dsh-llm-pi-ai adapter
  • The official Grok Build CLI installed and logged in:
grok update
grok login
grok models

The login must produce ${GROK_HOME:-~/.grok}/auth.json.

Install

Run this on each device after logging in with Grok Build:

npx --yes github:shaomingbo/dsh-grok-build-auth-bridge#v0.1.0

The installer adds the package and its Cordis bundle to ~/.dsh/profiles/web/package.json, then runs pnpm install. Restart dsh web afterward.

The plugin creates this model route through DSH settings without replacing existing providers:

  • Provider: grok-build
  • Model: grok-4.6
  • Protocol: OpenAI Responses
  • Endpoint: https://cli-chat-proxy.grok.com/v1

How it works

At startup, every ten minutes, and immediately before a grok-build LLM stream:

1. read ${GROK_HOME:-~/.grok}/auth.json; 2. select the first-party xAI OAuth session, excluding plain API-key entries; 3. check expires_at, JWT expiry, or Grok's 30-day fallback lifetime; 4. when near expiry, run the official grok models command and let Grok perform its own locked, race-safe OAuth refresh; 5. re-read the refreshed session and store only its access token as GROK_BUILD_ACCESS_TOKEN in DSH.

Using the official CLI for refresh preserves Grok Build's file-locking, team-principal parameters, refresh-token rotation handling, and sleep/suspend safeguards. The bridge never writes ~/.grok/auth.json itself.

The route sends the subscription proxy headers required by the official client, including X-XAI-Token-Auth, model override, client mode, and the locally installed Grok version from ~/.grok/version.json.

Environment overrides

VariableDefaultPurpose
DSH_GROK_AUTH_PATH${GROK_HOME:-~/.grok}/auth.jsonExact Grok auth file
DSH_GROK_VERSION_PATH${GROK_HOME:-~/.grok}/version.jsonInstalled Grok version metadata
DSH_GROK_BIN${GROK_HOME:-~/.grok}/bin/grokOfficial CLI executable
DSH_GROK_AUTH_SCOPEauto-detectedExact auth.json scope for multiple-session files
DSH_GROK_CREDENTIAL_REFGROK_BUILD_ACCESS_TOKENDSH credential reference
DSH_GROK_PROVIDER_IDgrok-buildDSH provider route ID
DSH_GROK_CLIENT_VERSIONversion.json value; fallback 1.0.3Proxy version header override
DSH_GROK_REFRESH_MARGIN_MS300000Refresh margin before expiry
DSH_GROK_SYNC_INTERVAL_MS600000Background synchronization interval

If you override the provider ID or credential reference after the route has already been created, update or remove the old route in DSH's Models settings.

Security notes

  • ~/.grok/auth.json contains a refresh token. The bridge refuses to read it on Unix if group or other users have access; use chmod 600 ~/.grok/auth.json.
  • Only the short-lived access token is copied to $DSH_HOME/.credentials.yaml through the normal DSH credential service.
  • The plugin never logs credential values or sends the refresh token anywhere.
  • If GROK_BUILD_ACCESS_TOKEN is exported in the parent environment, it shadows DSH's writable credential store. Unset it before starting DSH.

Current model scope

The proxy requires x-grok-model-override at the provider-header level, while DSH provider headers are shared by every model on that route. Version 0.1.0 therefore exposes one verified route, grok-4.6. Additional Grok models can be added as separate provider routes in later releases.

Development

npm install
npm test
npm run check

The primary-source research behind the bridge is in [docs/research.md](docs/research.md).

License

MIT