Files
deepseek-harness/packages/util/plugin-market-index
imccyu 30b668495d chore(release): sync release/dsh-0.2.2 0.2.2-rc.5 to master
# Conflicts:
#	packages/client/hmr/package.json
#	packages/client/script-realm-iframe/package.json
#	packages/client/ui-jobs/package.json
#	packages/client/ui-session-panel/package.json
#	packages/experimental/action-cards/package.json
#	packages/experimental/client-ui-forge/package.json
#	packages/experimental/cua-bundle/package.json
#	packages/experimental/forge-gitlab/package.json
#	packages/ptc-runtime/ptc-runtime-node/package.json
#	packages/session/tool-working-directory/package.json
#	packages/util/atomic-write/package.json
2026-11-18 18:26:56 +08:00
..

description, kind
description kind
Plugin market index format 1 validation and install arguments for DSH readers and index generators. package-library

dsh-plugin-market-index

English | 中文

Summary

Validator without runtime dependencies for format 1 of the plugin market index, the single JSON file that lists installable DSH bundles with their display metadata. The format Agent Note defines the document; this package is its executable rule set. DSH's dsh-plugin-market reads indexes with it, and index generators validate their output with it before publishing.

Table of Contents


Use this package

It is a library, not a service or plugin: no ctx, no registrations, no state, no I/O.

Parse the fetched document as JSON, then pass the value and the URL it was read from to parseMarketIndex. The first violated rule throws MarketIndexError with the JSON path of the offending value. A successful result drops members the format does not define, fills absent metadata groups, keywords, labels, sortKeys, and engines with empty values, and orders each plugin's versions by descending SemVer precedence.

For HTTP or HTTPS indexes, the parser resolves relative icon references against the index URL. For git+https and git+ssh indexes, an icon must be an absolute HTTPS URL or a base64 data URL.

Within plugin metadata, null means unavailable: the metadata object and its fields normalize like absent input, and null sort values are omitted. Numeric zero is retained. Generators omit unavailable metadata and values. Unknown object fields are ignored, while declared map entries, known fields, and source discriminators remain validated.

Install one version with marketInstallTarget(name, version): it returns the exact pnpm spec, name@version for npm and a commit-pinned git+https URL with an optional path: parameter for Git, and the registry to ask first when the version names one.


API

import { MarketIndexError, marketInstallTarget, parseMarketIndex } from '@deepseek-ai/dsh-plugin-market-index'
import { gitMarketIndexSource, isGitMarketIndexSourceAddress, parseGitMarketIndexSource } from '@deepseek-ai/dsh-plugin-market-index/source'
Export Role
parseMarketIndex(value, indexUrl) Validated MarketIndex; throws MarketIndexError for the first violated rule.
marketInstallTarget(name, version) { spec, registry? } that installs that exact version.
MarketIndexError Validation failure carrying path and reason.
MAX_INLINE_ICON_BYTES Largest decoded payload of an inline data: icon, 32 KiB.
parseGitMarketIndexSource(input) Canonical Git index address, Git remote, and file location.
gitMarketIndexSource(input, path?, ref?) Canonical Git index address from a pasted repository link and optional file location.
isGitMarketIndexSourceAddress(input) Whether an address identifies a Git repository.
MarketIndex, MarketPlugin, MarketVersion, MarketEngines, MarketSource, MarketRepository, MarketIndexMetadata, MarketPluginMetadata, MarketDeclaration, MarketSortKeyDeclaration, MarketInstallTarget Validated record types.

Model Experience

Indirectly, through dsh-plugin-market, whose plugin_market tool returns validated plugins to the model.

KV Cache effect

None of its own. The tool result that carries plugins owns its request's cache behavior.

Known Limitations and Deferred Work

  • Generator obligations are unchecked — the validator cannot verify that name, version, publishTimestamp, engines.dsh, or display fields match the package they describe, or that the package declares a bundle.
  • No size bound — the caller bounds the document before parsing it.

Dev Note

Working context for maintainers — click to expand

None.