npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-prompt-optimize

v0.1.0

Published

DSH web 插件:输入框右侧 ✨ 按钮,用 DSH 内置模型或外部 LLM 一键优化提示词,再次点击还原原文(market-prompt-optimize 的 DSH 同款移植)。

Downloads

409

Readme

dsh-prompt-optimize

DSH(DeepSeek Harness)web 插件:在聊天输入框右侧工具行加一个 按钮, 用 LLM 一键优化当前草稿,再次点击还原原文(右键打开设置)。 这是 market-prompt-optimize(Codex 用户脚本)的 DSH 同款移植。

来源 / Source:https://raw.githubusercontent.com/BigPizzaV3/CodexPlusPlusScriptMarket/main/scripts/prompt-optimize.js

按钮与行为

  • ✨ 点击:把输入框全文交给 LLM 优化,优化结果直接写回输入框(inputActions.setDraft)。
  • ✨ 再次点击:还原优化前的原文。
  • ⟳ 优化中:按钮旋转;点击取消(忽略迟到的响应)。
  • 右键 ✨:打开设置面板(Esc / 点击遮罩 / 取消 关闭)。
  • 用户手动改动草稿后,按钮自动退出「已优化」状态(不会再误还原)。

模型来源(三种模式)

| 模式 | 说明 | | --- | --- | | 内置(默认) | 走 DSH 自带 ctx.llm 服务,不需要额外 API Key。模型解析顺序:设置里的 Provider/Model 覆盖 → 当前会话正在用的模型 → 第一个已注册 provider 的默认模型 | | OpenAI 兼容 | 直接请求 {baseUrl}/chat/completions(需 HTTPS,禁止本机/内网地址) | | Anthropic | 直接请求 {baseUrl}/v1/messages(同上) |

三种优化风格(简洁 / 结构化 / 编程)各带可编辑的 system prompt,可一键恢复默认。 外部模式的 API Key / Base URL 只存在浏览器 localStorage,随请求参数一次性传给 host 半(/prompt-optimize/api/optimize),host 侧不落盘。

结构(对应 hello-plugin 教程)

dsh-prompt-optimize/
├── package.json        # 清单:dsh.bundle.patch + dsh.client(bundle 型)
│                       #   exports 必须含 "./client"(客户端 bundle 路径,client-modules 依赖)
│                       #   与 "./package.json"(client-modules 用 require.resolve('<pkg>/package.json') 读元数据)
│                       #   exports 必须含 "./client"(客户端 bundle 路径,client-modules 依赖)
│                       #   与 "./package.json"(client-modules 用 require.resolve('<pkg>/package.json') 读元数据)
├── cordis.patch.yml    # bundle patch:要插入的 loader 行
├── dsh.plugin.json     # 插件注册表清单(client.main = lib/client.js)
├── lib/
│   ├── index.js        # host 半:/prompt-optimize/api/* JSON 路由(LLM 优化)
│   └── client.js       # client 半:✨ 按钮(conversation.input.right 槽位)
└── README.md
  • host 半:导出 name / inject(['webServer','llm']) / apply(ctx) 的 cordis 插件, 用 ctx.webServer.register({kind:'prefix', path:'/prompt-optimize/api'}) 挂一条 同源 JSON 路由(仅接受带同源 Origin 的 POST,CSRF 防护)。
  • client 半:window.__ModuleLoader__.load({id:'dsh-prompt-optimize', factory})(bundle id 必须等于 package name,client-modules 以包名为条目 id)(bundle id 必须等于 package name,client-modules 以包名为条目 id) 纯 JS bundle;在 conversation.input.right(list / session 作用域)注册 ✨ 按钮, 通过槽位 owner 快照(session / input.draft)与标准 kit(inputActions.setDraft)读写草稿。

挂载(三选一)

# 1. 本地目录(开发推荐)
dsh plugin --profile web add link:C:/Git/dsh-prompt-optimize

# 2. 手动改 profile(~/.dsh/profiles/web/)
#    package.json dependencies 加 "dsh-prompt-optimize": "link:C:/Git/dsh-prompt-optimize"
#    dsh.profile.bundles 追加 "dsh-prompt-optimize"
#    cordis.patch.yml 追加:
#    - insert:
#        - id: prompt-optimize
#          name: 'dsh-prompt-optimize'

# 3. 发布后 git 源一行
#    dsh plugin --profile web add "github:<you>/dsh-prompt-optimize#main"

挂载后 pnpm install(profile 目录),完全退出并重开 DSH web(bundle 型插件 需要重启加载客户端模块),硬刷新浏览器。

验证

dsh web --dump-config | grep prompt-optimize   # 组合里能看到插件行

重启后在任意会话的输入框右侧应看到 ✨ 按钮;点它即可优化,再点还原。 打开浏览器控制台可查看 window.__ModuleLoader__ 的加载错误(若有)。

开发循环

# 改 lib/index.js / lib/client.js 后(纯 JS,无构建步骤):
# host 半改动 → 重启 dsh web;client 半改动 → 硬刷新浏览器即可