osmondlee/dsh-shell

osmondlee★ 1JavaScript最后同步: 2026-08-15

在 GitHub 打开

just for deepseek harness shell

README 摘要

dsh-shell-exec DSH 动态 Cordis 插件:通过 harness 的 shell 服务在 Windows 本地终端 执行 shell 命令,并为模型注册一个名为 shell 的动态工具。 功能 - 注册模型可见的动态工具 shell ,模型可以直接调用它在当前 Windows 机器上执行任意命令(文件、进程、git、npm 等)。 - 支持三个参数: command (必填)、 workdir 、 timeoutMs 。 - 输出渲染与 harness 自带 shell 工具一致:stdout 正文 + [stderr] 段 + 退出标记( [exit code: N] / [killed by signal: ...] / [timed out after Nms] )。 - 基于 harness 的 shell 服务( ctx.get('shell') → resolve → run ),Windows 下经 PowerShell 执行,无需引入任何外部依赖。 目录结构 快速开始(在 DSH Web GUI 中加载) 1. 在 DSH Web 的对话中让模型执行 cordis define : - plugin.kind = new , idPrefix 填 she ; - code.host 粘贴 src/host.js 的完整内容; - 也可以直接把本文件路径交给模型,让它读取并粘贴。 2. 用返回的 pluginId / packageId 执行 cordis run (mode = run )激活插件。 3. 激活后,模型即可调用 shell 工具执行本地命令。 使用示例 模型调用 shell 工具时,参数形如: 返回结构: 工具参数 参数 类型 必填 说明 command string 是 要执行的 shell 命令行,例如 dir 、 git status workdir string 否 命令的工作目录,缺省使用 harness 配置的工作区 timeoutMs number 否 超时毫秒数;执行器会做上限截断,缺省使用实现配置的默认值 工作原理 - harness.defineTool({...}) 定义动态工具(参数使用 Cordis 参数 DSL,输出 schema 为 { type: 'json' } )。 - harness.registerTool(ctx, tool) 注册到当前 Fiber,插件停止/更新时自动注销。 - 执行路径: shell.resolve(request) → shell.run(spec) ,其中 request.signal 透传工具执行的取消信号。 - ShellRunResult 包含 exitCode / signal / timedOut / timeoutMs / st…

在 GitHub 查看完整 README →
工具/开发dsh-plugin

分类