Skip to main content
D

dsh-auto-plugin-factory

daphne999/dsh-auto-plugin-factory

Daily demand radar for plugin ideas: every night it collects “wanted tool” posts from Hacker News and GitHub, normalizes and dedupes them, checks each candidate against two plugin markets for an existing plugin, scores it with a fixed rubric, and writes a Markdown report (a short brief even on days with no qualifying demand). Judgment only — it never generates, installs or publishes plugin code.

Install

dsh plugin --profile web add github:daphne999/dsh-auto-plugin-factory

README

dsh-auto-plugin-factory(自动插件工厂 · P0)

每天凌晨 02:00(Asia/Shanghai)跑一遍「需求雷达」:采集 Hacker News + GitHub 上「求工具 / 求插件 / 想自动化」 的声音 → 归一化去重 → 对两个插件市场查重 → 按固定公式打分 → 写一份 Markdown 日报。

P0 只做判断,不产插件代码、不安装、不上架。 这是安全红线:不可信帖子 → 生成代码 → 自动装进宿主 = prompt injection 到 RCE 的完整链,本阶段根本不碰。

这是什么 / 不是什么

做不做(P1/P2)
HN + GitHub 采集(官方 API、免登录)小红书 / 知乎 / 即刻 / V2EX / Reddit / Product Hunt
归一化、bigram 聚类、去重键、跨天 seen向量聚类 / embedding
/dsh-market/registry(10,974 条)+ 官方 index.json(5,643 条)落 SQLite 查重自动生成插件、自动安装、自动上架、UI 面板
规则打分 + 准入 gate + Markdown 日报(无需求也出简报)让模型自由写 JS
proactive cron 02:00 + 插件启动补偿 + 同日幂等插件自己挂 24h timer 当主时钟

安装(走官方 installBundle,不要手改 profile)

在 DSH Web 的 Plugins 页面 → 添加插件 → 粘贴绝对路径:

D:\ds工作区\dsh-auto-plugin-factory

安装完成后点 Enable now。它等价于 pluginManager.installBundle(dir):pnpm link → 写入 profile bundles → HMR 重组 → 工具当场出现,重启后仍在;失败会原子还原 package.json + pnpm-lock.yaml。

不要手改 profiles/desktop/package.json:没有原子回滚,插件坏了难排查(DESIGN.md §3.2 层级 C)。 安装是设计里的人工门(§6.3),所以这一步留给用户点一下。

配置(profile 用户层 patch 覆盖)

默认配置见 cordis.patch.yml。需要改时,在 profile 的 cordis.patch.yml 里写同 id 的 config 覆盖:

- id: dsh-auto-plugin-factory
  config:
    stateDir: 'D:/ds工作区/auto-plugin-factory/state'
    schedule:
      hour: 2            # 本地整点;cron 由 dsh-proactive 注册("0 2 * * *",jitter 600s)
      timeZone: Asia/Shanghai
      compensate: true   # 开机补跑
    gate:
      minScore: 65
      minPluginability: 0.65
      minDistinctAuthors: 3
      dupThreshold: 0.72
    limits:
      pipelineBudgetMs: 1800000   # 30 分钟硬上限,调大无效(代码钳死)

阈值只能通过配置改(§6.3 阈值门),代码里不静默调。

工具

工具作用
factory_run跑今天整条流水线(同一天幂等;force=true 才重跑;budgetMinutes 1–30)
factory_report读某天日报(默认今天),includeMarkdown 可回全文
factory_candidate看某个候选的完整证据与评分明细
factory_status最近 N 天运行/数据源健康/市场快照/阈值/预算/补偿记录/宿主挂载信息
factory_selftest设计文档 §8 验证计划的可执行版本(含真实 cordis 试装+dispose)

定时与补跑

  • 主时钟:dsh-proactive 的 cron 0 2 * * *(Asia/Shanghai,jitter 600s 保留),唤醒工厂会话执行 factory_run。 已注册:alarm id alarm_mwhz231v7flb2u,nextDueAt 2026-11-16T02:03:14+08:00(jitter 落在 02:03)。
  • 插件补偿:apply 后延迟 90s 检查「今天是否已过 02:00 且还没跑过」,没跑就补一次;已跑过(哪怕别的进程跑的) 直接跳过。判断逻辑在 lib/compensate.js,纯函数可测。
  • 同日幂等:runs.run_date 主键;重复唤醒返回已有结果,不重复采集/打分。僵尸行(进程被杀)超过预算+5min 自动接管。

数据与报告

D:\ds工作区\auto-plugin-factory\state\
├─ factory.db                     # runs/items/candidates/seen/source_health/market_plugins/meta
├─ selftest-last.json             # 最近一次宿主内自检证据
└─ reports\YYYY-MM-DD.md          # 每日日报(无需求也写)

验证

# 纯 Node:§8 的骨架/去重/日报/幂等/市场 5s 解析/HN+GitHub ≥20 条
node verify/verify.mjs 59830     # 端口 = 宿主 Web 端口(拿不到就自动探测)

# 真实 cordis(从 app.asar 抽取)的试装 + dispose 无残留
node verify/cordis-mount.mjs

# 宿主内(含 5 个工具真实注册与执行、fixture 试装+dispose):
#   让模型调用 factory_selftest

证据文件:

  • verify/evidence.json —— 纯 Node 部分(自检项 + 市场解析耗时 + 相似度 top3 合理性);
  • verify/cordis-mount.json —— 真实 cordis 的挂载/卸载结果;
  • verify/host-evidence.json —— 隔离宿主里的真实加载、补偿运行、二次补偿幂等、卸载记录;
  • D:\ds工作区\auto-plugin-factory\state\selftest-last.json —— 宿主内自检(调用 factory_selftest 后生成)。

打分(可复现,DESIGN.md §4.3)

F = min(1, log2(1+独立作者数)/3)
H = min(1, log10(1+points+comments+stars)/4)
C = 0 / 0.5 / 1(是否明确「求」+ 是否有具体对象)
P = 0..1(可插件化,规则版 rubric)
E = min(1, 独立来源数/3)
S = 100*(0.30F + 0.20H + 0.20C + 0.20P + 0.10E)

准入:S ≥ 65 且 P ≥ 0.65 且 独立作者 ≥ 3 且 topMarketSim < 0.72 且无风险否决。 「今日无需求」是常态,不是失败;不改阈值来凑产出。

安全约定

  • 帖子正文只入库、只做摘要与证据;截断、去 Markdown/HTML 活性后再进日报(sanitizeText);
  • 日报每候选 ≤5 条证据、每条 ≤200 字;
  • 不把抓取内容拼进任何指令区;
  • P0 不生成/安装/上架,safeMode: true 写在配置里。

Related plugins