dsh-cron
Agent 与会话 活跃维护

dsh-cron

XiaoWind/dsh-cron

轻量级智能体调度插件,提供/cron斜杠命令,支持自定义执行周期,可覆盖多数周期性智能体任务,自动循环触发执行,部署配置简单,无需手动值守。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
19 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:XiaoWind/dsh-cron
git clone https://github.com/XiaoWind/dsh-cron.git
git clone git@github.com:XiaoWind/dsh-cron.git
README.md main

dsh-cron

English | 中文

A DeepSeek Harness (DSH)
plugin that adds a human-facing /cron slash command for cron-scheduled,
recurring agent loops
.

/cron "*/30 * * * *" posts a start notice, then fires one tick at every
wall-clock minute matching the cron expression (for example :00 and :30),
re-prompting the agent each time, until you stop it with /cron stop.

Install

# from GitHub (works immediately — no npm publish required)
dsh plugin --profile web add git+https://github.com/XiaoWind/dsh-cron.git

# or from npm, once published
dsh plugin --profile web add dsh-cron

The dsh plugin command forwards to pnpm inside the web profile directory,
then reconciles the profile's dsh.profile.bundles layer list. Because this
package declares dsh.bundle.patch, it joins the layer stack automatically.
Restart the Web app after installing.

The plugin injects the commands service, so it activates only in profiles
that compose a command adapter — the shipped web profile does.

Update

Pull the latest version of the plugin into an installed profile:

dsh plugin --profile web update dsh-cron

dsh plugin forwards to pnpm update dsh-cron inside the profile directory,
which re-resolves the github:XiaoWind/dsh-cron dependency to the latest commit
on the default branch. The lockfile pins a git dependency by commit hash, so a
version bump is not required for the update to land. If pnpm has cached an old
git resolution, re-pin it explicitly:

dsh plugin --profile web add github:XiaoWind/dsh-cron

Restart the Web app after updating — the bundle layer is composed at boot, so a
running Web process does not hot-reload an installed plugin.

Usage

Command Result
/cron "*/30 * * * *" Fire at :00 and :30 every hour. Keeps any current objective.
/cron "0 9 * * 1-5" Fire weekdays at 09:00.
/cron "0 9 * * 1-5" fix the tests Weekdays at 09:00 toward an objective.
/cron fix the tests Fire toward an objective at the default schedule.
/cron resume Resume the schedule saved before a restart.
/cron or /cron status Show the running schedule.
/cron stop Stop the schedule.
/cron help Show help.

The schedule is standard 5-field cron (minute hour day-of-month month
day-of-week), minute resolution, evaluated in local time. Supported
per-field syntax: *, */n, n, a-b, a-b/n, a,b,c, and month/day
names (JAN..DEC, SUN..SAT, case-insensitive). Seconds are not
supported.

A leading 5-field cron expression is the schedule and the remainder is the
objective; with no leading cron, the whole input is the objective and the
default schedule applies.

Semantics

  • Wall-clock anchored. The objective's first tick fires at the next
    wall-clock minute matching the cron expression. Starting /cron posts a
    confirmation notice first, so a fresh session opens a turn and appears in the
    session list immediately.
  • Never interrupts a running turn. If a fire time arrives while the agent is
    busy, the tick waits for idle and then fires (it catches up the missed
    occurrence).
  • Saved across restarts. The schedule is persisted to
    $DSH_HOME/dsh-cron/<sessionId>.json. When you reopen the session after a
    restart, the plugin resumes the schedule automatically and tells you it is
    running; /cron resume restarts it manually when needed, and /cron stop
    discards the saved schedule.
  • Manual stop. The schedule runs until you run /cron stop, the agent is
    disposed, or the plugin is unloaded. There is no automatic completion
    detection.

Configuration

Set config.defaultCron (a 5-field cron string) to change the schedule used by
a bare /cron <objective> with no leading cron expression. The default is
*/10 * * * * (every 10 minutes).

# your profile's cordis.patch.yml
- id: cron
  config:
    defaultCron: "0 * * * *"

Development

# syntax check
node --check lib/index.js
node --check lib/cron.js

# cron parser unit test
node test/cron.test.mjs

The plugin is a single-file ESM Cordis function plugin (lib/index.js) with no
build step. It exports apply, inject, and name, and the bundle layer
cordis.patch.yml inserts it into the profile composition.

License

MIT