← Back to home@exoticknight

dsh-system1

System One foundation and Cordis plugin for DeepSeek Harness | DeepSeek Harness 的 System One 基础能力与 Cordis 插件

Stars
0
Language
TypeScript
Created
Sep 23, 2026
Updated
Oct 6, 2026
GitHub repo

Introduction

dsh-system1

A typed System One decision service for DeepSeek Harness plugins. Consumer plugins call ctx.system1.decide(), interpret the results, and choose their own actions.

CI npm version License DSH Maintained with RED

dsh.pub registry status

English | 简体中文

PrimitiveResult
noulProbability that a proposition is true (probabilityTrue)
choiceCandidate key and the full probability distribution
scoreExpected zero-based level and the probability distribution

The service provides request and response validation, per-question results, cancellation, timeouts, provider registration, and execution metadata. Built-in providers connect to TypeSafe/Jev, Laya, and Cloudflare Clef through the System One HTTP protocol. Other backends can implement the public provider contract.

Install from GitHub

Requirements: Node.js 22.19+ in the 22.x line or Node.js 24, Cordis @deepseek-ai/cordis 4.x, and dsh >=0.1.7-rc.1 <0.3.0. The Loader has been verified with dsh 0.1.7-rc.1, 0.1.7-rc.2, and 0.2.0-rc.2.

Add the public GitHub repository to a dsh profile:

dsh plugin --profile headless add github:exoticknight/dsh-system1

The repository includes the compiled lib/ files required by the plugin, so installation does not need a local checkout or a manually constructed archive path. pnpm supports GitHub repositories as direct package sources; see supported package sources.

The bundled patch mounts the service and built-in providers. Defaults are model jev-latest, provider id typesafe, and an 800 ms total timeout. Use the plugin settings to choose a default service and model, configure connections, and store keys in DSH credentials; environment variables are also supported. Adjust timeoutMs to fit backend latency, especially for local CPU inference.

Cloudflare uses provider cloudflare with clef or clef-flash. See provider setup for configuration.

Use from a consumer plugin

Install the package in your consumer plugin project:

pnpm add dsh-system1

Declare inject: ['system1'] and import this package's Cordis type augmentation:

import type { Context } from '@deepseek-ai/cordis'
import type {} from 'dsh-system1'

export const inject = ['system1']

export async function apply(ctx: Context) {
  const result = await ctx.system1.decide({
    state: 'The user asked about a refund.',
    questions: {
      refund: {
        type: 'noul',
        instructions: 'Is the user asking about a refund?',
      },
      topic: {
        type: 'choice',
        instructions: 'Choose a topic.',
        criteria: { billing: 'Billing', technical: 'Technical support' },
      },
      urgency: {
        type: 'score',
        instructions: 'Rate urgency.',
        criteria: ['Normal', 'Urgent', 'Critical'],
      },
    },
  })

  if (result.answers.topic.status === 'ok') {
    return result.answers.topic.answer.value // 'billing' | 'technical'
  }
  return result.answers.topic.error
}

noul returns probabilityTrue; choice returns a candidate key and its full distribution; score returns an expected level and probabilities ordered by criteria. These are model outputs, so consumer plugins choose their own decision thresholds and actions. Runtime failures are reported per question with status: 'error'; malformed call structures throw System1InputError.

See API and provider development for the full contract and the consumer example. TypeSafe supports jev-latest, jev-preview, and jev-1.13.0; see provider setup for other services and their limits.

Development

Use Node.js 22.19+ in the 22.x line or Node.js 24 and the pnpm version declared in package.json:

pnpm install --frozen-lockfile
pnpm verify

pnpm test runs the plugin and provider tests with local fixtures, as CI does; pnpm test <plugin|providers|provider name> runs a subset. Live model probes, pnpm probe <typesafe|cloudflare|laya|clef-local>, read credentials from .env.local, and local targets set up their own service on first use; see testing and live model validation.

See the contribution guide and release process.

License

Licensed under the Apache License 2.0.