@surfishs/dsh-prompt-enhance 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -11,7 +11,9 @@
11
11
 
12
12
  [简体中文](./README.md) | English
13
13
 
14
- **Prompt enhancement for the DeepSeek Harness web GUI** — turn a composer draft into a structured prompt in one click: role and goal, context and constraints, executable steps, output format, acceptance criteria, edge cases. It keeps your intent unchanged, invents no requirements, and writes a placeholder instead of guessing; the composer draft is never modified.
14
+ **Prompt enhancement for the DeepSeek Harness web GUI** — turn a composer draft into a structured prompt in one click: role and goal, context and constraints, executable steps, output format, acceptance criteria, edge cases.
15
+
16
+ The draft is the source of truth: intent unchanged, no invented requirements, a placeholder wherever information is missing — and it is never modified, not even when a call fails. The result appears in a card above the composer, is written back only when you apply it, and one click undoes that.
15
17
 
16
18
  ![Prompt Enhance: the docked result card above the composer](./docs/images/panel-en.png)
17
19
 
@@ -19,9 +21,11 @@
19
21
 
20
22
  ## Why you need it
21
23
 
22
- A good prompt spells out four things: who the model acts as, what it hands over, in what format, and what counts as correct — most drafts say none of this.
24
+ Users tend to open with a pleading "So… could you help me out?" — and that alone often sends the model off-course: it drifts from what you meant and fills in the gaps itself. That is not the user's fault: what is hard is rarely the thinking, it is turning what you have thought through into a form the model can follow.
25
+
26
+ A good prompt spells out six things: who the model acts as and what it delivers, the context and constraints it works under, which steps it takes, in what format, what counts as correct, and where the boundaries are.
23
27
 
24
- The plugin adds a Prompt enhancement button to the composer toolbar: one click sends the draft to DSH's model service, which rewrites it around those four things as a structured prompt.
28
+ The plugin adds a Prompt enhancement button to the composer toolbar: one click sends the draft to DSH's model service, which rewrites it around those six things as a structured prompt.
25
29
 
26
30
  The result appears in a card docked above the composer without covering the conversation; your draft is never replaced — apply it, copy it, regenerate it, or undo, and the original text can always be restored.
27
31
 
package/README.md CHANGED
@@ -12,7 +12,9 @@
12
12
 
13
13
  简体中文 | [English](./README.en.md)
14
14
 
15
- **DeepSeek Harness Web GUI 的「提示词增强」插件** —— 一键把输入框草稿改写为结构化提示词:角色与目标、上下文与约束、可执行步骤、输出格式、验收标准、边界条件。以原文为准,不改变原意、不凭空编造需求;信息不足时留占位,草稿不会被改动。
15
+ **DeepSeek Harness Web GUI 的「提示词增强」插件** —— 一键把输入框草稿改写为结构化提示词:角色与目标、上下文与约束、可执行步骤、输出格式、验收标准、边界条件。
16
+
17
+ 以原文为准:不改变原意、不凭空编造需求;信息不足时留占位。改写不改动你的草稿(出错时也不会):结果先出现在停靠卡里,点「回填」才写回,回填后可一键撤销。
16
18
 
17
19
  ![提示词增强:输入框上方的停靠结果卡](./docs/images/panel.png)
18
20
 
@@ -20,9 +22,11 @@
20
22
 
21
23
  ## 为什么需要它
22
24
 
23
- 好的提示词会讲清四件事:让模型扮演谁、交付什么、以什么格式、怎样算合格——多数草稿没写这些。
25
+ 用户往往带着祈求式的「那你能帮帮我吗?」发问。而这往往让模型偏离用户意愿、自行补充内容。问题不在用户身上:难点通常不在想,而在把想过的东西整理成模型能照着做的形式。
26
+
27
+ 一段好的提示词会讲清六件事:让模型扮演谁和交付什么、在什么上下文和约束下做、分哪几步、以什么格式、怎样算合格、边界在哪。
24
28
 
25
- 插件在输入框工具栏加了一个「提示词增强」按钮:点一下,草稿就会交给 DSH 的模型服务,按上面那四件事改写成结构化提示词。
29
+ 插件在输入框工具栏加了一个「提示词增强」按钮:点一下,草稿就会交给 DSH 的模型服务,按上面那六件事改写成结构化提示词。
26
30
 
27
31
  结果出现在输入框上方的停靠卡里,不遮挡对话;草稿不会被直接替换——你可以回填、复制、重新生成或撤销,原文随时可恢复。
28
32
 
package/lib/client.js CHANGED
@@ -1912,8 +1912,14 @@ function UndoBar(props) {
1912
1912
  (0, import_react8.useEffect)(() => {
1913
1913
  if (entry !== void 0 && entry.applied !== draft) popUndo(uiKey);
1914
1914
  }, [draft, entry, uiKey]);
1915
+ const phase = useInput((state) => {
1916
+ const value = state.phase;
1917
+ return typeof value === "string" ? value : "";
1918
+ });
1919
+ const composerIdle = phase === "" || phase === "plain";
1915
1920
  const panel = getPanel();
1916
- const visible = (panel === void 0 || panel.sessionId !== uiKey) && entry !== void 0 && entry.applied === draft;
1921
+ const cardGone = panel === void 0 || panel.sessionId !== uiKey;
1922
+ const visible = cardGone && composerIdle && entry !== void 0 && entry.applied === draft;
1917
1923
  const rootRef = useDockAlignment(visible, uiKey);
1918
1924
  if (!visible) return null;
1919
1925
  const undo = () => {
@@ -3685,7 +3691,7 @@ var REPOSITORY_URL = "https://github.com/surfishs/dsh-prompt-enhance";
3685
3691
  var NPM_URL = "https://www.npmjs.com/package/@surfishs/dsh-prompt-enhance";
3686
3692
  var GITHUB_MARK = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z";
3687
3693
  var NPM_MARK = "M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z";
3688
- var PLUGIN_VERSION = true ? "0.1.6" : "0.0.0";
3694
+ var PLUGIN_VERSION = true ? "0.1.7" : "0.0.0";
3689
3695
  var HEADER_STYLE = { display: "flex", flexDirection: "column", gap: 12, padding: "2px 0" };
3690
3696
  var HEADER_ROW_STYLE = { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" };
3691
3697
  var HEADER_TITLE_STYLE = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@surfishs/dsh-prompt-enhance",
3
3
  "description": "Prompt enhancement for the dsh web GUI: rewrite the composer draft into a well-structured prompt through the harness LLM service, preview the before/after, then fill back, copy, or undo. Original draft is always preserved.",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "author": "surfishs",
6
6
  "type": "module",
7
7
  "engines": {
@@ -39,10 +39,23 @@ export function UndoBar(props: UndoBarProps): ReactNode {
39
39
  if (entry !== undefined && entry.applied !== draft) ui.popUndo(uiKey)
40
40
  }, [draft, entry, uiKey])
41
41
 
42
+ // The composer's own phase decides whether an undo makes sense. While it is
43
+ // mid-submit (sending / submitting / adjudicating) the draft is about to be
44
+ // consumed, so restoring the pre-apply text is not what the user asked for —
45
+ // and the single commit between "card closed" and "draft cleared" used to
46
+ // flash the bar for exactly that moment. A host that publishes no phase reads
47
+ // as idle here, keeping the shipped behaviour on those versions.
48
+ const phase = useInput((state) => {
49
+ const value = (state as { phase?: unknown }).phase
50
+ return typeof value === 'string' ? value : ''
51
+ })
52
+ const composerIdle = phase === '' || phase === 'plain'
53
+
42
54
  // The result card owns the undo affordance while it is open; the standalone
43
55
  // row takes over only after the card is closed.
44
56
  const panel = ui.getPanel()
45
- const visible = (panel === undefined || panel.sessionId !== uiKey) && entry !== undefined && entry.applied === draft
57
+ const cardGone = panel === undefined || panel.sessionId !== uiKey
58
+ const visible = cardGone && composerIdle && entry !== undefined && entry.applied === draft
46
59
  const rootRef = useDockAlignment(visible, uiKey)
47
60
  if (!visible) return null
48
61