dsh-plugin-prompt-craft 0.0.0-stage → 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 — 2026-11-15
4
+
5
+ - 首次公开发布。
6
+ - 输入框左下工具行 `✨ 提示词` 按钮:标准 / 精简 / 详细 / 结构化四种模式。
7
+ - 模型改写 + 本地保真双引擎;模型不可用时自动回落。
8
+ - 保真校验:数字、英文标识符/路径、引号内容逐项核对。
9
+ - 「注入并发送」与「仅填入输入框」两种注入方式。
10
+ - 宿主侧只注册 `POST /api/prompt-craft`,不注册模型可调用工具。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Neko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ # dsh-plugin-prompt-craft
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 把输入框里凌乱、冗长、不通顺的文字,改写成通俗易懂、排版工整的提示词,然后一键注入会话,让 AI 按提示词工作。
4
+
5
+ **唯一硬约束:只调整表达,绝不省略、绝不曲解原文的本意。**
6
+
7
+ ## 功能
8
+
9
+ - **对话框内的按钮**:位于输入框左下工具行(`conversation.input.left`),紧挨附件与计划按钮。
10
+ - **四种模式**:标准 / 精简 / 详细 / 结构化。点模式即改写,结果实时预览。
11
+ - **一键注入**:「注入并发送」直接把改写结果写进输入框并发送;「仅填入输入框」只填充、等你确认。
12
+ - **保真校验**:原文里的数字、英文标识符/路径、引号内内容会被逐一核对;漏了会补在「原文细节(照抄)」里,漏太多则自动改用本地保真模式。
13
+ - **两个引擎**:
14
+ - `模型改写`:走当前 profile 的 Agent 默认模型(或行配置里指定的 provider/model),做真正的重写润色。
15
+ - `本地保真`:纯本地重排 + 补标题,一个字都不改,离线可用,也是模型不可信时的兜底。
16
+ - **快捷键**:面板内 `Esc` 关闭,`Ctrl/Cmd + Enter` 重新改写。
17
+
18
+ ## 安装
19
+
20
+ ### 方式一:从 GitHub 装(推荐先试)
21
+
22
+ 在 DSH 的插件窗口里选「添加插件」,填 Git 地址:
23
+
24
+ ```text
25
+ github:lance-maxwell/dsh-plugin-prompt-craft
26
+ ```
27
+
28
+ 或者:
29
+
30
+ ```text
31
+ https://github.com/lance-maxwell/dsh-plugin-prompt-craft
32
+ ```
33
+
34
+ 如果钉版本,用 tag:
35
+
36
+ ```text
37
+ github:lance-maxwell/dsh-plugin-prompt-craft#v1.0.0
38
+ ```
39
+
40
+ > 当前 DSH 的插件管理器接受包名、Git 地址、tarball 和本地路径;GitHub 仓库根目录必须就是包根。
41
+
42
+ ### 方式二:从 npm 装(发布后)
43
+
44
+ ```text
45
+ dsh-plugin-prompt-craft
46
+ ```
47
+
48
+ 或指定版本:
49
+
50
+ ```text
51
+ dsh-plugin-prompt-craft@1.0.0
52
+ ```
53
+
54
+ ### 方式三:本地目录
55
+
56
+ 在插件窗口里填这个目录的绝对路径,例如:
57
+
58
+ ```text
59
+ C:\path\to\prompt-craft-repo
60
+ ```
61
+
62
+ 安装后**完全退出 DSH 再启动**(桌面端从托盘退出),刷新页面,输入框左下工具行会出现 `✨ 提示词`。
63
+
64
+ ## 使用
65
+
66
+ 1. 在输入框里写下草稿,哪怕很乱。
67
+ 2. 点 `✨ 提示词`,选「标准 / 精简 / 详细 / 结构化」。
68
+ 3. 看预览:
69
+ - 「注入并发送」:直接替换输入框并发送;
70
+ - 「仅填入输入框」:只填充,你自己再改。
71
+ 4. `Esc` 关闭;`Ctrl/Cmd + Enter` 重新改写。
72
+
73
+ ## 配置模型
74
+
75
+ 默认用当前 profile 的 Agent 默认模型。想固定改写用的模型,在 `cordis.patch.yml` 的插入行里加 `config`:
76
+
77
+ ```yaml
78
+ - insert:
79
+ - id: prompt-craft
80
+ name: dsh-plugin-prompt-craft
81
+ config:
82
+ provider: deepseek-official
83
+ model: deepseek-flash
84
+ ```
85
+
86
+ 改完重启 DSH 生效。
87
+
88
+ ## 工作方式
89
+
90
+ - 宿主半侧只注册一个 Fetch 路由:`POST /api/prompt-craft`。
91
+ - 请求体:`{ endpoint, payload }`。
92
+ - `polish`:`{ text, mode }`,走模型改写;
93
+ - `local`:`{ text, mode }`,强制本地保真;
94
+ - `describe`:`{}`,返回模式、路由与引擎信息。
95
+ - 不注册任何模型可调用的工具:这是给用户的按钮,不是第二个入口。
96
+ - 客户端半侧通过 `dsh.client`(`platform: web`)注入输入框工具行;桌面端加载的是同一套 Web UI。
97
+
98
+ ## 开发与测试
99
+
100
+ 纯 JavaScript,无原生依赖、无需构建,Node ≥ 20。
101
+
102
+ ```bash
103
+ node test/run-tests.mjs
104
+ ```
105
+
106
+ 期望:`PASS — 139/139 assertions`。
107
+
108
+ ## 发布
109
+
110
+ 见 [PUBLISHING.md](./PUBLISHING.md):GitHub 建仓、npm 发布、版本 tag、市场收录说明。
111
+
112
+ ## 目录
113
+
114
+ ```text
115
+ .
116
+ ├─ index.js # 宿主半侧:/api/prompt-craft
117
+ ├─ client.js # 客户端半侧:输入框按钮与面板
118
+ ├─ cordis.patch.yml # DSH bundle patch
119
+ ├─ icon.svg
120
+ ├─ test/run-tests.mjs
121
+ ├─ README.md
122
+ ├─ PUBLISHING.md
123
+ ├─ CHANGELOG.md
124
+ └─ LICENSE
125
+ ```
126
+
127
+ ## License
128
+
129
+ MIT。见 [LICENSE](./LICENSE)。