@y1x1n/dsh-prompt-optimizer 0.3.15 → 0.5.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/lib/prompt.js CHANGED
@@ -4,8 +4,8 @@ var MARKERS = {
4
4
  optimized: "<<<OPTIMIZED>>>",
5
5
  end: "<<<END>>>"
6
6
  };
7
- var ROLE_FULL_ZH = "\u4F60\u662F\u4E00\u4F4D\u8D44\u6DF1\u63D0\u793A\u8BCD\u5DE5\u7A0B\u4E13\u5BB6\u3002\u7528\u6237\u4F1A\u7ED9\u4F60\u4E00\u6BB5\u300C\u63D0\u793A\u8BCD\u8349\u7A3F\u300D,\u4F60\u8981\u5B8C\u6210\u4E24\u4EF6\u4E8B:\u8BCA\u65AD\u5206\u6790 + \u4F18\u5316\u6539\u5199\u3002";
8
- var ROLE_FULL_EN = 'You are a senior prompt engineering expert. Given a "prompt draft" from the user, do two things: diagnose it, then rewrite an optimized version.';
7
+ var ROLE_FULL_ZH = "\u4F60\u662F\u4E00\u4F4D\u8D44\u6DF1\u63D0\u793A\u8BCD\u5DE5\u7A0B\u4E13\u5BB6\u3002\u7528\u6237\u4F1A\u7ED9\u4F60\u4E00\u6BB5\u300C\u63D0\u793A\u8BCD\u8349\u7A3F\u300D,\u4F60\u8981\u8F93\u51FA\u4E24\u6BB5\u5185\u5BB9:\u5148\u8F93\u51FA\u4F18\u5316\u6539\u5199\u7A3F,\u518D\u8F93\u51FA\u8BCA\u65AD\u5206\u6790\u3002";
8
+ var ROLE_FULL_EN = 'You are a senior prompt engineering expert. Given a "prompt draft" from the user, output the optimized rewrite first, then the diagnosis.';
9
9
  var ROLE_FAST_ZH = "\u4F60\u662F\u4E00\u4F4D\u8D44\u6DF1\u63D0\u793A\u8BCD\u5DE5\u7A0B\u4E13\u5BB6\u3002\u7528\u6237\u4F1A\u7ED9\u4F60\u4E00\u6BB5\u300C\u63D0\u793A\u8BCD\u8349\u7A3F\u300D,\u8BF7\u76F4\u63A5\u8F93\u51FA\u4F18\u5316\u540E\u7684\u5B8C\u6574\u63D0\u793A\u8BCD,\u4E0D\u8981\u505A\u4EFB\u4F55\u8BCA\u65AD\u5206\u6790\u3002";
10
10
  var ROLE_FAST_EN = 'You are a senior prompt engineering expert. Given a "prompt draft" from the user, output an optimized version directly \u2014 no diagnosis.';
11
11
  var ANALYSIS_ZH = `# \u5206\u6790\u7EF4\u5EA6
@@ -53,14 +53,14 @@ var RULES_ZH = `# \u4FDD\u771F\u4E0E\u660E\u786E\u5316\u539F\u5219(\u5168\u7A0B\
53
53
  - \u8BED\u4E49\u7B49\u4EF7\u662F\u5E95\u7EBF:\u5DF2\u660E\u786E\u7684\u5BF9\u8C61\u3001\u65B9\u5411\u3001\u6570\u91CF\u3001\u8303\u56F4\u3001\u7981\u6B62\u9879\u3001\u672F\u8BED\u5FC5\u987B\u4E0E\u8349\u7A3F\u4E00\u81F4,\u4E0D\u5F97\u66FF\u6362\u3001\u6269\u5927\u3001\u7F29\u5C0F\u6216\u98A0\u5012
54
54
  - \u6765\u6E90\u53EF\u56DE\u6EAF:\u4EFB\u4F55\u5177\u4F53\u5316\u7684\u5185\u5BB9\u90FD\u5FC5\u987B\u80FD\u4ECE\u8349\u7A3F\u6216\u4E0A\u4E0B\u6587\u5DF2\u786E\u8BA4\u4FE1\u606F\u627E\u5230\u4F9D\u636E;\u63A8\u65AD\u5904\u7528\u300C\u5982\u65E0\u7279\u522B\u8BF4\u660E/\u9ED8\u8BA4\u300D\u63AA\u8F9E\u4FDD\u7559\u9009\u62E9\u6743,\u65E0\u4F9D\u636E\u7684\u5B81\u53EF\u4E0D\u8865
55
55
  - \u4FDD\u771F\u81EA\u68C0:\u8F93\u51FA\u524D\u9010\u8981\u7D20\u6838\u5BF9\u2014\u2014\u8349\u7A3F\u7684\u6BCF\u4E2A\u539F\u5B50\u4FE1\u606F\u90FD\u8981\u5728\u4F18\u5316\u7A3F\u4E2D\u627E\u5230\u5BF9\u5E94,\u627E\u4E0D\u5230\u5373\u4E3A\u8BED\u4E49\u6F02\u79FB,\u5FC5\u987B\u4FEE\u6B63
56
- - \u957F\u5EA6\u7EAA\u5F8B:\u7B80\u5355\u4EFB\u52A1\u7684\u4F18\u5316\u7A3F\u63A7\u5236\u5728 800 \u5B57\u7B26\u4EE5\u5185,\u590D\u6742\u4EFB\u52A1\u53EF\u8D85\u51FA;\u4EFB\u4F55\u60C5\u51B5\u4E0B\u4FDD\u771F\u81EA\u68C0\u4F18\u5148\u4E8E\u957F\u5EA6\u2014\u2014\u8981\u7D20\u7F3A\u5931\u6BD4\u5197\u957F\u66F4\u4E25\u91CD,\u4F46\u4E5F\u4E0D\u5F97\u5197\u4F59
56
+ - \u957F\u5EA6\u7EAA\u5F8B:\u7B80\u5355\u4EFB\u52A1\u7684\u4F18\u5316\u7A3F\u63A7\u5236\u5728 500 \u5B57\u7B26\u4EE5\u5185,\u590D\u6742\u4EFB\u52A1\u53EF\u8D85\u51FA;\u4F18\u5316\u7A3F\u5C31\u662F\u63D0\u793A\u8BCD\u672C\u8EAB\u2014\u2014\u4E0D\u590D\u8FF0\u539F\u7A3F\u3001\u4E0D\u52A0\u591A\u4F59\u7684\u89E3\u91CA\u6216\u524D\u8A00;\u4EFB\u4F55\u60C5\u51B5\u4E0B\u4FDD\u771F\u81EA\u68C0\u4F18\u5148\u4E8E\u957F\u5EA6\u2014\u2014\u8981\u7D20\u7F3A\u5931\u6BD4\u5197\u957F\u66F4\u4E25\u91CD,\u4F46\u4E5F\u4E0D\u5F97\u5197\u4F59
57
57
  - \u8BED\u8A00\u5339\u914D:\u8349\u7A3F\u4EE5\u4E2D\u6587\u4E3A\u4E3B\u4F53\u5219\u8F93\u51FA\u5FC5\u987B\u4E3A\u4E2D\u6587,\u4EE5\u82F1\u6587\u4E3A\u4E3B\u4F53\u5219\u8F93\u51FA\u5FC5\u987B\u4E3A\u82F1\u6587;\u4FDD\u7559\u539F\u6587\u7684\u672F\u8BED\u4E0E\u4E13\u6709\u540D\u8BCD`;
58
58
  var RULES_EN = `# Fidelity & clarification rules (always apply)
59
59
  - Understand first: list what the draft explicitly states (subject, action, constraints, scope, terms, numbers, tone), and separate it from your guesses \u2014 guesses may shape wording only, never enter the output
60
60
  - Semantic equivalence is the floor: what the draft states (subject, direction, quantities, scope, prohibitions, terms) must survive intact \u2014 never replace, widen, narrow, or invert it
61
61
  - Traceability: every concretized detail must trace back to the draft or to information the context has confirmed; mark inferences with "unless otherwise specified / by default" phrasing; when in doubt, leave it out
62
62
  - Fidelity self-check: before output, verify every atomic element of the draft has a counterpart in your rewrite \u2014 a missing one is semantic drift and must be fixed
63
- - Length discipline: keep the rewrite under 800 characters for simple tasks; longer is allowed for complex ones. Fidelity always outranks length \u2014 a missing element is worse than verbosity, but never pad
63
+ - Length discipline: keep the rewrite under 500 characters for simple tasks; longer is allowed for complex ones. The rewrite is the prompt itself \u2014 never restate the draft or add explanations or preamble. Fidelity always outranks length \u2014 a missing element is worse than verbosity, but never pad
64
64
  - Language match: Chinese-dominant draft \u2192 Chinese output; English-dominant \u2192 English output; keep the draft's terms and proper nouns`;
65
65
  var EXAMPLE_TEMPLATE_ZH = `# \u793A\u4F8B(\u4E25\u683C\u6A21\u4EFF\u5176\u300C\u8F93\u5165 \u2192 \u8F93\u51FA\u300D\u7684\u98CE\u683C)
66
66
  \u8F93\u5165:\u5E2E\u6211\u5199\u4E2A\u8BF7\u5047\u6761
@@ -75,18 +75,18 @@ var EXAMPLE_INTENT_EN = `# Example (strictly mirror its "input \u2192 output" st
75
75
  Input: (background: the user runs a 200-member neighborhood parents' swap group; the first chain-post drew only a dozen joins, blamed on weak prizes and a messy format) redesign the chain post for me
76
76
  Output: Redesign the "hidden gems" chain post for my 200-member neighborhood swap group (mostly parents): last round drew only a dozen joins because prizes were unappealing and the format confusing \u2014 provide a simple chain-post template, low-cost but attractive prize ideas, and concrete tactics to lift participation.`;
77
77
  var FORMAT_FULL_ZH = `# \u8F93\u51FA\u683C\u5F0F(\u4E25\u683C\u9075\u5B88,\u6807\u8BB0\u884C\u5355\u72EC\u6210\u884C)
78
- ${MARKERS.analysis}
79
- \u6309\u7EF4\u5EA6\u9010\u6761\u8F93\u51FA\u8BCA\u65AD,\u6BCF\u6761\u4E00\u884C,\u683C\u5F0F:\u300C\u7EF4\u5EA6 | \u95EE\u9898 | \u5EFA\u8BAE\u300D\u3002\u67D0\u7EF4\u5EA6\u65E0\u660E\u663E\u95EE\u9898\u65F6\u5199:\u300C\u7EF4\u5EA6 | \u65E0\u660E\u663E\u95EE\u9898 | -\u300D\u3002
80
78
  ${MARKERS.optimized}
81
79
  \u8F93\u51FA\u4F18\u5316\u540E\u7684\u5B8C\u6574\u63D0\u793A\u8BCD\u5168\u6587
80
+ ${MARKERS.analysis}
81
+ \u6309\u7EF4\u5EA6\u9010\u6761\u8F93\u51FA\u8BCA\u65AD,\u6BCF\u6761\u4E00\u884C,\u683C\u5F0F:\u300C\u7EF4\u5EA6 | \u95EE\u9898 | \u5EFA\u8BAE\u300D\u3002\u67D0\u7EF4\u5EA6\u65E0\u660E\u663E\u95EE\u9898\u65F6\u5199:\u300C\u7EF4\u5EA6 | \u65E0\u660E\u663E\u95EE\u9898 | -\u300D\u3002
82
82
  ${MARKERS.end}
83
83
 
84
84
  \u9664\u4E0A\u8FF0\u6807\u8BB0\u5305\u88F9\u7684\u5185\u5BB9\u5916,\u4E0D\u8981\u8F93\u51FA\u4EFB\u4F55\u5176\u4ED6\u6587\u5B57\u3002`;
85
85
  var FORMAT_FULL_EN = `# Output format (strictly follow; markers on their own lines)
86
- ${MARKERS.analysis}
87
- One finding per line: "dimension | issue | suggestion". If a dimension is fine: "dimension | no issue | -".
88
86
  ${MARKERS.optimized}
89
87
  The full optimized prompt text
88
+ ${MARKERS.analysis}
89
+ One finding per line: "dimension | issue | suggestion". If a dimension is fine: "dimension | no issue | -".
90
90
  ${MARKERS.end}
91
91
 
92
92
  Do not output anything outside these markers.`;
@@ -179,12 +179,26 @@ ${draft}`
179
179
  );
180
180
  return sections.join("\n\n");
181
181
  }
182
+ function isWideTokenChar(code) {
183
+ return code >= 4352 && code <= 4607 || // 谚文字母
184
+ code >= 11904 && code <= 12255 || // CJK 部首补充 / 康熙部首
185
+ code >= 12288 && code <= 12351 || // CJK 符号与标点(全角)
186
+ code >= 12352 && code <= 12543 || // 平假名 / 片假名
187
+ code >= 12592 && code <= 12687 || // 谚文兼容字母
188
+ code >= 13312 && code <= 19903 || // CJK 扩展 A
189
+ code >= 19968 && code <= 40959 || // CJK 统一表意文字
190
+ code >= 43360 && code <= 43391 || // 谚文字母扩展 A
191
+ code >= 44032 && code <= 55215 || // 谚文音节
192
+ code >= 63744 && code <= 64255 || // CJK 兼容表意文字
193
+ code >= 65280 && code <= 65376 || // 全角 ASCII 变体
194
+ code >= 65504 && code <= 65510 || // 全角符号
195
+ code >= 131072 && code <= 262143;
196
+ }
182
197
  function estimateTokens(text) {
183
198
  let cjk = 0;
184
199
  let other = 0;
185
200
  for (const ch of text) {
186
- const code = ch.codePointAt(0) ?? 0;
187
- if (code >= 13312 && code <= 19903 || code >= 19968 && code <= 40959 || code >= 63744 && code <= 64255) {
201
+ if (isWideTokenChar(ch.codePointAt(0) ?? 0)) {
188
202
  cjk += 1;
189
203
  } else {
190
204
  other += 1;
@@ -198,57 +212,147 @@ function findMarker(text, word, fromIndex = 0) {
198
212
  const match = re.exec(text);
199
213
  return match ? { index: match.index, length: match[0].length } : null;
200
214
  }
215
+ function findLastMarker(text, word, beforeIndex = text.length) {
216
+ const re = new RegExp(`<<<\\s*${word}\\s*>>>`, "g");
217
+ let last = null;
218
+ for (const match of text.matchAll(re)) {
219
+ if (match.index >= beforeIndex) break;
220
+ last = { index: match.index, length: match[0].length };
221
+ }
222
+ return last;
223
+ }
224
+ function stripMarkers(text) {
225
+ return text.replace(/<<<\s*(?:ANALYSIS|OPTIMIZED|END)\s*>>>/g, "");
226
+ }
227
+ function findNextMarker(text, fromIndex) {
228
+ const re = /<<<\s*(?:ANALYSIS|OPTIMIZED|END)\s*>>>/g;
229
+ re.lastIndex = fromIndex;
230
+ const match = re.exec(text);
231
+ return match ? { index: match.index, length: match[0].length } : null;
232
+ }
233
+ function segmentAfter(text, marker) {
234
+ const firstEnd = findMarker(text, "END");
235
+ if (firstEnd && marker.index > firstEnd.index) return "";
236
+ const start = marker.index + marker.length;
237
+ const next = findNextMarker(text, start);
238
+ let end = next ? next.index : text.length;
239
+ if (firstEnd && firstEnd.index > start && firstEnd.index < end) end = firstEnd.index;
240
+ return text.slice(start, end).trim();
241
+ }
242
+ var THINK_OPEN = "<think>";
243
+ var THINK_CLOSE = "</think>";
244
+ function stripThinkBlocks(text) {
245
+ let out = "";
246
+ let rest = text;
247
+ for (; ; ) {
248
+ const open = rest.indexOf(THINK_OPEN);
249
+ if (open === -1) return out + rest;
250
+ out += rest.slice(0, open);
251
+ const close = rest.indexOf(THINK_CLOSE, open + THINK_OPEN.length);
252
+ if (close === -1) return out;
253
+ rest = rest.slice(close + THINK_CLOSE.length);
254
+ }
255
+ }
256
+ function createThinkFilter() {
257
+ let buf = "";
258
+ let inThink = false;
259
+ const splitSafeTail = (tagLen) => {
260
+ const lastLt = buf.lastIndexOf("<");
261
+ const keepFrom = lastLt !== -1 && buf.length - lastLt <= tagLen - 1 ? lastLt : buf.length;
262
+ return [buf.slice(0, keepFrom), buf.slice(keepFrom)];
263
+ };
264
+ const push = (chunk) => {
265
+ buf += chunk;
266
+ let out = "";
267
+ for (; ; ) {
268
+ if (inThink) {
269
+ const close = buf.indexOf(THINK_CLOSE);
270
+ if (close === -1) {
271
+ const [emit, keep] = splitSafeTail(THINK_CLOSE.length);
272
+ buf = keep;
273
+ return out;
274
+ }
275
+ buf = buf.slice(close + THINK_CLOSE.length);
276
+ inThink = false;
277
+ continue;
278
+ }
279
+ const open = buf.indexOf(THINK_OPEN);
280
+ if (open === -1) {
281
+ const [emit, keep] = splitSafeTail(THINK_OPEN.length);
282
+ out += emit;
283
+ buf = keep;
284
+ return out;
285
+ }
286
+ out += buf.slice(0, open);
287
+ buf = buf.slice(open + THINK_OPEN.length);
288
+ inThink = true;
289
+ }
290
+ };
291
+ const flush = () => {
292
+ if (inThink) {
293
+ buf = "";
294
+ return "";
295
+ }
296
+ const rest = buf;
297
+ buf = "";
298
+ return rest;
299
+ };
300
+ return { push, flush };
301
+ }
201
302
  function parseOptimizerOutput(raw, mode = "full") {
202
- const text = raw.trim();
203
- const a = findMarker(text, "ANALYSIS");
204
- const o = findMarker(text, "OPTIMIZED");
303
+ const text = stripThinkBlocks(raw).trim();
304
+ const o = findLastMarker(text, "OPTIMIZED");
305
+ const a = findLastMarker(text, "ANALYSIS");
205
306
  const wellFormed = mode === "fast" ? true : Boolean(a && o);
206
307
  if (!a && !o) {
207
- return { analysis: "", optimized: text, wellFormed };
208
- }
209
- let analysis = "";
210
- let optimized = "";
211
- if (a && (!o || a.index < o.index)) {
212
- analysis = text.slice(a.index + a.length, o ? o.index : text.length).trim();
213
- }
214
- if (o) {
215
- const e = findMarker(text, "END", o.index + o.length);
216
- optimized = text.slice(o.index + o.length, e ? e.index : text.length).trim();
308
+ const body = stripMarkers(text).trim();
309
+ return { analysis: "", optimized: body, wellFormed: wellFormed && Boolean(body) };
217
310
  }
311
+ const optimized = o ? segmentAfter(text, o) : "";
312
+ const analysis = a ? segmentAfter(text, a) : "";
218
313
  return {
314
+ // 有标记但段落为空:保持为空(可能只是模型没写内容),绝不回退到含标记的原文。
219
315
  analysis,
220
- optimized: optimized || text,
221
- wellFormed
316
+ optimized,
317
+ // 优化稿为空 = 这次输出不可用,降级展示并让客户端弹格式警示。
318
+ wellFormed: wellFormed && Boolean(optimized)
222
319
  };
223
320
  }
224
321
  function parsePartialOptimizerOutput(raw) {
225
- const a = findMarker(raw, "ANALYSIS");
226
- const o = findMarker(raw, "OPTIMIZED");
227
- let analysis = "";
228
- let optimized = "";
229
- if (a && (!o || a.index < o.index)) {
230
- analysis = raw.slice(a.index + a.length, o ? o.index : raw.length).trim();
322
+ const text = stripThinkBlocks(raw);
323
+ const o = findLastMarker(text, "OPTIMIZED");
324
+ const a = findLastMarker(text, "ANALYSIS");
325
+ return {
326
+ analysis: a ? segmentAfter(text, a) : "",
327
+ optimized: o ? segmentAfter(text, o) : ""
328
+ };
329
+ }
330
+ function compactPartialBuffer(raw) {
331
+ const o = findLastMarker(raw, "OPTIMIZED");
332
+ const a = findLastMarker(raw, "ANALYSIS");
333
+ if (o && a && o.index < a.index) {
334
+ return {
335
+ compacted: `${MARKERS.analysis}
336
+ ${raw.slice(a.index + a.length)}`,
337
+ analysis: "",
338
+ optimized: raw.slice(o.index + o.length, a.index).trim()
339
+ };
231
340
  }
232
341
  if (o) {
233
- const e = findMarker(raw, "END", o.index + o.length);
234
- optimized = raw.slice(o.index + o.length, e ? e.index : raw.length).trim();
342
+ const analysis = a && a.index < o.index ? raw.slice(a.index + a.length, o.index).trim() : "";
343
+ return { compacted: `${MARKERS.optimized}
344
+ ${raw.slice(o.index + o.length)}`, analysis, optimized: "" };
235
345
  }
236
- return { analysis, optimized };
237
- }
238
- function compactPartialBuffer(raw) {
239
- const o = findMarker(raw, "OPTIMIZED");
240
- if (!o) return { compacted: null, analysis: "" };
241
- const a = findMarker(raw, "ANALYSIS");
242
- const analysis = a && a.index < o.index ? raw.slice(a.index + a.length, o.index).trim() : "";
243
- return { compacted: `${MARKERS.optimized}
244
- ${raw.slice(o.index + o.length)}`, analysis };
346
+ return { compacted: null, analysis: "", optimized: "" };
245
347
  }
246
348
  export {
247
349
  buildSystemPrompt,
248
350
  buildUserPayload,
249
351
  capConversationContext,
250
352
  compactPartialBuffer,
353
+ createThinkFilter,
251
354
  estimateTokens,
252
355
  parseOptimizerOutput,
253
- parsePartialOptimizerOutput
356
+ parsePartialOptimizerOutput,
357
+ stripThinkBlocks
254
358
  };
package/package.json CHANGED
@@ -1,74 +1,71 @@
1
- {
2
- "name": "@y1x1n/dsh-prompt-optimizer",
3
- "version": "0.3.15",
4
- "description": "DeepSeek Harness 插件:在发送栏旁一键分析并优化提示词(复用当前会话模型)",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "lib/index.js",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/Y1X1n/dsh-prompt-optimizer.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/Y1X1n/dsh-prompt-optimizer/issues"
14
- },
15
- "homepage": "https://github.com/Y1X1n/dsh-prompt-optimizer#readme",
16
- "keywords": [
17
- "deepseek",
18
- "dsh",
19
- "harness",
20
- "prompt",
21
- "optimizer",
22
- "plugin",
23
- "cordis"
24
- ],
25
- "engines": {
26
- "node": ">=18"
27
- },
28
- "exports": {
29
- ".": "./lib/index.js",
30
- "./client": "./lib/client.js",
31
- "./package.json": "./package.json"
32
- },
33
- "files": [
34
- "lib/",
35
- "cordis.patch.yml",
36
- "README.md"
37
- ],
38
- "scripts": {
39
- "build": "node scripts/build.mjs",
40
- "prepare": "node scripts/build.mjs",
41
- "sync:types": "node scripts/sync-types.mjs",
42
- "typecheck": "tsc --noEmit",
43
- "test": "node test/smoke.mjs && node test/prompt.test.mjs && node test/controller.test.mjs"
44
- },
45
- "dsh": {
46
- "bundle": {
47
- "patch": "./cordis.patch.yml"
48
- },
49
- "client": {
50
- "platform": "web",
51
- "inject": [
52
- "@deepseek-ai/dsh-client-connection",
53
- "@deepseek-ai/dsh-client-runtime",
54
- "@deepseek-ai/dsh-client-ui-conversation",
55
- "@deepseek-ai/dsh-client-ui-settings",
56
- "@deepseek-ai/dsh-client-ui-settings-plugins"
57
- ]
58
- }
59
- },
60
- "dependencies": {
61
- "@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
62
- "@deepseek-ai/schemastery": "^3.18.1"
63
- },
64
- "devDependencies": {
65
- "@deepseek-ai/cordis": "^4.0.2",
66
- "@deepseek-ai/dsh-host-webserver": "^0.1.2-rc.1",
67
- "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
68
- "@types/node": "^20.0.0",
69
- "@types/react": "^18.3.1",
70
- "esbuild": "^0.24.0",
71
- "react": "^18.2.0",
72
- "typescript": "^5.5.0"
73
- }
74
- }
1
+ {
2
+ "name": "@y1x1n/dsh-prompt-optimizer",
3
+ "version": "0.5.0",
4
+ "description": "DeepSeek Harness 插件:在发送栏旁一键分析并优化提示词(复用当前会话模型)。适配 dsh 0.2.0-rc.2(含官方桌面端)",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "lib/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Y1X1n/dsh-prompt-optimizer.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Y1X1n/dsh-prompt-optimizer/issues"
14
+ },
15
+ "homepage": "https://github.com/Y1X1n/dsh-prompt-optimizer#readme",
16
+ "keywords": [
17
+ "deepseek",
18
+ "dsh",
19
+ "harness",
20
+ "prompt",
21
+ "optimizer",
22
+ "plugin",
23
+ "cordis"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "exports": {
29
+ ".": "./lib/index.js",
30
+ "./client": "./lib/client.js",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "lib/",
35
+ "cordis.patch.yml",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "build": "node scripts/build.mjs",
40
+ "prepare": "node scripts/build.mjs",
41
+ "sync:types": "node scripts/sync-types.mjs",
42
+ "typecheck": "tsc --noEmit",
43
+ "test": "node test/smoke.mjs && node test/prompt.test.mjs && node test/controller.test.mjs"
44
+ },
45
+ "dsh": {
46
+ "bundle": {
47
+ "patch": "./cordis.patch.yml"
48
+ },
49
+ "client": {
50
+ "platform": "web",
51
+ "inject": [
52
+ "@deepseek-ai/dsh-client-connection",
53
+ "@deepseek-ai/dsh-client-ui-conversation",
54
+ "@deepseek-ai/dsh-client-ui-settings",
55
+ "@deepseek-ai/dsh-client-ui-settings-plugins"
56
+ ]
57
+ }
58
+ },
59
+ "dependencies": {
60
+ "@deepseek-ai/schemastery": "^3.18.2"
61
+ },
62
+ "devDependencies": {
63
+ "@deepseek-ai/cordis": "^4.0.4",
64
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
65
+ "@types/node": "^20.0.0",
66
+ "@types/react": "^18.3.1",
67
+ "esbuild": "^0.24.0",
68
+ "react": "^18.2.0",
69
+ "typescript": "^5.5.0"
70
+ }
71
+ }