dsh-proxy-identity: Attach a Fixed Identity Header to DSH Requests

Introduction

When using a shared model gateway or a memory agent, if the gateway identifies the caller based on custom request headers (e.g., x-team-id, x-agent-id) and responds with an interactive selector when the headers are missing, this can cause the same picker to pop up repeatedly for clients without a UI or that frequently open new sessions, and may even prevent responses from being returned.

DeepSeek Harness provides a plugin-based extension mechanism. The goal of this plugin is to: define identity headers in configuration, automatically attach those headers to every model request, and allow the gateway to identify the client directly without relying on interactive selection.

Plugin Overview

  • Purpose: A DSH plugin that attaches fixed identity headers to model requests.
  • Maintainer: xiaoxi-kobo.
  • Category: Model inference.
  • Core value: In shared gateway / memory agent scenarios, eliminates interactive identity selection and ensures the DSH client consistently carries identity information.

Key Features

  1. Attaches configured headers to model requests whose URL matches the criteria. The matching condition is defined by the match field and supports string inclusion or regex matching.
  2. Non-matching requests are forwarded as-is, preserving all parameters passed by the caller.
  3. Only sets values for headers that are absent in the configuration; it never overwrites headers already set by the caller.
  4. Installs a single wrapper per process and restores the original fetch upon unregistration, regardless of how many times the plugin is mounted.
  5. Does not log the content of header values.

Installation & Activation

Using the web profile as an example:

dsh plugin --profile web add github:xiaoxi-kobo/dsh-proxy-identity

Configuration file location: ~/.dsh/profiles/web/cordis.patch.yml. Since the patch replaces the entire config line, all items that need to be configured must be re-listed:

- id: proxy-identity
  config:
    match:
      - https://gateway.example.com/dsh/
    headers:
      x-team-id: team-0000000000
      x-agent-id: agt-0000000000

Before starting, you can use dsh --profile web --dump-config to inspect the merged configuration and confirm the plugin is active. To remove the plugin, use:

dsh plugin --profile web remove dsh-proxy-identity

Configuration Reference

Key Type Description
match string | array of (string | RegExp) Triggers header injection when the request URL contains a given string or matches a given RegExp. Required.
headers object of string to string The header names and values to attach. Non-string values are ignored with a warning. Required.

Rules take effect in mount order. When a single request matches multiple rules, the headers are merged (union). Headers that already exist are not overwritten.

Limitations & Notes

  • The plugin works by patching globalThis.fetch, which is the invocation method used by the DeepSeek adapter. The modification is process-level and may affect other code in the same process that uses fetch.
  • For requests whose Request body has already been consumed, the request is forwarded as-is without raising an error.
  • Header values are stored in plaintext in the profile patch file. This plugin is suitable only for identity identifiers and should not be used to store secrets or credentials.

Use Cases

  • Infrastructure that identifies callers via request headers, such as team-shared gateways, agent-scoped gateways, and memory agents.
  • Teams that want to manage identity centrally in configuration and avoid interactive selection on every request.
  • Gateways using DSH that need to conform to a custom header convention.

Conclusion

By defining identity headers in configuration and automatically attaching them to model requests, this plugin enables shared gateways to identify DSH clients directly, reducing the UX friction caused by interactive selection.

  • Directory page: https://www.skillhub.cn/plugins/xiaoxi-kobo/dsh-proxy-identity
  • GitHub: https://github.com/xiaoxi-kobo/dsh-proxy-identity
羽毛球分组比赛记分
小程序二维码

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

Xiaoye