Back to home@ZhongRuiYu-mine

math-modeling-plugin

No description

Stars
0
Language
TypeScript
Created
Aug 29, 2026
Updated
Aug 29, 2026

Introduction

math-modeling-plugin

数学建模智能助手 —— DeepSeek Harness (DSH) 的数学建模插件。

自动进行问题分析、数值模拟与解析求解:高精度运算、常微分方程数值求解、符号回归、Python 代码生成与执行,并通过 **math-modeling-plugin** 输入标记在 DSH Web 会话中一键指定使用。

功能特性

  • 高精度计算precision_calculator(+ - * / ** sqrt sin cos tan log exp pi e)
  • ODE 数值求解ode_numeric_solver(RK45 / RK23 / Radau / BDF / LSODA)
  • 符号回归symbolic_regressor(gplearn,从数据自动发现数学表达式)
  • Python 工程python_code_generator / python_code_executor(生成、审批、执行 Python 程序)
  • 专家工作流:规律发现(symbolic_regressor)→ 路径决策(解析推演 / 数值求解)→ 计算交给工具 → 结构化解读结果
  • 专属 Skillskills/math-modeling-plugin/SKILL.md,安装到 ~/.dsh/skills/ 后随会话自动发现

目录结构

math-modeling-plugin/
├── src/                     # TypeScript 源码
│   ├── index.ts             # 原有入口(面向旧版 DSH 接口,保留未改动)
│   ├── dsh-entry.ts         # DSH 适配入口(增量修复新增):工具注册 + 提示片段 + 标记检测
│   ├── tools/               # 5 个数学建模工具
│   ├── engines/             # Python 执行引擎
│   ├── prompts/             # 专家提示词(主控/数值/解析/规律发现)
│   └── types/
├── skills/math-modeling-plugin/SKILL.md   # 插件专属 Skill
├── scripts/setup.sh         # 依赖安装脚本
├── package.json             # 含 exports 映射:"./dsh" -> dist/dsh-entry.js
└── cordis.yml               # 插件元数据(依赖、环境要求、配置项)

安装到 DSH

  1. 将本目录链接为 DSH profile 的依赖(web profile 示例):

    {
      "dependencies": {
        "math-modeling-plugin": "link:<本目录绝对路径>"
      }
    }
    
  2. 构建:

    cd math-modeling-plugin
    pnpm install
    pnpm build        # tsc -> dist/
    
  3. 在 profile 的 cordis.patch.yml 中挂载(保存后热重载,无需重启):

    - insert:
        - id: math-modeling-plugin
          name: math-modeling-plugin/dsh
    
  4. 安装专属 Skill(任选其一):

    • 复制 skills/math-modeling-plugin/~/.dsh/skills/math-modeling-plugin/;或
    • 将插件目录加入 preset 的 skill-filesystem.customSkillDirs

验证:Web 设置 → 插件列表可见 math-modeling-plugin/dsh(状态 active);会话工具列表中可见 5 个数学工具。

使用方式

在 Web 输入框中以 **math-modeling-plugin** 标记指定使用本插件,例如:

**math-modeling-plugin** 帮我建立传染病 SIR 模型的微分方程并求解

插件会注入数学建模模式指令:规律发现 → 路径决策 → 调用数学工具计算 → 结构化解读结果。不写标记时,若提问涉及数学建模、方程、优化、模拟、预测、拟合、回归、微分方程等需求,也会进入数学建模模式。

环境要求

  • DeepSeek Harness(Cordis 插件体系,需 tools / systemPrompt / sessions 服务)
  • Python 3.8+,依赖:numpyscipygplearnsympy
  • 注意:src/engines/python-executor.ts 中 Python 解释器路径为本地环境值(D:\mathmodel\Scripts\python.exe),部署到其他机器时请改为本机 Python 路径或从 PATH 解析。

已知限制与后续工作

  • python-executor.ts 硬编码了 Python 解释器路径,未做成可配置项。
  • **math-modeling-plugin** 标记的激活指令由 agent/pre-step 注入,属轻量增强;深度专家链(子 Agent 编排)为后续版本预留(提示词已在 src/prompts/ 就绪)。
  • 工具声明了 timeoutMs 但未转发 exec.signal,超时依赖 Python 子进程自身结束。

License

ISC