liyown/dshx--packages-dshx ↗★ 7

@becomeopc/dshx

Build and debug typed DeepSeek Harness Host and Client plugins with TypeScript and Vite. 适合开发者,提供类型安全的插件开发、Vite构建及调试支持。

패키지
@becomeopc/dshx
호환성
미검증
Harness peer 범위
>=0.2.1-rc.2 <0.3.0-0
Cordis peer 범위
^4.0.5
버전
0.2.0-preview.0
라이선스
MIT
최근 업데이트
2026. 10. 23.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗

@becomeopc/dshx

Typed authoring, bounded Vite builds, diagnostics, and development orchestration for DeepSeek Harness plugins. DSHX does not replace the official DSH/Cordis runtime.

Install

Create a new minimal project:

pnpm create dshx@preview my-plugin
cd my-plugin
pnpm check
pnpm dev

Generate the complete Candidate API example:

pnpm create dshx@preview my-plugin --template showcase --style tailwind

For an existing package, install DSHX plus one concrete DSH development version and the official feature packages used by the plugin:

pnpm add -D @becomeopc/dshx@preview @deepseek-ai/dsh

Public modules

ModuleStatusExports
@becomeopc/dshxAPI CandidatedefineConfig, DshxConfig
@becomeopc/dshx/configAPI CandidateSame config-only surface
@becomeopc/dshx/hostAPI CandidatedefineHost, defineTool, defineCommand, Prompt helpers and official Prompt types
@becomeopc/dshx/clientAPI CandidatedefineClient, defineLocale, defineSlot, Hooks, Locale/Slot types
@becomeopc/dshx/apiAPI CandidatedefineApi, method, isApiError, shared API types
@becomeopc/dshx/settingsAPI CandidatedefineSettings and shared Settings types
@becomeopc/dshx/experimental/conversationExperimentaldefineConversation, lifecycle/render types, official event types
@becomeopc/dshx/toolingTooling / ExperimentalNode-only build/watch, config, compatibility, diagnostics, CLI, and repair APIs

The root no longer reexports Host/Client authoring helpers. The old /compiler, /compat, /cli, and /conversation subpaths have no runtime aliases.

Minimal Host

import { defineHost, defineTool } from "@becomeopc/dshx/host";

const status = defineTool({
  name: "my_plugin_status",
  description: "Return plugin status.",
  parameters: {},
  output: {
    schema: { type: "string" },
    render: (_args, value) => [{ type: "text", text: value }],
  },
  async execute() {
    return "ready";
  },
});

export default defineHost({ tools: [status] });

Build config

import { defineConfig } from "@becomeopc/dshx";

export default defineConfig({
  host: { entry: "src/host.ts" },
  client: { entry: "src/client.tsx" },
  build: { sourcemap: true, declarations: true },
});

host.vite.plugins and client.vite.plugins accept a bounded native Vite PluginOption[]. DSHX protects entry, target, external, chunk, format, and asset policy; Client CSS and inline assets still use Vite's standard pipeline.

Client dependencies

Client provider packages and runtime services are separate declarations. package.json#dsh.client.inject makes a provider package load before the plugin; defineClient({ inject: [...] }) tells Cordis which services setup(ctx) directly requires.

For plugin-owned copy, use defineLocale() instead of augmenting LocaleNamespaceMap:

{
  "dsh": {
    "client": {
      "inject": ["@deepseek-ai/dsh-client-locale"]
    }
  }
}
import {
  defineClient,
  defineLocale,
  defineSlot,
  type PropsLocaleOf,
} from "@becomeopc/dshx/client";

const copy = defineLocale("my-plugin.status", {
  zh: { ready: "已就绪" },
  en: { ready: "Ready" },
});

function Status({ t }: PropsLocaleOf) {
  return 
{t("ready")}
;
}

const slot = defineSlot("sidebar.footer.action", {
  id: "my-plugin.status",
  locale: copy,
  component: Status,
});

export default defineClient({ locales: [copy], slots: [slot] });

zh and en must contain the same string-valued keys. Non-empty locales registers the dictionaries before Slots and automatically requests the Cordis locale service; the package still declares @deepseek-ai/dsh-client-locale in dsh.client.inject. dshx check, dshx build, and every dshx dev Client rebuild diagnose a missing provider edge. Raw locale namespace strings remain available for advanced integration with a provider-owned, augmented LocaleNamespaceMap, but do not register dictionaries.

Commands

dshx check
dshx check --runtime
dshx build
dshx dev
dshx dev --port 0

Plain check is offline and includes TypeScript noEmit; --runtime additionally requires the linked Profile/Composition/runtime. build typechecks first and emits declarations by default. dev --port 0 lets DSH ask the OS for a free Web port; pass a concrete port when the same address must survive automatic Host restarts.

Documentation

MIT © DSHX contributors.