Files
deepseek-harness/packages/llm/llm-deepseek-api-key
Turtle 38c7a9fbf4 feat(release): publish package source, declaration maps, and documentation (#5884)
* feat(release): publish package source, declaration maps, and documentation

Every release member publishes its TypeScript source and the declaration
maps that resolve into it, and @deepseek-ai/dsh publishes the repository
Markdown documentation staged from docs/ at prepack time.

The ./src/* export most members already declared now resolves for an
installed consumer, and a consumer editor follows a declaration to the
implementation. Bundled JavaScript maps stay unpublished; the vendored
family and the Desktop runtime file policy are unchanged.

Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md

* feat(release): publish JavaScript maps and compress bundles

Every emitted JavaScript map ships beside the bundle it describes, and the
workspace build and the client preset compress bundles without mangling
identifiers.

The documentation payload now mirrors the website publication manifest and
is removed again by `postpack`; Desktop and the Python executable exclude
the published source, documentation, and maps; `clean` removes a staged
copy. Typert's publication contract gains the Remote declaration map.

* fix(release): keep node bundles readable for the worker image

The browser worker image lowers `yield*` only as a whole statement and
rewrites `for await` loops by their source layout, so compressed node-side
entries either fail that lowering or lower to unparseable code. Only the
browser bundles keep compression, which removes about a third of their text.

The bundle-purity assertion now matches the module-loader call regardless of
the quote style compression picks, and the release-pack fixture exercises
the installed package's new documentation requirement.

* feat(release): publish the whole documentation tree

`@deepseek-ai/dsh` copies `docs/` in full instead of the website's page
set: the maintainer documents, the generated migration records, the
translation guidelines, and the `*.i18n.yaml` consistency records ship
with the installed package, so the documentation's own links resolve
without a checkout.

* feat(release): publish the upgrade guides with the documentation

The staged documentation keeps the website's page set and adds every
`docs/upgrade-guide/` document, which is what an installed reader consults
when a released change breaks something. The rest of the maintainer tree
stays out.

* test(release): expect source and maps in master's new payload cases

* feat(release): keep installed docs and source readable in Desktop

Desktop keeps the published src/ and docs/ trees inside app.asar, and
every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE
so an agent can read them through Electron's Node mode. Staging also
generates docs/upgrade-guide/README.md, an index of the upgrade guides
grouped by the release they upgrade from.

Minified client bundles print string literals with backticks: the
worker image packer now recognizes those chunk requests, client license
banners are prepended after minification so their text survives, and
the affected artifact tests accept either quote.

* test(desktop): read archived docs through the Windows PowerShell form

Regenerate the config catalog for the shifted shell-env source line.

* test(desktop): wait for the GUI-subsystem Electron process from PowerShell

* build(release): publish source and maps from the message-quotes package

* build(release): publish source and maps from packages new on master

* build(release): publish source and maps from the tool-office package
2026-11-05 00:22:36 +08:00
..

description, kind
description kind
DeepSeek API-key authentication, model discovery, and the official model listing. package-reference

@deepseek-ai/dsh-llm-deepseek-api-key

English | 中文

Summary

Register authentication, model discovery, and the official model listing for deepseek-official. This plugin shares the Messages transport and owns credential resolution, catalog availability, and model admission.

Authentication resolution returns the validated API key in x-api-key for both Messages and Files requests.

Table of Contents

Use this package

apiKeyEnv defaults to DEEPSEEK_API_KEY and resolves per request and model discovery. When the credentials service exists, its precedence applies; only compositions without that service read the launch environment directly. Requests with missing credentials fail with MISSING_CREDENTIAL; malformed credentials fail with INVALID_CREDENTIAL. Model discovery returns an empty catalog when the credential is missing, hiding the route from model selectors while retaining its settings entry. Malformed credentials and other lookup failures propagate. Adding or removing a key affects the next discovery call.

- id: llm-deepseek
  name: '@deepseek-ai/dsh-llm-deepseek-api-key'
  config:
    reasoningEffort: high
    apiKeyEnv: DEEPSEEK_API_KEY

The endpoint and credential reference come from one configuration resolution. In-flight requests retain that snapshot; subsequent updates affect subsequent calls. Account login state cannot change this route’s credential.

models is an independently configurable catalog for this provider; defaults and protocol capabilities come from the shared transport. While models equals the built-in catalog and the Messages origin is the official API, https://api.deepseek.com, the route serves the official GET https://api.deepseek.com/models listing instead. Listing requests carry the API key in x-api-key and the harness User-Agent, and reject redirects; without an API key the route requests nothing. Any other endpoint, including one named by baseURL or $DEEPSEEK_BASE_URL, serves models and requests no listing. Discovery does not probe inference endpoints.

The first access waits for the listing up to modelsTimeoutMs. After first use, the Host refreshes automatically every modelsMaxAgeMs (ten minutes by default), including while the page is idle. Later accesses return the cached listing while a refresh runs. A failed or empty listing retains the previous listing, including badges; before any listing loads, the route serves the built-in catalog of the current version (deepseek-flash and deepseek-v4-pro). A listing HTTP 401 fails only that load. Each loaded listing, the first failure of a failing streak with the catalog it falls back to, each listing entry hidden because its declarations are unreadable or unusable, and each dropped badge are written to stderr with the [llm-deepseek-api-key] tag; stdout remains available for protocol messages, and secrets are never logged. Changed listings emit llm/models-updated, so open selectors reload without a page refresh. Omitted or null badge metadata clears a previous badge; no separate clear operation is needed. Plugin disposal stops refreshes and waits for active loads.

Listed models are offered, merged with this build's entries, and refused before network I/O with CLIENT_UPGRADE_REQUIRED or MODEL_UNSUPPORTED by the account route's rules; model ids the listing does not name pass through unchanged.

A models list that differs from the built-in catalog replaces the catalog and stops listing requests; the Models page stores an edited catalog there. Removing that list, as Restore defaults on the Models page does, returns the route to the listing, and the next access loads the listing again even when the cached one is still fresh. A list identical to the built-in catalog counts as uncustomized.

Field Default Meaning
modelsTimeoutMs 5,000 Deadline of one listing request and of a first-access wait
modelsMaxAgeMs 600,000 Automatic refresh interval after first use, also used after failure; 0 refreshes on access only

The settings namespace is the Cordis entry id, or the plugin name without an entry. Product profiles retain the official entry id llm-deepseek and use llm-deepseek-account for the account route.

Understand the implementation

API-key lookup calls resolveDeepSeekApiKey from the shared credential module. Registrations and listeners dispose with the plugin, and disposal aborts an in-flight listing request. Shared Host wiring supplies attachments, request extensions, anonymous identity, and atomic retry-policy updates; this plugin registers only its own route and uses the transport's connect and admit hooks for the listed catalog and the gate. The listing request, its cache, and catalog resolution come from the shared transport; the cache lives in memory and is keyed by endpoint and a SHA-256 of the key, so another key loads its own listing. A loader/volatile-update listener discards the cached listing whenever the route starts or stops following it.

Further Exploration

LLM streaming · Messages · Official listing decision

Model Experience

Authenticated model requests

What the model sees

Requests on deepseek-official add no model-visible text from this plugin; the shared Messages transport serializes requests.

Token effect

Authentication, discovery, and the listing add no input tokens. The followed listing sets each model's context window and default output cap, which each request's logged context and header record.

KV Cache effect

Credentials and catalog availability do not enter model input; the protocol transport owns request-prefix serialization. A listing change to a model's system prompt or tool update mode changes how later system prompt or tool updates are serialized.

Known Limitations and Deferred Work

  • A configured catalog is configuration metadata, not remote validation that a model is accepted; actual calls can still fail.
  • The Models page shows the built-in catalog while the route follows the listing, so a model only the listing offers appears only in model selectors. Editing that catalog on the page stores the rows the page shows, which drops such a model until Restore defaults.
  • A customized catalog does not receive models the listing adds later.
  • Customization is judged against the running version's built-in catalog, so a saved models list equal to an earlier version's built-in catalog counts as customized once the built-in catalog changes and stops following the listing until Restore defaults.
  • The listing cache lives in memory; a start without network serves the built-in catalog until a listing loads.
  • A listing change during a running process reaches the Web model picker at its next catalog refresh; the plugin does not announce it.
  • When the current version can serve no listed model, the route offers no models.

Dev Note

Registration and authentication tests also cover the Loader composition in the shared transport package.