nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:DaYePython/dsh-input-optimize
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
给 DeepSeek Harness(DSH) 的输入框加一个「一键优化提示词」按钮:点击后调用你当前选中的模型,把草稿改写成更清晰、更具体的提示词,再写回输入框。
@文件 / 图片附件引用 chip,只改纯文本部分@文件、图片附件)。模型优先使用输入框当前选择(含 reasoning effort);没有选择时回退到当前 Agent 的模型。
需要 DSH 桌面端或 dsh CLI。一条命令即可从 GitHub 安装本插件:
dsh plugin --profile web add github:DaYePython/dsh-input-optimize
dsh plugin 会把包装进该 profile,并自动识别包里的 dsh.bundle 元数据、把 dsh-input-optimize
追加到 dsh.profile.bundles;本仓库的 cordis.patch.yml 随之作为 bundle 层生效,不需要手写 insert。
dsh 没有加入 PATH 时,用桌面端自带 CLI 的绝对路径执行(见下文「安装」)。dsh web(或对应 profile 的应用),再刷新页面。| 部分 | 位置 | 说明 |
|---|---|---|
| 浏览器半 | client/client.js |
单文件、无构建的客户端 bundle;占用 conversation.input.right 槽位(order: -10)。 |
| Host 半 | lib/index.js |
注册共享 /api Fetch 路由 /api/input-optimize/optimize,并保留 /input-optimize 前缀通道作为兼容回退。 |
| 提示词 | lib/prompt.js |
纯函数:构造 system/user 提示词、剥围栏、清洗模型输出。 |
| 测试 | test/*.test.mjs |
node --test,零依赖、零构建。 |
请求链路:浏览器通过 ctx.connection.rpc.call('/api', 'input-optimize/optimize', payload) 调 Host;
Host 用 ctx.llm.stream(...) 调当前模型,聚合 text-delta 后返回 { optimized }。
按钮点击
→ maskDraft(draft, occurrences) 引用 chip 换成 ⟦REF<n>⟧ 占位符
→ rpc.call('/api', 'input-optimize/optimize') 带上 maskedText、附件名、当前模型
→ Host:buildUserPrompt(附件清单置顶) → ctx.llm.stream(...) → stripFences
→ unmaskDraft(optimized, slots) 校验占位符齐全且有序,还原 chip
→ 确认 draftRev 未变 → inputActions.setDraft({ text, references })
请求在途时按发送(默认发送会乐观清空草稿;命令提交进入 adjudicating/submitting)
→ revoke:标记 request.revoked + abort RPC 的 AbortSignal + 退订发送回显监听
→ 浏览器 fetch 断开 → Host 侧 request.signal abort → ctx.llm.stream 立即取消
→ 迟到的结果一律丢弃,不写回、也不出现在 tooltip 里
任何一步失败都不会写回输入框,错误原因进 tooltip;主动撤销(内容已发出)则静默回到空闲态。
需要 DSH 桌面端或
dshCLI。手动改 profile 时请先完全退出 DSH 桌面应用。
dsh plugin --profile web add github:DaYePython/dsh-input-optimize
dsh plugin 会在 profile 目录里用 pnpm 安装依赖,并自动识别包的 dsh.bundle 元数据、把
dsh-input-optimize 追加到 dsh.profile.bundles;本仓库的 cordis.patch.yml(dsh.bundle.patch)
随之作为 bundle 层生效,不需要手写 insert。
dsh 随桌面端提供;没有加入 PATH 时可直接用绝对路径:
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" \
plugin --profile web add github:DaYePython/dsh-input-optimize
桌面端的 desktop profile 由应用独占管理:在 DSH 设置 → 插件 页安装/启用同一个 GitHub 源即可,
或退出应用后用应用自带 CLI 执行 dsh plugin --profile desktop ...。
升级:重复执行同一条命令(或 dsh plugin --profile web update dsh-input-optimize)。
卸载:dsh plugin --profile web remove dsh-input-optimize。
装完重启 dsh web(或对应 profile 的应用)并刷新页面——客户端 bundle 由 /plugins 按文件 mtime 发版。
在 profile 的 package.json dependencies 里加一行(macOS 默认路径 ~/.dsh/profiles/desktop/package.json):
"dsh-input-optimize": "github:DaYePython/dsh-input-optimize"
本地源码调试可改用目录路径:"dsh-input-optimize": "file:/path/to/dsh-input-optimize"。
在 profile 目录安装依赖:
cd ~/.dsh/profiles/desktop
pnpm install
没有本机 pnpm 时,可用桌面端内置运行时(路径随版本/安装位置变化):
NODE="/Applications/DeepSeek Harness.app/Contents/Resources/runtime/primary-runtime/dependencies/node/bin/node"
PNPM="/Applications/DeepSeek Harness.app/Contents/Resources/runtime/primary-runtime/dependencies/pnpm/bin/pnpm.cjs"
"$NODE" "$PNPM" install
在 profile 的 cordis.patch.yml 追加加载行(手动写依赖时必需):
- insert:
- id: input-optimize
name: dsh-input-optimize
启动应用并刷新页面。
不再需要本插件时,用 dsh plugin 把它从 profile 中移除:
dsh plugin --profile web remove dsh-input-optimize
该命令在 profile 目录里执行 pnpm 移除依赖,并把 dsh-input-optimize 从 dsh.profile.bundles
的有序层列表里移除,无需手动改 profile 文件。完成后重启 dsh web(或对应 profile 的应用)
并刷新页面,输入框工具行里的优化按钮即不再出现。
desktop profile 由应用独占管理:在 DSH 设置 → 插件 页禁用或卸载同一个插件即可。package.json 里的 dsh-input-optimize 依赖行,以及
cordis.patch.yml 里对应的 insert 条目,再在 profile 目录重跑 pnpm install。npm test # 77 项单测(node --test,零依赖)
npm run check # node --check 语法检查
无依赖、无构建步骤。desktop profile 使用 nodeLinker: hoisted,安装后的 node_modules/dsh-input-optimize 是副本而不是符号链接,因此改完源码还要同步一次(或重跑 pnpm install):
cp client/client.js ~/.dsh/profiles/desktop/node_modules/dsh-input-optimize/client/client.js
dsh-client-hmr 每 500ms 按 mtime 轮询客户端 bundle,同步后会自动热加载;Host 半(lib/*)改动仍需重启应用。
conversation.input.right 槽位、useInput / inputActions 标准 props 和会话发送回显(pendingSubmissions);缺少发送回显时会退化为「草稿被清空 / phase 进入提交」两个信号。draftRev),请求本身仍会跑完;只有「内容被发出去」才撤销请求。⟦REF<n>⟧ 占位符,结果会被丢弃,输入框保持原样。| 现象 | 排查方向 |
|---|---|
| 输入框里看不到按钮 | 确认草稿非空;确认插件已加载(Host 日志里有 input-optimize: host half ACTIVATED);刷新页面。 |
dsh: command not found |
用桌面端自带 CLI 的绝对路径执行,或改用手动写 profile 的方式二。 |
| 点击后提示「宿主未提供 RPC 通道」 | DSH 版本过旧或客户端没有暴露 connection.rpc,检查 DSH 版本。 |
| 改了代码页面没变化 | 客户端 bundle 是 profile 里的副本:先同步 client/client.js(或重跑 pnpm install),再刷新页面。 |
| 优化一直失败 | 检查当前选中模型是否可用、网络是否正常;具体原因在按钮 tooltip 里。 |
MIT © 2026 DaYePython
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: prompt。