snail30xx/dsh-graph-runtime ↗★ 1

dsh-graph-runtime

Graph runtime capabilities for the DeepSeek Harness: register LangGraph compiled graphs as DSH tools, plus a graph-driven routing agent. 适合需要将复杂的LangGraph工作流集成到DSH中作为工具调用的开发者

Package
dsh-graph-runtime
Compatibility
Unverified
Harness peer range
0.1.5-rc.2
Cordis peer range
^4.0.1
Version
0.1.0
License
MIT
Last updated
Sep 17, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:snail30xx/dsh-graph-runtime

Usage

Graph authors only need defineGraph — defining is registering; no mount or service call is required:

// graphs/echo.ts
import { defineGraph } from 'dsh-graph-runtime'
import { Annotation, END, START, StateGraph } from '@langchain/langgraph'

const State = Annotation.Root({
  topic: Annotation,
  log: Annotation({
    reducer: (left, right) => [...left, ...right],
    default: () => [],
  }),
})

export const echoGraph = defineGraph({
  name: 'echo_graph',
  description: 'Echo the given topic.',
  build: () =>
    new StateGraph(State)
      .addNode('echo', async (state) => ({ log: [`seen:${state.topic}`] }))
      .addEdge(START, 'echo')
      .addEdge('echo', END),
  asTool: true, // Declared as a model-visible DSH tool; default false
  // asGraphTool: true, // Also listed in the graphTools registry for discovery; default true, can be omitted
  // validate: (input) => Boolean((input as { topic?: string }).topic), // Argument-validation hook; defaults to always passing
})

The only wiring requirement: a graph module must be imported by some bundle entry (a single barrel line import './graphs' suffices). At plugin apply, every already-defined graph auto-mounts, and later definitions mount immediately; a single graph failing to mount (duplicate name, invalid declaration) warns and is skipped without blocking startup.

Tools declared asTool: true register at the plugin's global layer: visible to every agent (including the default agent). For scope-private or runtime-constructed cases, use the imperative entries below.