Skip to content

HuanLinOTO/dsh-plugin-sleep

60Last commit Aug 15, 2026

dsh-plugin-sleep DSH plugin

This plugin provides a single `sleep` tool that can be called by AI models within DSH. It pauses execution for the requested number of milliseconds and returns detailed status including actual wait time, cancellation, and clamping. Useful for scenarios where models need to wait for conditions like service restarts or retry backoffs.

How to install the dsh-plugin-sleep DSH plugin

dsh plugin --profile web add @huanlin/dsh-plugin-sleep

Copying does not run this command. Review the repository and version before installing the dsh-plugin-sleep DSH plugin.

dsh-plugin-sleep DSH plugin data source

dsh-plugin-sleep DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-plugin-sleep DSH plugin can do

  • Exposes a `sleep` tool with configurable maximum duration (default 60,000ms).
  • Supports cancellation via `exec.signal` – returns `cancelled: true` without throwing an error.
  • Clamps requested duration to `maxDurationMs` and reports `clamped: true`.
  • Returns detailed JSON with requested_ms, actual_ms, cancellation, clamping, and optional reason.
  • Configurable default duration for when model omits the parameter.

Where the dsh-plugin-sleep DSH plugin fits

  • Waiting for a service to restart before proceeding with further actions.
  • Implementing debounce windows in model-driven workflows.
  • Adding retry backoff delays between API calls.
  • Letting the model intentionally pause for a fixed time before continuing.
  • Testing and debugging model behavior with timed pauses.

Who the dsh-plugin-sleep DSH plugin is for

  • DSH plugin developers who want to add waiting capabilities to their tools.
  • AI application developers who need models to wait for external conditions.

dsh-plugin-sleep DSH plugin limitations

  • Only provides a single `sleep` tool – no other waiting mechanisms (e.g., polling, event-based).
  • Relies on DSH environment and its peer dependencies (`cordis`, `@deepseek-ai/dsh-tools`).
  • Maximum duration is clamped to `maxDurationMs` (default 60,000ms); cannot sleep indefinitely.
  • Tool execution is synchronous from the model's perspective but uses async cancellation internally.

dsh-plugin-sleep DSH plugin: from the repository README

Quoted from the HuanLinOTO/dsh-plugin-sleep README, the upstream source of the dsh-plugin-sleep DSH plugin. Copyright remains with the original authors.

> 📌 本插件已收录于 [dshfind](https://dshfind.com/zh) 插件超市,点击上方徽章直达主页。 # dsh-sleep [![npm version](https://img.shields.io/npm/v/@huanlin/dsh-plugin-sleep)](https://www.npmjs.com/package/@huanlin/dsh-plugin-sleep) DSH 插件:向模型暴露一个 `sleep` 工具,让模型按指定毫秒数暂停执行后再返回。适合等待时间相关条件成立(服务重启、debounce 窗口、retry backoff)且没有事件型工具可用的场景。 ## 安装 ```sh # 从 npm 安装(推荐): dsh plugin --profile web add @huanlin/dsh-plugin-sleep # 从本地 checkout 开发安装: dsh plugin --profile web add link:D:\Projects\deepseek-harness\dsh-sleep ``` 预构建策略:`lib/` 入库,无 `prepare` 脚本,npm 安装开箱即用,无需 `allowBuilds`。 ## 配置 在 DSH GUI 设置页或 `cordis.patch.yml` 中配置: | 字段 | 类型 | 默认值 | 说明 | |------|------|--------|------| | `maxDurationMs` | number | `60000` | 单次 sleep 上限毫秒数。超过会被 clamp 到此值,并在返回中标 `clamped: true`。 | | `defaultDurationMs` | number | `0` | 当模型省略 `duration_ms` 时的回退值。 | ## 工具 ### `sleep` 暂停 N 毫秒后返回。 **参数:** | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | `duration_ms` | integer | 是 | 暂停毫秒数,必须 ≥ 0。超过 `maxDurationMs` 会被 clamp。 | | `reason` | string | 否 | 人类可读的暂停理由,会原样回显。 | **返回(规范 JSON):** ```jsonc { "requested_ms": 1000, // 调用方原始请求值 "actual_ms": 1002, // 实际等待毫秒数 "cancelled": false, // 是否被 abort 信号中断 "clamped":

Read the full READMERepository license: NOASSERTION

dsh-plugin-sleep DSH plugin questions

How do I install dsh-plugin-sleep?

Run `dsh plugin --profile web add @huanlin/dsh-plugin-sleep` in your DSH environment. This will install the package from npm and activate the plugin. Make sure you have DSH installed and configured.

What is the maximum sleep duration?

The default maximum is 60,000 milliseconds (60 seconds). You can change this by setting `maxDurationMs` in the plugin configuration. If the model requests a longer duration, it will be clamped and the response will include `clamped: true`.

Can the sleep be cancelled?

Yes, if the `exec.signal` is aborted during the sleep, the tool will stop waiting and return immediately with `cancelled: true`. This is a graceful cancellation, not an error, so the model can handle it as a normal business outcome.

Why would I need a sleep plugin for an AI model?

Models sometimes need to wait for external conditions, like a server restart or a debounce period. Without a sleep tool, the model would have to poll or rely on other tools. This plugin provides a simple, cancellable pause that integrates well with DSH's tool system.

What configuration options are available?

You can configure `maxDurationMs` (maximum milliseconds per sleep, default 60000) and `defaultDurationMs` (fallback when the model omits `duration_ms`, default 0). These can be set in the DSH GUI settings or in `cordis.patch.yml`.