Training workbench for competitive programming — syncs Codeforces and AtCoder submissions, profiles weak tags, picks a daily three-band problem set, reviews contests, and keeps a check-in calendar. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-algorithm-tools
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:SpringRinbowCat/dsh-algorithm-tools
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
算法训练台 — DeepSeek Harness 插件。
把 Codeforces / AtCoder 的刷题数据接进 DSH:同步提交、弱项分析、每日三档训练、Rank 复盘、赛事列表、日历打卡。能力分两层:
- 10 个
icpc_*agent 工具 — 在对话里直接让 AI 帮你同步、选题、复盘 - 右侧面板 — 日历 / 数据概览 / 赛事 三个视图,外加一键功能按钮
当前版本 0.2.2。
快速上手
# 1. 安装(会转发给 pnpm,在 profile 目录里执行)
dsh plugin --profile desktop add dsh-algorithm-tools # 从 npm 装(推荐)
# 或跟随仓库最新提交:
dsh plugin --profile desktop add github:SpringRinbowCat/dsh-algorithm-tools
- 重启 DeepSeek Harness(Host 侧插件不支持热重载)
- 打开任意会话 → 点右上角图标打开 Algorithm Practice Space 面板(必须打开一次,
icpc_*工具才会注册进当前会话) - 在对话里依次执行:
icpc_settings action=set_account platform=codeforces handle=你的CF用户名
icpc_settings action=set_local_root root=/Volumes/kingston/codeforces
icpc_sync platform=codeforces bank=true # 首次同步题库约 10–30 秒
icpc_today # 生成今天的训练
面板
三个视图,用左右箭头切换:
| 视图 | 内容 |
|---|---|
| 日历 | 近 12 周训练热力图、连续打卡(跳过周日)、今日训练进度 |
| 数据概览 | 提交/AC 统计、难度分布、标签分布、12 周趋势、弱项 |
| 赛事 | CF + AtCoder 近期比赛(进行中 / 即将开始) |
右侧功能按钮(点击后把对应指令交给当前会话的 agent):
| 按钮 | 作用 |
|---|---|
| 今日训练 | 生成/读取今天的 6 道题(巩固 2 / 同段 3 / 挑战 1) |
| 同步数据 | icpc_sync_all:同步提交 + 提交并推送本地仓库 |
| 题库刷新 | icpc_sync bank=true:只拉题库,不动代码 |
| rank 复盘 | icpc_review action=contests:近期比赛复盘 |
| 加训 | 今日完成后出现;周日休息日也可加训 |
打开面板时会自动增量同步(服务端 30 分钟内只拉一次);今日训练完成后会额外拉一次最新数据。
Agent 工具(10 个)
| 工具 | 主要 action / 参数 | 说明 |
|---|---|---|
icpc_sync |
platform(all/codeforces/atcoder)、handle、bank |
增量同步提交;bank=true 顺带刷题库 |
icpc_sync_all |
contestId |
同步 + 处理 rank/_pending + 提交推送仓库 |
icpc_stats |
type(overall/weakness/trend) |
统计分析 |
icpc_today |
consolidation/core/challenge/rotate/windowDays/extra |
今日三档训练;周日默认休息,extra=true 可加训 |
icpc_review |
contests / contest |
Rank 复盘 |
icpc_contests |
action(upcoming/finished) |
赛事列表 |
icpc_checkin |
status/streak/month/date/checkin/uncheck |
日历打卡 |
icpc_problems |
platform/difficulty/tag/q/bank |
浏览题库 |
icpc_settings |
get/set_account/set_ai/set_adapter/set_cookies/set_reminder/set_local_root |
设置(返回时密钥脱敏) |
icpc_maintenance |
stats/clear_submissions/clear_all |
数据维护:查看量级、清空提交、清理旧字段 |
工具是按会话注册的:新会话需要先打开一次右侧面板。没打开时调用会报
unknown tool "icpc_*"。
今日训练怎么算
icpc_today 的三档推荐:
- 能力值 = 当前 rating:直接取 Codeforces 当前 rating,四舍五入到 100 分档。 拉不到 rating 时才回退到「近 60 天刷题 AC 难度中位数 × 0.6 + 比赛 AC 难度中位数 × 0.4」。
- 按目录锁定:先看
<训练根>/practice/<今天>/,已经有题目文件夹就按已有的出推荐,不重新抽题—— 这样两台电脑从 GitHub 同步同一份目录时不会各抽一套。目录为空才新抽。 - 落盘成文档:把三档题目和选题理由写成
practice/<今天>/<今天>.md,随仓库提交,另一台机器打开就是同样的安排。
选题依据:弱项标签命中 → 近期比赛失分标签 → 本周训练方向,按距离档位中心的距离排序。
训练仓库约定
推荐结构(localRoot 指向仓库根):
codeforces/
├── practice/<YYYY-MM-DD>/<题目>/<题目>.cpp # 日常训练 & 赛后补题
├── practice/<YYYY-MM-DD>/<YYYY-MM-DD>.md # 当天训练安排
├── rank/<比赛号>/<比赛号><题号>/<比赛号><题号>.cpp # 比赛代码
兼容旧格式:practise/<日期>/...;只要目录名或 .cpp 文件名能匹配 2283C / 1858E1 这类题号即可。
0.1.7 起移除了独立的「训练计划」体系(计划视图、计划按钮、
taskList/*.md、icpc_generate_plan/icpc_manage_plan)。每日训练本身已经覆盖了它的作用。
比赛当场不输比赛号:rank/_pending
比赛时不知道 contest id 也能建题:
- Sublime 里按
Ctrl+Alt+R→ 输A/B/C1→ 文件落在rank/_pending/A/A.cpp - 赛后点「同步数据」→ 插件发现
_pending,先返回needContestId和题号列表,不提交 - 你回一个比赛号 → 自动重命名成
rank/<比赛号>/<比赛号>A/<比赛号>A.cpp、改写题链,再提交推送
对应工具调用:icpc_sync_all,有 _pending 时先不带 contestId,拿到清单后再带 contestId=2280。
冲突策略:远端为准
icpc_today / icpc_sync / icpc_generate_plan 动手前都会 git pull。pull 冲突时:
git rebase --abort/merge --abort,不让仓库卡在冲突状态- 只把「安排类」路径强制对齐远端(
practice/<日期>/<日期>.md) - 同一批差异里的
*.cpp也按远端覆盖,其他文件不动 - 对齐后立即同步进面板,不再追问
换 Codeforces 账号
icpc_settings action=set_account platform=codeforces handle=新用户名
icpc_sync platform=codeforces
不需要手动清数据:提交记录从 0.1.3 起带 handle 字段,统计、日历、弱项都按当前绑定账号过滤:
- 换号时,没有
handle的旧记录会自动归到旧账号名下,不会算成新号的账 - 想彻底清空历史(比如重建):
icpc_maintenance action=clear_all
注意:
icpc_maintenance必须在插件进程内部执行。直接改磁盘上的 state 文件会被运行中的进程用内存副本覆盖——退出时还会再刷一次盘。
数据与目录
| 内容 | 位置 |
|---|---|
| 插件状态(题库缓存 / 提交 / 训练索引 / 设置) | $DSH_HOME/.icpc-data/icpc-state.json,未设 DSH_HOME 时是 ~/.icpc-data/icpc-state.json |
| 启动探针 | 同目录 icpc-boot.log(排查数据目录用) |
| 训练仓库 | icpc_settings action=set_local_root 设置;未设置时依次尝试 D:\codeforces、~/codeforces |
state 文件不跟 git 同步:每台机器路径和账号绑定不同。能算出来的数据(提交、AC、弱项、打卡)都可以从 CF 重新拉;题库缓存重建约 10–30 秒。
读写模型:启动时读一次进内存 → 运行中改内存 → 500 ms 防抖落盘 → 退出时再写一次。所以:
- 运行中直接编辑 state 文件无效
- 清库必须走
icpc_maintenance - 文件损坏时插件会把坏文件改名成
.corrupt-<时间戳>留档,然后从空状态启动
配置
cordis.patch.yml 里的挂载行(profile 层):
- insert:
- id: algo-trainer
name: 'dsh-algorithm-tools'
config:
dataDir: '' # 留空 = $DSH_HOME/.icpc-data
localRoot: '' # 留空 = D:\codeforces → ~/codeforces
ai:
enabled: false
baseURL: 'https://api.deepseek.com/v1'
apiKey: ''
model: 'deepseek-chat'
dataDir / localRoot / ai 也可以运行时用 icpc_settings 改(持久化进 JSON),get 返回的 apiKey / cookie 是脱敏的。
目录结构
dsh-algorithm-tools/
├── package.json # dsh.bundle(patch)+ dsh.client(platform: web)
├── cordis.patch.yml # 挂载行
├── tsconfig.json / tsconfig.client.json
├── scripts/wrap-client.mjs # 把 client bundle 包成 __ModuleLoader__ 格式
├── src/ # Host 侧
│ ├── index.ts # apply():store 初始化 + 路由 + 工具注册
│ ├── activation.ts # 按会话激活工具(ICPC_TOOL_NAMES + /algorithm-tools/activate)
│ ├── dsh-compat.ts # Context / Tool / Fs / Config 兼容层
│ ├── types.ts
│ ├── workbench-overview.ts # GET /algorithm-tools/overview(日历视图)
│ ├── workbench-contests.ts # GET /algorithm-tools/contests(赛事视图)
│ ├── workbench-sync.ts # POST /algorithm-tools/sync(面板自动同步)
│ ├── store/
│ │ ├── schema.ts # JSON 数据模型(含 SubmissionRecord.handle)
│ │ └── index.ts # IcpcStore:内存索引 + 防抖落盘
│ ├── adapters/ # codeforces.ts / atcoder.ts / types.ts
│ ├── analysis/ # stats / weakness / trend / tags / today(纯函数)
│ ├── util/ # local-scan / local-date / git 等
│ └── tools/ # 10 个工具,一个文件一个(maintenance.ts 是数据维护)
├── client/ # Client 侧(面板 UI)
│ ├── index.ts # apply():注册 tab、header 按钮、设置项
│ ├── WorkbenchPanel.tsx # 主面板:功能按钮 + 视图切换
│ ├── VizPanel.tsx # 三个视图:日历 / 数据概览 / 赛事
│ ├── features.ts # 功能目录(按钮 → 提示词)
│ ├── betterSidebar.ts # 有 better-sidebar 时的适配
│ └── api.ts
└── tests/ # 40 个测试(6 个文件)
开发
pnpm install
pnpm build # tsdown 打包 + wrap-client 包装
pnpm test # tsx --test tests/**/*.test.ts
pnpm typecheck # Host 侧类型检查(仓库里存在若干历史类型告警)
pnpm typecheck:client
仓库自带构建好的 lib/,直接安装不需要本地编译;改源码才需要 build。
本地调试:
dsh plugin --profile desktop add file:/path/to/dsh-algorithm-tools
训练下限(0.2.1+)
icpc_today 直接用 Codeforces 当前 rating 定档,但 rating 低于 1200 时锁定 1200:
能力值:1200(当前 rating 571,低于 1200 按 1200 训练)
避免新号或掉分后只出 600–900 的题。rating 到 1200 以上后自动按真实分数分档。
周日休息(0.2.2+)
- 周日不生成每日训练题,
icpc_today默认返回休息日 buildTodayStatus默认done = true,日历显示「周日休息日」- 本月打卡和连续打卡都跳过周日;周日当天加训的 AC 不计入打卡
- 想加练时点「加训」(或调用
icpc_today extra=true),仍可生成加练题
版本记录
| 版本 | 变更 |
|---|---|
| 0.2.2 | 周日休息日、打卡/连续跳过周日、周日可加训 |
| 0.2.1 | rating 低于 1200 锁定 1200;发布到 npm |
| 0.2.0 | 内部标识符统一为 algorithm-tools(路由 / CSS / tab id) |
| 0.1.7 | 移除训练计划体系(计划视图、计划按钮、taskList、icpc_generate_plan/icpc_manage_plan);移除模板库、复习库残留 |
| 0.1.3 | 提交记录带 handle,换号后按当前账号隔离统计 |
发布(维护者)
pnpm build && pnpm test # 或直接依赖 prepublishOnly
npm --cache /tmp/npm-cache publish # 走浏览器 2FA;本机 ~/.npm 有 root 文件,需换 cache
dsh plugin --profile desktop add dsh-algorithm-tools@<新版本>
排错
| 现象 | 原因 / 处理 |
|---|---|
调用报 unknown tool "icpc_*" |
该会话还没激活:打开一次右侧面板(或 POST /algorithm-tools/activate 带 sessionId) |
| 面板点开全白 | 客户端组件渲染时抛错。用 renderToStaticMarkup(<WorkbenchPanel />) 跑一遍能直接看到异常(历史上就踩过残留 prop 导致的 xxx is not defined) |
控制台 Unexpected end of JSON input |
某个接口返回 404 空响应。面板已用 readJson 兜底:空 body / 非 JSON 返回 null,不再拖垮整个面板 |
| 数据改了又被改回去 | 运行中的进程用内存覆盖磁盘。清数据走 icpc_maintenance,或退出 App 后再改文件 |
| 换号后统计还是旧的 | 确认插件是 0.1.3+(提交记录带 handle);仍不对就 icpc_maintenance action=clear_all 再同步 |
Client 契约
package.json 里:
"dsh": {
"bundle": { "patch": "./cordis.patch.yml" },
"client": {
"platform": "web",
"inject": [
"@deepseek-ai/dsh-client-ui-conversation",
"@deepseek-ai/dsh-client-ui-slots",
"@deepseek-ai/dsh-client-ui-sidebar-right"
],
"external": []
}
}
- Host 侧
inject = ['tools', 'agents', 'webServer']:工具注册、按会话激活、面板数据路由 - Client 侧注册一个 tab(
algorithm-tools.workbench)、会话头部按钮(Algorithm Practice Space)、设置页条目(算法训练台) - 装了
dsh-better-sidebar时走ctx.betterSidebar(tab idalgorithm-tools:workbench),否则回退 DSH 原生右侧栏
测试
pnpm test
40 个用例,覆盖:纯函数分析(难度分档、弱项打分、趋势、Markdown 渲染)、rating 训练下限、工具按会话注册、客户端功能目录、better-sidebar 描述符、换号后的数据隔离、旧字段清理。
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 37546
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 36997
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
superdesigndev/treg★ 8164
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 5864
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
sixtysevenlf/dsh-blender-plugin★ 2147
Lets a DSH agent drive a local Blender over a direct TCP channel with 15 tools: viewport frames, custom-angle renders, Python execution, headless and job offload, transaction rollback, and a planning layer of 228 ops across 34 families.
helloHub1212/dsh-windows-mcp★ 1456
Bridges the CursorTouch/Windows-MCP desktop automation server into DSH through the official MCP client bridge, registering its screenshot, UI tree snapshot, mouse and keyboard input, clipboard, process and registry tools as mcp__windows__* tools for the model, and adds a windows_mcp_doctor diagnostic tool. Computer Use is off by default and is switched on from the plugin panel.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.