dsh-completion-playground: Playing with DeepSeek Completion API and logprobs in DSH

Introduction

When developing agents in DeepSeek Harness (DSH), most daily conversations go through Chat-class interfaces; if you want to debug raw prompts, perform in-fill editing (FIM-style document editing), or inspect the candidate distribution at each token position, you often need to write a separate script to call /beta/completions, wiring up conversation trajectories, cancellation, and token accounting yourself. The community plugin dsh-completion-playground (maintainer Zhichii, category: model inference) packages these capabilities into an Agent mode: each Run remains an ordinary conversation turn within Harness, except that the model call goes through DeepSeek’s /beta/completions, so Chat, the built-in Trajectory, the session list, token accounting, and cancellation behavior stay unchanged.

What Is This

dsh-completion-playground is a full-screen raw-prompt playground plugin for DSH. When creating a new session you can choose Playground Mode; after the first turn a full-screen Completion editor and a Logprob probe page appear, while the native Chat and Trajectory tabs remain. The plugin’s current version is 0.3.0 (MIT), and it depends on a dsh version range of >=0.1.7-rc.2 <0.3.0. The SkillHub directory page and the GitHub repository are linked at the end of this article; the directory site belongs to the community ecosystem and has no official affiliation with DeepSeek / High-Flyer.

Core Features

Playground Mode and Session UI

  • When starting a New Session, the mode selector offers Playground Mode; the first screen matches DSH’s default (mode chip, workspace selection, regular composer).
  • After the first conversation turn, a Completion tab appears: a full-screen prompt editor; the original Chat and Trajectory are unchanged, and the native composer is taken over and cleared to avoid another floating input box below the transcript.
  • Run: the entire document is sent as a single user message, and the completion streams back and is appended to the document; Stop cancels the current turn and any upstream requests.
  • max_tokens is adjustable (1–4096, consistent with the 4K upper limit in the API docs); the stop list supports escape sequences and is sent as max_tokens / stop in the request.
  • Trajectory: each Run is a real turn—a user record (a snapshot of the document at that time) plus an assistant record (the model’s continuation).

Logprob Tab

Logprob sits alongside Completion: it runs another ordinary turn over the same prompt, but requests logprobs from the endpoint and renders the candidate distribution at each position as probability bars. You can set max_tokens and the number of candidates (1–20) separately. This Run also enters the Trajectory; the distribution is attached to the assistant message and remains recoverable after switching tabs or refreshing.

Gemini Mode (a Second Mode in the Same Bundle)

The plugin bundle also registers Gemini mode (preset id completion-gemini): on top of the same completion endpoint, it wraps conversations in Gemini-style transcripts rather than raw document editing.

  • No system prompt: the adapter does not read system/developer messages, and the preset does not declare a prompt segment.
  • No tool calls: the request carries no tools field.
  • A built-in few-shot prefix file gemini-prefix.md is included, and can be overridden via Host configuration geminiPrefix / geminiPostfix / geminiStops / geminiEcho / geminiMaxTokens.
  • Routing is fixed to completion-gemini per-session preset on the Host, using the shipped Chat UI, with no additional browser-side tab required.

Implementation Notes (for Debugging)

On the Host side the completion-beta adapter is registered, passing max_tokens, stop, and logprobs through channels such as /completion-plan-b/max-tokens; on the Browser side, once a claimed session has history, the Completion / Logprob views are registered and the composer is taken over. The Logprob distribution is written into the assistant message’s source via the replayState of the finish chunk.

Installation and Activation

Before installing, please read the repository source code and the MIT license yourself. The plugin runs with the current dsh process permissions, and API keys are only sent to the configured upstream.

Install from GitHub (the README recommends pinning a tag for reproducibility):

dsh plugin --profile <your-profile> add github:Zhichii/dsh-completion-playground#v0.3.0

You can also paste the same spec under Settings → Plugins → Install and confirm. The package is pure ESM (index.js) plus a browser bundle (client.js), with no build step or install script, so no build approval is needed during installation.

Configuring the API Key

The Host resolves DEEPSEEK_API_KEY via the Harness credentials seam (ctx.credentials) and falls back to the process environment; the value is only sent to the configured upstream. Optional environment variables:

Variable Meaning
DSH_COMPLETION_BETA_BASE_URL Upstream base URL, default https://api.deepseek.com/beta
DSH_COMPLETION_ATTRIBUTION User-Agent sent to the upstream (white-label)

For Gemini-mode-related YAML configuration, see the config section of completion-plan-b-host in the GitHub README.

Typical Usage

  1. New Session → select Playground Mode.
  2. Write your first prompt in the regular composer; the mode has already claimed the session, so the first turn already goes through the completion routing.
  3. Open the Completion tab → edit the document in the full-screen editor and click Run (or Ctrl/Cmd + Enter).
  4. Check the Trajectory to see whether the Run is recorded as a complete turn.
  5. To view token candidate distributions, switch to the Logprob tab, set max_tokens and the number of candidates, then run.

Stop Sequences (Single-line Input)

The stop field is single-line; newlines are entered via escapes and, once decoded by the browser, are sent to the upstream as real characters:

Typed Sent as the stop sequence
\n one line feed
\n\n two consecutive line feeds (stop at a blank line)
\nUser: line feed followed by User:
\t one tab
\\ one literal backslash

Unknown escapes (e.g. \q) keep the backslash. At most 16 sequences are supported, and empty lines are discarded.

If you use Gemini mode, select Gemini mode in the mode selector and send messages normally via the Chat UI; few-shot and postfix behavior follows the README and the Host config.

Use Cases and Caveats

Suitable for: scenarios where you need to debug the DeepSeek Completion API within DSH session context, continue long documents, compare stop / max_tokens, visualize logprobs, and want Trajectory and cancellation to behave consistently with the native Agent; you can also experiment with transcript wrapping without a system prompt or tools using Gemini mode in the same plugin.

Caveats:

  • The plugin declares a dsh engine range of >=0.1.7-rc.2 <0.3.0; verify your local DSH version before deployment.
  • The installation command must use github:Zhichii/dsh-completion-playground#v0.3.0 as given in the documentation; without pinning, a git install tracks the default branch.
  • Every Run in Completion and Logprob consumes API quota and is written to the Trajectory; the more logprob candidates requested, the higher the request and display costs.
  • The community directory currently shows 0 stars; this does not indicate missing functionality, only reflects public attention, and issues and updates are tracked via GitHub Issues.

Conclusion

dsh-completion-playground embeds DeepSeek’s /beta/completions into DSH’s Agent-turn model: full-screen prompts, streaming continuation, stop/max_tokens, and logprobs probes all happen within the same Chat / Trajectory setup, plus an optional Gemini mode for transcript-style conversation experiments.

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

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

Xiaoye