yueyexiayu/dsh-oauth: DSH Official OAuth Login Plugin

DeepSeek Harness (DSH) adopts a plugin-based architecture, allowing developers to extend functionality. Developers often need to connect to Grok or ChatGPT Codex. Directly calling official APIs or manually managing tokens can be cumbersome. This plugin integrates the official OAuth flow, embedding login status and device code interactions directly below the input box in the DSH desktop client.

Plugin Introduction

This plugin is maintained by yueyexiayu. It provides official OAuth login capabilities for the DSH desktop client, supporting both xAI and ChatGPT Codex device codes. The login status is displayed below the input box. Tokens are saved solely in the Host-side $DSH_HOME/.credentials.yaml file and do not enter the rendering process or conversation context.

Core Features

  • Login Status & Operations: Displays Grok / GPT login status and supports account switching, logout, and manual refresh within the lock.
  • Official OAuth Integration: Login formally calls the official authorization.begin interface. The registered llm-pi-ai flow handles protocol implementations such as device codes, polling, and PKCE.
  • Secure Token Storage: Tokens are written only to the Host’s $DSH_HOME/.credentials.yaml (llm-pi-ai/xai, llm-pi-ai/openai-codex); it does not read or rewrite system-level ~/.grok/auth.json / ~/.codex/auth.json.
  • Session & Routing Management: The current session model is read via the official sessionQuery.observeSession. Routing writes include a configuration version number to handle concurrent modifications. The Client subscription slot uses useProjection("modelSelection").
  • Error Handling: Explicitly invalid sessionIds return 400, non-existent sessions return 404, and mismatches return 409. Network, HTTP, JSON, business logic, and persistence failures are all explicitly displayed.

Installation & Activation

  1. Copy the plugin file to $DSH_HOME/plugins/OAuth.
  2. Write the following content to $DSH_HOME/profiles/desktop/cordis.patch.yml:
- insert:
    - id: OAuth
      name: ../../plugins/OAuth/lib/index.js
  1. Fully quit DeepSeek Harness (macOS: ⌘Q) and reopen it.

Usage Instructions

  • Grok / GPT login buttons will appear below the input box.
  • Model routes configured with apiKeyEnv will clearly display “Model uses API key; logging out of OAuth does not affect this authentication”.
  • Login or manual refresh will supplement missing routes via the official settings.describe/mutate interface.
  • After modifying plugin code, you must fully quit the desktop application (⌘Q) and reopen it for changes to take effect.

Notes

  • Permission Requirements: Grok requires SuperGrok / X Premium; GPT requires ChatGPT Plus / Pro Codex permissions.
  • Token Location: Tokens are stored only on the Host side and will not leak into the plugin or rendering process.
  • Restart Required: After modifying the plugin, you must fully quit the desktop application (⌘Q) and reopen it.
  • Test Environment: Component testing and browser checks under mocked responses cannot replace actual login acceptance testing after a full restart of the desktop client.
  • Security Statement: The repository does not contain accounts or credentials; the credential provider is merely an in-memory FIFO queue (in tests).
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye