Introduction¶
DeepSeek Harness (DSH) extends its functionality through a plugin system. In development or daily use, repetitive operations for specific scenarios—such as periodic data checks and automatic report generation—are inefficient to perform manually. The dsh-knj-scheduler plugin solves this problem by allowing users to automatically start prompt sessions or KNJ workflow tasks using Cron expressions or other trigger methods.
Plugin Overview¶
dsh-knj-scheduler is a scheduled task dispatcher plugin. It addresses the need for automated execution and supports launching sessions or workflow tasks on a schedule. The plugin is maintained by yangdongzhen590 and is released under the MIT open-source license.
Core Features¶
- Automatic Triggering: Supports automatically starting prompt sessions or KNJ workflow tasks using a Cron expression, a specific one-time time, or an interval in minutes.
- Panel Entry: Provides a “More → Scheduler” entry in the left sidebar (depends on the
dsh-knj-menuplugin). - Two Tabs and Pagination: The panel includes “Task List” and “Execution Records” tabs, both supporting pagination with 10/25/50/100 entries per page.
- Working Directory Configuration: Supports configuring the working directory. Prompt sessions may specify a workspace, while workflow tasks must specify one.
- KNJ Workflow Integration: Optionally integrates
dsh-knj-workflowand supports referencing file inputs by path. - Status and History: Records execution status (success/failure/skipped) and duration. Execution history is limited to 500 entries.
- Persistence: Task definitions are persisted in the profile directory and are automatically restored after restart.
Install and Enable¶
Installing this plugin requires installing the dsh-scheduler core package and the dsh-knj-menu dependency.
dsh plugin --profile web add dsh-scheduler dsh-knj-menu
Typical Usage¶
- Open Panel: Click “More → Scheduler” at the bottom of the left sidebar.
- Create a Task:
- Click “New Task”.
- Select the task type: “Prompt Session” or “KNJ Workflow”.
- Fill in the relevant fields: prompt, workflow, title, working directory, and file input path (required in workflow mode).
- Scheduled Execution: After saving the task, the system will schedule it automatically according to the plan. Prompt mode creates a session, while workflow mode launches a workflow task via
dsh-knj-workflow. - Task Management: For a task row, you can edit it, enable or pause it, run it immediately, view its history, or delete it.
- View Details:
- In “Execution Records”, click “Open Session” for a prompt task.
- For a workflow task, click “View Workflow Task” to go directly to the workflow run details.
Notes¶
- Security Validation: Write operations only accept same-origin POST/PUT/DELETE requests (Origin and Host validation). Task definition parameters must be validated before writing, and writes use atomic persistence.
- File Inputs: File input parameters are only shape-validated; path existence is not validated (it is validated before launch by
dsh-knj-workflow). - History Records: Execution history only records status, duration, session ID, or workflow task ID. It does not record the original prompt text or session content.
- Concurrency Control: Task execution consumes model quota. Tasks do not run concurrently by default to prevent reentry; if the previous run has not finished, the current trigger is automatically skipped.
- Data Locations:
- Task definitions:
$DSH_HOME/profiles/<profile>/dsh-scheduler/tasks.json - Execution history:
$DSH_HOME/profiles/<profile>/dsh-scheduler/history.l
- Task definitions:
Conclusion¶
dsh-knj-scheduler provides DSH with automated execution capabilities through Cron scheduling and persistent configuration. Developers can automate background tasks by configuring workflows and sessions. For more details, see the GitHub repository.