Back to home@kumanana66

dsh-automation

RPA-style scheduled web automation for DeepSeek Harness: record browser operations -> requirements doc -> LLM generates Python + Playwright -> schedule with run records and email notifications

Stars
0
Language
JavaScript
Created
Sep 1, 2026
Updated
Sep 1, 2026

Introduction

dsh-automation

DeepSeek Harness 的 RPA 式定时网页自动化插件:录制操作 → 生成需求文档 → LLM 生成 Python+Playwright 代码 → 配置触发器定时执行 → 记录运行结果并邮件通知

使用流程

  1. 打开 Harness Web UI(默认 http://127.0.0.1:3080)→ 设置 → 自动化任务
  2. 点「新建自动化任务」:
    • 方式 A:录制操作 — 输入起始网址点「开始录制」,会弹出一个可见的 Chrome 窗口,你在里面正常操作(点击/输入/翻页),每一步自动截图。按 F9 或点浮动「停止录制」按钮结束,然后点「生成需求文档」。
    • 方式 B:手动写需求 — 跳过录制直接编写需求文档。
  3. 微调需求文档(可编辑)。
  4. 点「生成自动化代码」→ LLM 生成 Python + Playwright 脚本(可编辑)。
  5. 运行配置:下载/获取内容的保存目录、运行记录存储目录、通知邮箱。
  6. 触发器:cron(如 0 9 * * * 每天 9 点)/ 间隔 / 一次性 / 仅手动。
  7. 保存。任务到点自动执行;每次运行生成一份 .md 运行记录,可选 SMTP 邮件通知。

服务端 API(/dsh-automation/*

接口说明
GET /status插件状态
GET/POST /config读写配置(LLM provider/model、Python 路径、SMTP、目录)
GET /models列出可用 LLM provider 与模型
GET/POST /tasks任务列表 / 新建任务
GET/PUT/DELETE /tasks/:id任务详情 / 更新 / 删除
POST /tasks/:id/run立即运行一次
POST /tasks/:id/enable启用 / 停用触发器
GET /tasks/:id/runs运行历史
POST /record/start POST /record/stop GET /record/status录制器控制
POST /generate/requirement录制数据 → 需求文档
POST /generate/code需求文档 → Python 代码
POST /notify/test发送测试邮件

配置

  • LLM:复用 harness 的 ctx.llm(provider 如 deepseek-official / ali),不单独消耗 API key;留空自动选择。
  • Python:生成脚本用 python 配置的执行(默认 D:\Anaconda3\python.exe),需 pip install playwrightplaywright install chromium
  • 邮件:SMTP 配置(host/port/账号/授权码)+ 收件邮箱。agent-mail MCP 适配器可后续接入(代码中 notifier.notify 是唯一出口)。

数据存储

$DSH_HOME/profiles/web/data/dsh-automation/

  • tasks/*.json 任务定义(需求、代码、触发器、配置)
  • runs/<taskId>/*.json 结构化运行记录
  • recordings/*/ 录制数据(steps + 截图)
  • settings.json 插件配置

开发说明

  • 服务端:lib/index.js(cordis 插件,inject: ['webServer', 'llm']),HTTP 路由用 ctx.webServer.register({ kind: 'prefix', path: '/dsh-automation', handler })
  • 客户端:client/client.js 通过 window.__ModuleLoader__.load 注入,ctx.slots.inject('settings.section', ...) 挂载设置页。
  • 录制器:runner/recorder.py(headed Chromium + 注入录制脚本,F9 停止)。