XiaLiChao82

Dsh Claude Code — Development skill for Claude Code

Development community

插件基于claude code agent SDK开发,在DSH中使用claude code订阅,尽量还原类似原生API的使用体验.

How to install Dsh Claude Code

This entry records only its repository, not the path inside it, so there is no exact command to give. Open XiaLiChao82/dsh-claude-code and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Dsh Claude Code does

插件基于claude code agent SDK开发,在DSH中使用claude code订阅,尽量还原类似原生API的使用体验.

Alternatives in Development

  • Harnessrouter — HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnes 618 ★
  • Scope Recall Hermes — Local long-term memory for Hermes, Codex, Claude Code, WorkBuddy and dsh agents: one SQLite store, source-back 438 ★
  • Oh Story Dsh — A DSH plugin for novel writing and short-drama production, powered by Oh Story and Drama Skills 202 ★

README

dsh-llm-claude-code

`dsh-llm-claude-code` 是一个 DSH Host 插件,用于将 Claude Code 通过 Claude Agent SDK 注册为 DSH 的可选 LLM Provider。

插件保留 DSH 的会话管理、模型选择、消息展示、取消控制、权限预设和工具执行基础设施;模型推理及 Claude Code 原生工具循环由 Claude Agent SDK 驱动。认证与计费沿用本机 Claude Code CLI 的登录状态和订阅环境,本插件不直接配置 Anthropic API Key。

功能范围

插件注册 Provider `claude-code-main`,并提供以下集成能力:

  • 将 Claude Code 的文本、推理、用量及工具活动转换为 DSH LLM 流事件。
  • 通过进程内 MCP Server 将部分 DSH 工具暴露给 Claude Code。
  • 用 DSH 的 bash、read、write、edit 和 todo_write 替换对应的 Claude Code 原生工具。
  • 将 DSH 的计划模式和只读权限预设映射为 Claude Agent SDK 的 plan 权限模式。
  • 将 Claude Code 的 AskUserQuestion 请求转交给 DSH 原生提问界面。
  • 在同一 DSH 会话内续接 Claude Code 原生会话,避免每轮完整重放历史。
  • 根据当前 Provider 分发 /compact 和 /goal 命令。
  • 支持 DSH 图片附件,并转换为 Anthropic Messages API 接受的图片内容块。
  • 将 Claude Code 用 Agent 工具派发的子代理镜像为 DSH 子会话,使其出现在会话头部的子代理目录中。

系统架构

DSH Web / Agent Session
        │
        │ LLM adapter stream
        ▼
dsh-llm-claude-code
        ├── Claude Agent SDK query()
        │       └── Claude Code executable
        │
        ├── in-process MCP server
        │       └── DSH tools.execute()
        │               ├── permission / approval
        │               ├── filesystem observation policy
        │               └── tool result events
        │
        ├── permission-state mapping
        ├── native-session resume state
        └── DSH message / activity projection

组件职责

组件 职责
DSH 管理外层会话、消息持久化、模型选择、权限预设、工具注册、取消信号和 Web 界面
本插件 实现 LLM Adapter、消息格式转换、工具桥接、权限映射、会话续接和命令分发
Claude Agent SDK 启动 Claude Code、驱动模型与原生工具循环、产生流式 SDK 消息
Claude Code 执行推理、调用工具、维护内层会话上下文

工具桥接

执行路径

插件使用 Claude Agent SDK 的 `createSdkMcpServer()` 和 `tool()` 创建进程内 MCP Server。桥接工具的调用路径如下:

Claude Code
  → mcp__dsh__
  → SDK in-process MCP server
  → DSH tools.execute()
  → DSH 权限检查、审批和工具实现
  → MCP result
  → Claude Code

该路径不创建额外的 MCP 子进程,也不通过网络传输。工具参数由 DSH JSON Schema 转换为 Zod Schema;工具结果转换为 MCP 文本结果,同时保留错误状态。

默认桥接工具

| 类