ybyz2/dsh-grill-prompt ↗★ 0

dsh-grill-prompt

Grill-flow prompt optimizer for the dsh web UI: a sparkle button beside the send button turns the draft into a design-tree interview (grilling), then writes the refined prompt back into the composer. 核心用途是优化和打磨输入框中的提示词草稿。适合希望通过结构化多轮问答提升 AI 回复质量的用户,支持自定义 API 且 Key 不落盘。

Package
dsh-grill-prompt
Compatibility
Unverified
Version
0.1.0
License
MIT
Last updated
Sep 6, 2026

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

dsh-grill-prompt

Grill-flow prompt optimizer for dsh (DeepSeek Harness) web UI. · 简体中文

发送按钮左边多一颗 ✨:点它,输入框里的草稿会被交给模型按 grilling(设计树轮次提问法) 打磨——逐轮提问、点选或自由作答,全部答完后优化好的提示词自动填回输入框,由你检查后发送。全程不污染聊天记录。

功能

  • ✨ 按钮:挂在 composer 工具行、发送按钮隔壁;输入框为空时禁用,grill 进行中变成取消按钮
  • 面试面板:输入框上方窄卡,显示 第 N 轮 · 第 i/M 题 进度;每题展示模型给出的候选答案(1~5 个,带「推荐」角标)+ 固定的「其他(输入你自己的答案)」自由输入
  • 多轮面试:每轮回答自动触发下一轮;最多 6 轮、每轮最多 5 题,超出自动收尾
  • 单纯优化模式:设置页关掉 grill 开关后,按钮 = 一步优化直接回填,不出面板
  • 模型三选一:当前会话模型(默认)/ 当前 API 其他模型 / 自定义 OpenAI 兼容 API(Base URL + Key + Model)
  • Key 不落盘:自定义 API 的 Key 只存在浏览器 localStorage,每次调用经 RPC 传给 host,host 端不保存

安装(终端用户)

前提:dsh 0.1.1-rc.2(其他 rc 版本未验证)。本仓库已提交构建产物 lib/,clone 后无需安装依赖、无需构建。

  1. 把仓库 clone 到任意目录:

    git clone https://github.com/ybyz2/dsh-grill-prompt.git
    
  2. 编辑你的 profile 的 cordis.patch.yml(默认在 /profiles/web/cordis.patch.yml),加一个 insert 条目:

    - insert:
        - id: dsh-grill-prompt
          name: 'dsh-grill-prompt'
    
  3. 在同目录 package.json 的 dependencies 里加一行 link 依赖(路径换成你的 clone 目录):

    "dsh-grill-prompt": "link:D:/path/to/dsh-grill-prompt"
    
  4. 在 profile 目录执行一次 pnpm install,然后重启 dsh。

  5. 打开 Web UI → 输入框有内容 → 点 ✨。首次使用请确认 dsh 已配置模型(API Key 走 dsh 自己的「设置 → 模型」页或启动弹窗),或在插件设置里改用自定义 API。

工作原理

✨ 按钮 (conversation.input.right)
  └─ client 引擎:状态机 IDLE → WAITING → ASKING ⇄ WAITING → DONE
       └─ Typert RPC (namespace "grill")
            └─ host 服务 GrillService(cordis Service,Typert manifest 严格校验)
                 ├─ dsh provider 路由 → ctx.llm.stream()
                 └─ 自定义 API → OpenAI 兼容 /chat/completions
                      ↓
       system prompt = grilling skill 全文 + JSON 输出契约
       {done:false, questions:[…]} → 面板提问 → {done:true, finalPrompt} → setDraft 回填
  • client↔host 通信走 dsh 官方的 Typert RPC:client 侧通过公开 API ctx.remote.$mount() 运行时挂载第三方 namespace(与官方七个 namespace 同一机制),host 侧以 TypertRemoteService + TYPERT manifest 注册
  • LLM 输出强制 JSON:失败自动重试一次,仍失败按 grilling 原生 markdown(❓/➡️)兜底解析
  • host 半区零静态依赖:运行时从 dsh 进程入口定位并共享 app 自己的 cordis / typert-protocol 模块实例,bundle 仅 ~15 KB

面向开发者:构建

npm install        # esbuild / zod / dsh 类型(devDependencies)
npm run build      # 产物写入 lib/(client.js + index.js + typert 两个伴随入口)
  • 改源码 → npm run build → 重启 dsh 生效
  • 构建脚本 scripts/build-local.mjs 用纯 esbuild 复刻 dsh 官方 client bundle 契约(CJS closure-factory + window.__ModuleLoader__ 包装 + CSS modules 内联)
  • lib/ 提交进仓库:终端用户不需要 Node 环境

目录结构

├── scripts/build-local.mjs      # esbuild 构建(client / host / typert 伴随入口)
├── src/
│   ├── wire.ts                  # 两半区共享的纯类型与校验(无依赖)
│   ├── schemas.ts               # zod wire schema(client bundle 用)
│   ├── prompts.ts               # grilling skill 全文 + JSON 契约 + 优化指令
│   ├── llm.ts                   # host LLM 通道(ctx.llm / 自定义 fetch)+ 解析重试
│   ├── service.ts               # GrillService:TypertRemoteService + 手动 Remote 标记
│   ├── app-resolve.ts           # 运行时定位 app 的 cordis/typert 模块实例
│   └── client/
│       ├── remote.ts            # $mount 描述符 + ctx.get('remote.grill') RPC 封装
│       ├── state.ts             # 配置 store(持久化)+ 面板状态 store
│       ├── engine.ts            # 面试状态机
│       ├── GrillButton.tsx      # ✨ / 取消按钮
│       ├── GrillPanel.tsx       # 面板(进度 / 选项 / 自由输入 / 完成 / 错误)
│       └── SettingsPage.tsx     # 设置页(模式开关 + 模型三选一)
└── lib/                         # 构建产物(已提交)

已知边界

  • 目标版本 dsh 0.1.1-rc.2(0.1.2-rc.1 是坏发布,未验证其他版本)
  • 面板状态是全局单例:同时只支持一个进行中的 grill(切会话后面板仍在,可取消)
  • 「会话模型」取自该会话最近一条 assistant 消息的 provenance;空白会话回退到 host 第一个 provider 的第一个模型

License

MIT