dsh-starbridge-client: Connecting DSH to the StarBridge Gateway

Preface

When building agents or having daily conversations in DSH, model calls typically go through their respective configured providers. If your team has deployed an AI middle platform like StarBridge, you would also need to separately integrate a gateway address and credentials on the DSH side, and distinguish between “tool calls” and “whether the entire conversation round goes through the middle platform”. Below we introduce the community plugin dsh-starbridge-client (maintainer LiHeng99): after installing it in a profile, it provides unified gateway access, address entry or platform account login on the settings page, conversation / feedback / knowledge base related tools, and a Web UI panel. It optionally enables “Model Routing” so that every AI call in DSH goes through the StarBridge OpenAI-compatible surface. The plugin is publicly released and ships without any vendor’s gateway address or credentials.

What This Is

dsh-starbridge-client is a DSH client-side bundle for the StarBridge AI middle platform: it simultaneously provides a host surface (lib/index.js: services, HTTP routes, authentication, tool implementations) and a client surface (lib/client.js: conversation panel, settings page, feedback bar). The division of labor is that the host handles networking, authentication, retries, and stream parsing, while the client only does presentation; the browser does not hold the access token, nor does it directly access the gateway.

Core Features

Access and Credentials

The single recommended entry point is the Web UI “Settings → StarBridge”, which can be completed without manually editing config files:

  1. Enter service address: supports pasting forms such as the service root, /starbridge, /starbridge/gw, /starbridge/gw/v1. The page normalizes and displays both the machine-facing and model-facing addresses.
  2. Choose one of two login methods:
    - Access Key: an Access Key issued by the middle platform, written into the DSH credential store (reference name STARBRIDGE_GATEWAY_API_KEY), and read from the same reference after restart.
    - Platform account: login with console account and password to obtain a platform JWT. When “Remember on this machine” is checked, credentials are AES-256-GCM encrypted and stored on disk ($DSH_HOME/starbridge-gateway-session.enc, etc.), and automatically renewed before expiry.
  3. Model routing switch: when enabled, points the llm-pi-ai starbridge route’s baseURL to <address>/gw/v1, writes the credential into that route’s apiKeyEnv, and switches the default model to starbridge / general; when disabled, it falls back to DSH’s current default provider.

When no gateway is configured, starbridge_* tools return [GATEWAY_NOT_CONFIGURED] and prompt the user to fill in the settings page, rather than only failing in the logs.

Non-secret access information is stored in $DSH_HOME/starbridge-gateway.json; secrets can preferably be injected via environment variables (see “Configuration” below).

Four Host Tools

Tool Purpose
starbridge_chat Send conversation messages (internal streaming), can carry scenario / use_knowledge_base
starbridge_feedback Thumbs up / thumbs down / corrections (including expected answer); local writes are mandatory, cloud forwarding is configurable
starbridge_kb_query Query the knowledge base (when supported by the gateway), returns snippets with citations
starbridge_gateway View status, save address and identity, save access key, platform login, toggle model routing, clear local credentials

Failures that the model can bypass (not logged in, gateway unreachable, etc.) are returned as { ok: false, error }, with error text containing [CODE] and a Hint, making it easy for the model to relay to the user.

Web UI

The client surface registers a conversation panel (streaming + Markdown + code highlighting), settings sections, and a feedback bar. Styling uses DSH design tokens (--dsw-alias-*, etc.), follows light/dark themes, and does not use a separate color scheme.

Model Surface (Optional)

In addition to the tool surface, the bundle layer declares a starbridge manual gateway route (OpenAI Completions API, no hardcoded baseURL) for @deepseek-ai/dsh-llm-pi-ai via cordis.patch.yml. After the user enables model routing on the settings page, every model call—conversations, sub-agents, summaries, title generation, etc.—can go through the middle platform; the model field represents the scenario (e.g. general), and the specific upstream is determined by the middle platform’s routing rules.

Installation and Activation

Install in the target profile (the documentation example uses web):

# One-click install from the plugin marketplace "Settings → Plugin Market", or:
dsh plugin --profile web add dsh-starbridge-client

# Local development: install from a directory (creates a pnpm link inside the profile):
dsh plugin --profile web add ./dsh-starbridge-client

# Check whether the bundle is included in the combination (no need to start the service):
dsh --profile web --dump-config | grep -A 20 starbridge

# Restart the profile
dsh web

dsh plugin add adds the package to the profile dependencies and appends packages that declare dsh.bundle to dsh.profile.bundles; their cordis.patch.yml becomes a layer of the bundle composition.

After installation, no gateway is connected yet: fill in an address once in Settings → StarBridge and complete credentials or login; only then will the tools and (if enabled) model routing become available.

Runtime environment requirements (from the repository’s package.json): Node ^22.19.0 || >=24.0.0; peer dependencies include @deepseek-ai/cordis, @deepseek-ai/dsh-tools, @deepseek-ai/schemastery, etc., provided by the DSH profile bundle.

Configuration Essentials

Deployment parameters are in the Config Schema, all with default values. Besides the settings page, you can also:

  1. Override a single line of configuration in the profile’s $DSH_HOME/profiles/<profile>/cordis.patch.yml;
  2. Inject via environment variables (recommended for secrets): STARBRIDGE_GATEWAY_URL, STARBRIDGE_GATEWAY_API_KEY, STARBRIDGE_OIDC_ISSUER_URL, STARBRIDGE_OIDC_CLIENT_ID, STARBRIDGE_OIDC_CLIENT_SECRET, STARBRIDGE_USER_ID, STARBRIDGE_DEPARTMENT, etc.

Summary of commonly used fields:

Field Default Description
gateway.gatewayUrl '' Gateway base URL; intentionally empty out of the box
gateway.apiKey '' Machine credential; can be overridden by environment variable and settings page
gateway.timeoutMs 30000 Per-request timeout
gateway.maxRetries 2 Retries on transport errors and 5xx
behavior.useKnowledgeBase false Whether to request knowledge base enhancement by default
behavior.forwardFeedback true If false, feedback is kept locally only

If OIDC SSO is enabled, the gateway side must register a Public client + Authorization Code + PKCE, with the callback at http(s)://<dsh-host>/starbridge/api/login/complete (can be specified via STARBRIDGE_REDIRECT_URI).

Typical Usage

Agents Access the Middle Platform via Tools

During conversations, the model can call starbridge_chat to send messages to StarBridge, or use starbridge_kb_query to search the knowledge base; access status and saved configuration can be managed via starbridge_gateway actions such as status / save / use_access_key / login / route_models (specific parameters are in the repository README’s “Tools” section).

Whole Profile Model Calls Go Through StarBridge

After completing the address and credentials on the settings page, enable “Model Routing”. Afterwards DSH’s default model points to starbridge / general, without needing to manually specify the gateway for each conversation.

Build from Source (Maintainers / Secondary Development)

npm install
npm run build          # build:host + build:client
npm run verify         # offline smoke tests (the docs claim 228 checks)

Before installing into a profile, both the host’s tsc and the client’s tsdown must produce lib/index.js and lib/client.js.

Use Cases and Considerations

Who it’s for: Teams or individual developers who have already deployed a StarBridge gateway within their organization, want to integrate it in the DSH Web profile using a unified settings page, and optionally want all LLM calls to go through the middle platform for auditing and routing.

Permissions and security: The plugin runs with the same privileges as the current dsh process. It reads and writes gateway configuration and encrypted session files under $DSH_HOME, and sends requests to the user-configured gateway. Before installing, you should read the source code and MIT license on the GitHub repository, and confirm that the gateway address and credentials source are trustworthy; in production environments, prefer injecting secrets via environment variables to avoid plaintext on disk.

Ecosystem note: DSH adopts an “everything is a plugin” extension approach; the SkillHub directory page is a community plugin index, with no official affiliation with DeepSeek / Hunyuan.

Closing Remarks

dsh-starbridge-client consolidates StarBridge’s gateway access, login, tools, and Web panel into a single bundle, and optionally takes over model routing. It is suitable for scenarios where you want to connect DSH to your own StarBridge middle platform. For further details, refer to the repository README:

羽毛球分组比赛记分
小程序二维码

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

Xiaoye