@surfishs/dsh-prompt-enhance 0.0.9 → 0.1.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/README.en.md +13 -2
- package/README.md +13 -2
- package/docs/images/panel-en-915.png +0 -0
- package/docs/images/panel.png +0 -0
- package/lib/client.js +119 -66
- package/lib/index.js +208 -131
- package/lib/index.js.map +3 -3
- package/package.json +2 -1
- package/src/admission.ts +146 -0
- package/src/client/EnhanceButton.tsx +34 -15
- package/src/client/ResultDock.tsx +1 -1
- package/src/client/UndoBar.tsx +1 -1
- package/src/client/enhance-client.ts +6 -0
- package/src/client/globals.d.ts +3 -0
- package/src/client/locales.ts +5 -4
- package/src/client/settings-page-spec.ts +9 -1
- package/src/client/styles.ts +34 -30
- package/src/client/useDockAlignment.ts +128 -44
- package/src/config.ts +28 -22
- package/src/enhance-command.ts +32 -10
- package/src/enhance-routes.ts +52 -101
- package/src/enhancer.ts +64 -15
- package/src/http.ts +37 -6
- package/src/index.ts +6 -2
- package/src/reasoning-cache.ts +153 -63
- package/src/shared/normalize.ts +26 -14
package/README.en.md
CHANGED
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Why you need it
|
|
16
|
+
|
|
17
|
+
A prompt is rarely the hard part; shaping it for a model to execute is: the role (who the assistant plays), the deliverable (what it must hand over), the output format (structure, language, length, style), and the acceptance criteria (how to tell the result is right).
|
|
18
|
+
|
|
19
|
+
This plugin adds a Prompt enhance button to the composer; clicking it calls your harness LLM service to produce a properly structured prompt.
|
|
20
|
+
|
|
21
|
+
The enhanced result appears above the composer without covering the conversation; it does not replace the original text by itself — fill it back, copy it, regenerate it, or undo it, and the original stays safe.
|
|
22
|
+
|
|
23
|
+
With context awareness on, it also reads the last few turns to resolve pronouns and works out what you need on its own.
|
|
24
|
+
|
|
15
25
|
## Feature overview
|
|
16
26
|
|
|
17
27
|
| Feature | What it does |
|
|
@@ -36,7 +46,7 @@
|
|
|
36
46
|
|
|
37
47
|
## Install
|
|
38
48
|
|
|
39
|
-
Check the package name first. `dsh-prompt-enhance` on npm (no scope) is the upstream project and this plugin is a rewrite of it; this plugin is `@surfishs/dsh-prompt-enhance`. Install from this repository (`surfishs/dsh-prompt-enhance`)
|
|
49
|
+
Check the package name first. `dsh-prompt-enhance` on npm (no scope) is the upstream project and this plugin is a rewrite of it; this plugin is `@surfishs/dsh-prompt-enhance`. Install from this repository (`surfishs/dsh-prompt-enhance`). **Do not** run `dsh plugin add dsh-prompt-enhance`.
|
|
40
50
|
|
|
41
51
|
### Let an agent install it
|
|
42
52
|
|
|
@@ -126,7 +136,7 @@ An empty or attachment-only draft dims the button and starts no request; raise `
|
|
|
126
136
|
- **No model keys stored**: the plugin does not read or store model API keys; calls use the host's existing LLM configuration.
|
|
127
137
|
- **Context sent only when enabled**: with `contextAware` on, the most recent user/assistant text and the current draft are sent to the configured model provider (default: up to 8 messages and 4,000 characters); system messages, reasoning, tool results and attachments are excluded. With it off, only the draft is sent.
|
|
128
138
|
- **Sensitive conversations**: if the content must not leave the machine, turn off `contextAware` or use a local/private model route you trust.
|
|
129
|
-
- **Local tier cache**: the plugin caches "which reasoning tiers does this route declare"
|
|
139
|
+
- **Local tier cache**: the plugin caches "which reasoning tiers does this route declare" per provider/model under `$DSH_HOME/dsh-prompt-enhance/reasoning-efforts/` (`~/.dsh/…` when `DSH_HOME` is unset), and each entry expires and is re-probed after 30 days. The files hold only the provider, the model and the tier metadata — no API key, draft or conversation text. Refresh them from the settings page's tier-refresh control, or delete the directory.
|
|
130
140
|
|
|
131
141
|
## Troubleshooting
|
|
132
142
|
|
|
@@ -137,6 +147,7 @@ An empty or attachment-only draft dims the button and starts no request; raise `
|
|
|
137
147
|
| Truncated result | Check the truncation warning and raise `maxOutputTokens` in settings. |
|
|
138
148
|
| "No model resolved for enhancement" | Set both `provider` and `model` in settings, or send a message in the current session so the plugin can follow the session route. |
|
|
139
149
|
| Authentication failure | Check the provider credentials/API key configured in DSH. |
|
|
150
|
+
| `/enhance` shows only the first line and cannot be expanded | A rendering limit of the DSH chat UI, not this plugin: as of `@deepseek-ai/dsh-client-ui-chat` 0.2.2-rc.3, only results containing a newline get an expand control, so a single-line result is ellipsized with no way to open it. To read the whole result, put the same text in the composer and use the enhance button — the button's card wraps and scrolls. |
|
|
140
151
|
|
|
141
152
|
## Development
|
|
142
153
|
|
package/README.md
CHANGED
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## 为什么需要它
|
|
16
|
+
|
|
17
|
+
写提示词最费劲的往往不是想法,而是补成适合模型执行的样子:角色(助手扮演谁)、交付物(最终交付什么)、输出格式(结构、语言、长度与风格)、合格标准(怎样判断结果正确)。
|
|
18
|
+
|
|
19
|
+
本插件在输入框加入「提示词增强」按钮,点击即调用 harness LLM 服务生成规范提示词。
|
|
20
|
+
|
|
21
|
+
增强结果展示在对话框上方且不遮挡对话;不直接替换原文,可回填、复制、重新生成或撤销,原文安全。
|
|
22
|
+
|
|
23
|
+
开启上下文感知后参照最近几轮对话消解指代,自主理解任务需求。
|
|
24
|
+
|
|
15
25
|
## 功能一览
|
|
16
26
|
|
|
17
27
|
| 功能 | 说明 |
|
|
@@ -36,7 +46,7 @@
|
|
|
36
46
|
|
|
37
47
|
## 安装
|
|
38
48
|
|
|
39
|
-
装之前请确认包名。npm 上的 `dsh-prompt-enhance`(无 scope)是上游原项目,本插件是它的重写分支,包名是 `@surfishs/dsh-prompt-enhance`。本插件的安装源是本仓库 `surfishs/dsh-prompt-enhance
|
|
49
|
+
装之前请确认包名。npm 上的 `dsh-prompt-enhance`(无 scope)是上游原项目,本插件是它的重写分支,包名是 `@surfishs/dsh-prompt-enhance`。本插件的安装源是本仓库 `surfishs/dsh-prompt-enhance`。**不要**执行 `dsh plugin add dsh-prompt-enhance`。
|
|
40
50
|
|
|
41
51
|
### 让 Agent 帮你安装
|
|
42
52
|
|
|
@@ -126,7 +136,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
126
136
|
- **不保存模型密钥**:插件不读取或存储模型 API key,调用走宿主已有的 LLM 配置。
|
|
127
137
|
- **上下文按需发送**:`contextAware` 开启时,最近几轮 user/assistant 文本和当前草稿会发给当前配置的模型服务商(默认最多 8 条消息、4000 字符);system、reasoning、工具结果和附件不会进入上下文。关闭后只发送草稿。
|
|
128
138
|
- **敏感会话**:如果内容不能外发,请关闭 `contextAware`,或改用你信任的本地/私有模型服务。
|
|
129
|
-
-
|
|
139
|
+
- **本机档位缓存**:插件会把「当前路由声明了哪些推理档位」的查询结果按 provider/model 分别缓存到 `$DSH_HOME/dsh-prompt-enhance/reasoning-efforts/` 目录(未设置 `DSH_HOME` 时为 `~/.dsh/…`),每条缓存 30 天后自动失效并重新探测。文件内容只有 provider、model 与档位信息,不含 API key、草稿或对话内容;也可在设置页点「重新获取档位」立即刷新,或直接删除该目录。
|
|
130
140
|
|
|
131
141
|
## 故障排查
|
|
132
142
|
|
|
@@ -137,6 +147,7 @@ dsh plugin --profile <profile> remove @surfishs/dsh-prompt-enhance
|
|
|
137
147
|
| 结果不完整 | 查看截断提示,并在设置中调高 `maxOutputTokens`。 |
|
|
138
148
|
| 提示「尚未确定增强用的模型」 | 在设置中成对填写 `provider` / `model`;或先在当前会话发一条消息,让插件跟随会话模型。 |
|
|
139
149
|
| 鉴权失败 | 检查对应 provider 在 DSH 中的凭据/API Key 是否有效。 |
|
|
150
|
+
| `/enhance` 的结果只显示第一行、点不开 | 这是 DSH 聊天界面的渲染限制,与本插件无关:截至 `@deepseek-ai/dsh-client-ui-chat` 0.2.2-rc.3,只有含换行的结果才提供展开,单行结果会被省略号截断且没有入口。要看全文,把同样的文本放进输入框、用增强按钮——按钮的结果卡会自动折行并可滚动。 |
|
|
140
151
|
|
|
141
152
|
## 开发
|
|
142
153
|
|
|
Binary file
|
package/docs/images/panel.png
CHANGED
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -118,7 +118,13 @@ function parseResult(value) {
|
|
|
118
118
|
provider: record.provider,
|
|
119
119
|
model: record.model,
|
|
120
120
|
elapsedMs: record.elapsedMs,
|
|
121
|
-
...usage === void 0 ? {} : { usage }
|
|
121
|
+
...usage === void 0 ? {} : { usage },
|
|
122
|
+
// Carried explicitly, not optional-by-accident: the panel's "output hit
|
|
123
|
+
// the token cap" warning is driven by this flag alone, so rebuilding the
|
|
124
|
+
// object without it left the host setting it, the wire carrying it, and
|
|
125
|
+
// the UI never seeing it. Only `true` is ever normalized in, matching the
|
|
126
|
+
// host, which sets the field solely on a capped finish.
|
|
127
|
+
...record.truncated === true ? { truncated: true } : {}
|
|
122
128
|
};
|
|
123
129
|
}
|
|
124
130
|
throw new EnhanceClientError({ code: "internal", params: { reason: "malformed" } });
|
|
@@ -514,8 +520,9 @@ function serverSessionId(maybeSessionId) {
|
|
|
514
520
|
|
|
515
521
|
// src/client/EnhanceButton.tsx
|
|
516
522
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
517
|
-
|
|
518
|
-
|
|
523
|
+
var OCCURRENCES_UNKNOWN = -1;
|
|
524
|
+
function occurrenceCountOf(value) {
|
|
525
|
+
return Array.isArray(value) ? value.length : OCCURRENCES_UNKNOWN;
|
|
519
526
|
}
|
|
520
527
|
function stringOf(value) {
|
|
521
528
|
return typeof value === "string" ? value : "";
|
|
@@ -526,7 +533,7 @@ function EnhanceButton(props) {
|
|
|
526
533
|
const wireId = serverSessionId(sessionId);
|
|
527
534
|
const draft = useInput((state) => stringOf(state.draft));
|
|
528
535
|
const phase = useInput((state) => state.phase);
|
|
529
|
-
const occurrenceCount = useInput((state) =>
|
|
536
|
+
const occurrenceCount = useInput((state) => occurrenceCountOf(state.occurrences));
|
|
530
537
|
const settings = (0, import_react2.useSyncExternalStore)(subscribeClientSettings, getClientSettings);
|
|
531
538
|
const panel = (0, import_react2.useSyncExternalStore)(subscribe, getPanel);
|
|
532
539
|
const rootRef = (0, import_react2.useRef)(null);
|
|
@@ -549,6 +556,11 @@ function EnhanceButton(props) {
|
|
|
549
556
|
openError(uiKey, source, { code: "rejected", localized: message });
|
|
550
557
|
return;
|
|
551
558
|
}
|
|
559
|
+
if (occurrenceCount === OCCURRENCES_UNKNOWN) {
|
|
560
|
+
const unknown = t("error.chipsUnknown");
|
|
561
|
+
openError(uiKey, source, { code: "rejected", localized: unknown });
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
552
564
|
if (occurrenceCount > 0) {
|
|
553
565
|
const occurrences = t("error.occurrences");
|
|
554
566
|
openError(uiKey, source, { code: "rejected", localized: occurrences });
|
|
@@ -602,6 +614,7 @@ function EnhanceButton(props) {
|
|
|
602
614
|
{
|
|
603
615
|
ref: rootRef,
|
|
604
616
|
type: "button",
|
|
617
|
+
"data-dsh-pe-key": uiKey,
|
|
605
618
|
className: `dsh-pe-btn${busy ? " is-busy" : ""}${otherBusy && !empty ? " is-blocked" : ""}${empty && !busy ? " is-empty" : ""}`,
|
|
606
619
|
title: busy ? t("button.busy") : otherBusy ? t("button.otherBusy") : empty ? t("button.emptyTitle") : t("button.title"),
|
|
607
620
|
"aria-label": busy ? t("button.busy") : otherBusy ? t("button.otherBusy") : empty ? t("button.emptyTitle") : t("button.title"),
|
|
@@ -829,44 +842,81 @@ function ResultPanel(props) {
|
|
|
829
842
|
|
|
830
843
|
// src/client/useDockAlignment.ts
|
|
831
844
|
var import_react4 = require("react");
|
|
832
|
-
|
|
845
|
+
var EDITOR_SELECTOR = 'textarea, [contenteditable="true"], [role="textbox"]';
|
|
846
|
+
var SESSION_ANCHOR_ATTRIBUTE = "data-dsh-pe-key";
|
|
847
|
+
var CARD_MIN_WIDTH = 360;
|
|
848
|
+
var CARD_MIN_HEIGHT = 48;
|
|
849
|
+
var CARD_MIN_RADIUS = 4;
|
|
850
|
+
var CARD_MAX_DEPTH = 12;
|
|
851
|
+
var CARD_MAX_VIEWPORT_SHARE = 0.8;
|
|
852
|
+
var CARD_CENTER_TOLERANCE = 40;
|
|
853
|
+
var EDITOR_BELOW_SLACK = 4;
|
|
854
|
+
function isCardSurface(node, minWidth) {
|
|
855
|
+
const rect = node.getBoundingClientRect();
|
|
856
|
+
if (rect.width < minWidth || rect.width <= CARD_MIN_WIDTH || rect.height <= CARD_MIN_HEIGHT) return false;
|
|
857
|
+
const style = getComputedStyle(node);
|
|
858
|
+
return (parseFloat(style.borderTopLeftRadius) || 0) >= CARD_MIN_RADIUS && style.backgroundColor !== "rgba(0, 0, 0, 0)";
|
|
859
|
+
}
|
|
860
|
+
function cardAround(start) {
|
|
861
|
+
let node = start.parentElement;
|
|
862
|
+
for (let depth = 0; depth < CARD_MAX_DEPTH && node !== null; depth++) {
|
|
863
|
+
if (isCardSurface(node, 0)) return node.getBoundingClientRect();
|
|
864
|
+
node = node.parentElement;
|
|
865
|
+
}
|
|
866
|
+
return void 0;
|
|
867
|
+
}
|
|
868
|
+
function editorsIn(scope) {
|
|
869
|
+
return Array.from(scope.querySelectorAll(EDITOR_SELECTOR));
|
|
870
|
+
}
|
|
871
|
+
function useDockAlignment(active, uiKey) {
|
|
833
872
|
const rootRef = (0, import_react4.useRef)(null);
|
|
834
873
|
(0, import_react4.useEffect)(() => {
|
|
835
874
|
if (!active) return;
|
|
836
875
|
const root = rootRef.current;
|
|
837
876
|
if (root === null) return;
|
|
838
877
|
let frame = 0;
|
|
839
|
-
const
|
|
840
|
-
const parent = root.parentElement;
|
|
841
|
-
if (parent === null) return;
|
|
842
|
-
root.style.transform = "";
|
|
843
|
-
const rootRect = root.getBoundingClientRect();
|
|
844
|
-
const editors = Array.from(document.querySelectorAll('textarea, [contenteditable="true"], [role="textbox"]'));
|
|
845
|
-
const editor = editors.find((node2) => {
|
|
846
|
-
const rect = node2.getBoundingClientRect();
|
|
847
|
-
return rect.width > 0 && rect.height > 0 && rect.top >= rootRect.bottom - 4;
|
|
848
|
-
});
|
|
849
|
-
if (editor === void 0) {
|
|
850
|
-
root.style.width = "";
|
|
851
|
-
root.style.marginLeft = "";
|
|
852
|
-
root.style.transform = "";
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
878
|
+
const cardFromEditor = (editor) => {
|
|
855
879
|
const editorRect = editor.getBoundingClientRect();
|
|
856
880
|
const candidates = [];
|
|
857
881
|
let node = editor;
|
|
858
|
-
for (let depth = 0; depth <
|
|
859
|
-
|
|
860
|
-
const style = getComputedStyle(node);
|
|
861
|
-
if (rect.width >= editorRect.width && rect.width > 360 && rect.height > 48 && (parseFloat(style.borderTopLeftRadius) || 0) >= 4 && style.backgroundColor !== "rgba(0, 0, 0, 0)") {
|
|
862
|
-
candidates.push({ node, rect });
|
|
863
|
-
}
|
|
882
|
+
for (let depth = 0; depth < CARD_MAX_DEPTH && node !== null; depth++) {
|
|
883
|
+
if (isCardSurface(node, editorRect.width)) candidates.push(node.getBoundingClientRect());
|
|
864
884
|
node = node.parentElement;
|
|
865
885
|
}
|
|
886
|
+
const widest = (list) => list.sort((a, b) => b.width - a.width)[0];
|
|
887
|
+
if (candidates.length === 0) return void 0;
|
|
866
888
|
const editorCenter = editorRect.left + editorRect.width / 2;
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
889
|
+
const centered = candidates.filter((rect) => rect.width <= window.innerWidth * CARD_MAX_VIEWPORT_SHARE && Math.abs(rect.left + rect.width / 2 - editorCenter) < CARD_CENTER_TOLERANCE);
|
|
890
|
+
return widest(centered) ?? widest(candidates);
|
|
891
|
+
};
|
|
892
|
+
const editorBelow = (scope, rootRect) => editorsIn(scope).find((node) => {
|
|
893
|
+
const rect = node.getBoundingClientRect();
|
|
894
|
+
return rect.width > 0 && rect.height > 0 && rect.top >= rootRect.bottom - EDITOR_BELOW_SLACK;
|
|
895
|
+
});
|
|
896
|
+
const cardForThisEntry = () => {
|
|
897
|
+
if (uiKey !== void 0) {
|
|
898
|
+
const anchor = Array.from(document.querySelectorAll(`[${SESSION_ANCHOR_ATTRIBUTE}]`)).find((node) => node.getAttribute(SESSION_ANCHOR_ATTRIBUTE) === uiKey);
|
|
899
|
+
if (anchor !== void 0) {
|
|
900
|
+
const anchored = cardAround(anchor);
|
|
901
|
+
if (anchored !== void 0) return anchored;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
const rootRect = root.getBoundingClientRect();
|
|
905
|
+
const parent = root.parentElement;
|
|
906
|
+
const scoped = parent === null ? void 0 : editorBelow(parent, rootRect);
|
|
907
|
+
if (scoped !== void 0) {
|
|
908
|
+
const rect = cardFromEditor(scoped);
|
|
909
|
+
if (rect !== void 0) return rect;
|
|
910
|
+
}
|
|
911
|
+
const anywhere = editorBelow(document, rootRect);
|
|
912
|
+
return anywhere === void 0 ? void 0 : cardFromEditor(anywhere);
|
|
913
|
+
};
|
|
914
|
+
const apply2 = (cardRect) => {
|
|
915
|
+
if (cardRect === void 0) {
|
|
916
|
+
root.style.width = "";
|
|
917
|
+
root.style.marginLeft = "";
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
870
920
|
const width = `${cardRect.width}px`;
|
|
871
921
|
if (root.style.width !== width) root.style.width = width;
|
|
872
922
|
const afterWidth = root.getBoundingClientRect();
|
|
@@ -874,6 +924,10 @@ function useDockAlignment(active) {
|
|
|
874
924
|
const marginLeft = `${cardRect.left - (afterWidth.left - currentMargin)}px`;
|
|
875
925
|
if (root.style.marginLeft !== marginLeft) root.style.marginLeft = marginLeft;
|
|
876
926
|
};
|
|
927
|
+
const align = () => {
|
|
928
|
+
root.style.transform = "";
|
|
929
|
+
apply2(cardForThisEntry());
|
|
930
|
+
};
|
|
877
931
|
const schedule = () => {
|
|
878
932
|
cancelAnimationFrame(frame);
|
|
879
933
|
frame = requestAnimationFrame(align);
|
|
@@ -888,7 +942,7 @@ function useDockAlignment(active) {
|
|
|
888
942
|
window.removeEventListener("resize", schedule);
|
|
889
943
|
observer?.disconnect();
|
|
890
944
|
};
|
|
891
|
-
}, [active]);
|
|
945
|
+
}, [active, uiKey]);
|
|
892
946
|
return rootRef;
|
|
893
947
|
}
|
|
894
948
|
|
|
@@ -898,7 +952,7 @@ function ResultDock(props) {
|
|
|
898
952
|
const { t, sessionId, useInput, inputActions } = props;
|
|
899
953
|
const uiKey = useSessionKey(sessionId, inputActions);
|
|
900
954
|
const panel = (0, import_react5.useSyncExternalStore)(subscribe, getPanel);
|
|
901
|
-
const rootRef = useDockAlignment(panel !== void 0 && panel.sessionId === uiKey);
|
|
955
|
+
const rootRef = useDockAlignment(panel !== void 0 && panel.sessionId === uiKey, uiKey);
|
|
902
956
|
const [undone, setUndone] = (0, import_react5.useState)(false);
|
|
903
957
|
const [regenerated, setRegenerated] = (0, import_react5.useState)(false);
|
|
904
958
|
const [pendingRegenerate, setPendingRegenerate] = (0, import_react5.useState)(false);
|
|
@@ -1027,7 +1081,7 @@ function UndoBar(props) {
|
|
|
1027
1081
|
}, [draft, entry, uiKey]);
|
|
1028
1082
|
const panel = getPanel();
|
|
1029
1083
|
const visible = (panel === void 0 || panel.sessionId !== uiKey) && entry !== void 0 && entry.applied === draft;
|
|
1030
|
-
const rootRef = useDockAlignment(visible);
|
|
1084
|
+
const rootRef = useDockAlignment(visible, uiKey);
|
|
1031
1085
|
if (!visible) return null;
|
|
1032
1086
|
const undo = () => {
|
|
1033
1087
|
inputActions.setDraft(entry.original);
|
|
@@ -1085,8 +1139,8 @@ var zh = {
|
|
|
1085
1139
|
"undo.dismiss": "\u5173\u95ED\u63D0\u793A",
|
|
1086
1140
|
"error.empty": "\u8F93\u5165\u6846\u4E3A\u7A7A\uFF0C\u8BF7\u5148\u8F93\u5165\u8981\u589E\u5F3A\u7684\u63D0\u793A\u8BCD\u3002",
|
|
1087
1141
|
"error.tooLong": "\u5185\u5BB9\u5171 {count} \u4E2A\u5B57\u7B26\uFF0C\u8D85\u8FC7 {max} \u4E2A\u5B57\u7B26\u4E0A\u9650\uFF08\u6309 Unicode \u5B57\u7B26\u6570\u7EDF\u8BA1\uFF0C\u4E0D\u662F token \u6570\uFF09\u3002\u4E3A\u907F\u514D\u6539\u53D8\u539F\u610F\u4E0D\u4F1A\u81EA\u52A8\u622A\u65AD\uFF0C\u8BF7\u7CBE\u7B80\u540E\u518D\u8BD5\u3002",
|
|
1088
|
-
"error.attachmentsOnly": "\u8F93\u5165\u6846\u53EA\u9644\u52A0\u4E86\u9644\u4EF6\uFF08\u56FE\u7247\u6216\u6587\u4EF6\uFF09\uFF0C\u8BF7\u8865\u5145\u8981\u589E\u5F3A\u7684\u6587\u672C\u3002",
|
|
1089
1142
|
"error.occurrences": "\u8F93\u5165\u5185\u5BB9\u5305\u542B\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u540E\u518D\u8BD5\u3002",
|
|
1143
|
+
"error.chipsUnknown": "\u65E0\u6CD5\u8BFB\u53D6\u8F93\u5165\u6846\u7684\u5F15\u7528\u72B6\u6001\uFF08\u5BBF\u4E3B\u672A\u63D0\u4F9B\u5F15\u7528\u4FE1\u606F\uFF09\u3002\u4E3A\u907F\u514D\u8986\u76D6\u5DF2\u6DFB\u52A0\u7684\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u672C\u6B21\u589E\u5F3A\u5DF2\u963B\u6B62\uFF1B\u8BF7\u6E05\u7A7A\u8F93\u5165\u6846\u540E\u8F93\u5165\u7EAF\u6587\u672C\u8349\u7A3F\uFF0C\u6216\u5347\u7EA7 DSH \u540E\u91CD\u8BD5\u3002",
|
|
1090
1144
|
"error.phase": "\u5F53\u524D\u8F93\u5165\u6B63\u88AB\u5360\u7528\uFF08\u63D0\u4EA4\u4E2D\uFF09\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
1091
1145
|
"error.disabled": "\u63D0\u793A\u8BCD\u589E\u5F3A\u5DF2\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u5173\u95ED\u3002",
|
|
1092
1146
|
"error.rejected": "\u589E\u5F3A\u8BF7\u6C42\u88AB\u62D2\u7EDD\u3002",
|
|
@@ -1184,7 +1238,7 @@ var zh = {
|
|
|
1184
1238
|
"settings.strategy.extend": "\u8FFD\u52A0\u5728\u5185\u7F6E\u7B56\u7565\u540E",
|
|
1185
1239
|
"settings.reasoning.inherit": "\u63D0\u4F9B\u65B9\u9ED8\u8BA4",
|
|
1186
1240
|
"settings.reasoning.loading": "\u6B63\u5728\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D\u2026",
|
|
1187
|
-
"settings.reasoning.unavailable": "\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D\
|
|
1241
|
+
"settings.reasoning.unavailable": "\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6A21\u578B\u7684\u6863\u4F4D\u5217\u8868\uFF1B\u5DF2\u4FDD\u5B58\u7684\u6863\u4F4D\u4ECD\u4F1A\u7167\u5E38\u53D1\u9001\u3002",
|
|
1188
1242
|
"settings.reasoning.noTiers": "\u8BE5\u6A21\u578B\u672A\u58F0\u660E\u63A8\u7406\u6863\u4F4D\uFF0C\u8C03\u7528\u65F6\u5C06\u8DDF\u968F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\u3002",
|
|
1189
1243
|
"settings.reasoning.unsupported": "\u5F53\u524D\u503C\u300C{effort}\u300D\u4E0D\u5728\u8BE5\u6A21\u578B\u652F\u6301\u7684\u6863\u4F4D\u4E2D\u3002",
|
|
1190
1244
|
"settings.reasoning.current": "\u5F53\u524D\u503C\uFF1A{value}",
|
|
@@ -1231,8 +1285,8 @@ var en = {
|
|
|
1231
1285
|
"undo.dismiss": "Dismiss",
|
|
1232
1286
|
"error.empty": "The input box is empty \u2014 type a prompt to enhance first.",
|
|
1233
1287
|
"error.tooLong": "The draft is {count} characters, above the {max} cap (Unicode characters, not tokens). It is never auto-truncated (that would change your meaning) \u2014 please shorten it.",
|
|
1234
|
-
"error.attachmentsOnly": "The composer only has attachments; add the text you want enhanced.",
|
|
1235
1288
|
"error.occurrences": "The draft contains commands or file references, which are not supported yet \u2014 remove them first.",
|
|
1289
|
+
"error.chipsUnknown": "The composer reference state could not be read on this host, so the enhancement was blocked to avoid overwriting a command or file reference. Clear the input box and type plain text, or update DSH, then retry.",
|
|
1236
1290
|
"error.phase": "The input box is busy (submitting) \u2014 try again in a moment.",
|
|
1237
1291
|
"error.disabled": "Prompt enhance is disabled in the plugin settings.",
|
|
1238
1292
|
"error.rejected": "The enhance request was rejected.",
|
|
@@ -1330,7 +1384,7 @@ var en = {
|
|
|
1330
1384
|
"settings.strategy.extend": "Append after the built-in strategy",
|
|
1331
1385
|
"settings.reasoning.inherit": "Provider default",
|
|
1332
1386
|
"settings.reasoning.loading": "Reading this model\u2019s tiers\u2026",
|
|
1333
|
-
"settings.reasoning.unavailable": "Could not read this model\u2019s
|
|
1387
|
+
"settings.reasoning.unavailable": "Could not read this model\u2019s tier list; your saved tier is still sent.",
|
|
1334
1388
|
"settings.reasoning.noTiers": "This model declares no reasoning tiers; calls follow the provider default.",
|
|
1335
1389
|
"settings.reasoning.unsupported": "The current value \u201C{effort}\u201D is not one of this model\u2019s tiers.",
|
|
1336
1390
|
"settings.reasoning.current": "Current value: {value}",
|
|
@@ -1349,16 +1403,19 @@ var CSS = `
|
|
|
1349
1403
|
.dsh-pe-dock { width: 100%; }
|
|
1350
1404
|
.dsh-pe-panel {
|
|
1351
1405
|
box-sizing: border-box;
|
|
1352
|
-
--pe-bg: #1f2127;
|
|
1353
|
-
--pe-fg: #e6e8ee;
|
|
1354
|
-
--pe-fg-dim: rgba(230, 232, 238, 0.55);
|
|
1355
|
-
--pe-border: rgba(127, 127, 127, 0.35);
|
|
1356
|
-
--pe-separator: rgba(127, 127, 127, 0.25);
|
|
1406
|
+
--pe-bg: var(--dsw-alias-bg-layer-1, #1f2127);
|
|
1407
|
+
--pe-fg: var(--dsw-alias-label-primary, #e6e8ee);
|
|
1408
|
+
--pe-fg-dim: var(--dsw-alias-label-secondary, rgba(230, 232, 238, 0.55));
|
|
1409
|
+
--pe-border: var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.35));
|
|
1410
|
+
--pe-separator: var(--dsw-alias-border-l1, rgba(127, 127, 127, 0.25));
|
|
1411
|
+
/* No hover token exists: a neutral grey alpha is already theme-agnostic. */
|
|
1357
1412
|
--pe-hover: rgba(127, 127, 127, 0.18);
|
|
1358
|
-
--pe-danger: #ffb4a8;
|
|
1359
|
-
--pe-warn-fg: #e8c07d;
|
|
1360
|
-
|
|
1361
|
-
|
|
1413
|
+
--pe-danger: var(--dsw-alias-state-error-primary, #ffb4a8);
|
|
1414
|
+
--pe-warn-fg: var(--dsw-alias-state-warn-primary, #e8c07d);
|
|
1415
|
+
/* Tints of the themed warning color, so the banner cannot keep an amber cast
|
|
1416
|
+
from the other scheme. */
|
|
1417
|
+
--pe-warn-border: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 35%, transparent);
|
|
1418
|
+
--pe-warn-bg: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 12%, transparent);
|
|
1362
1419
|
display: flex;
|
|
1363
1420
|
flex-direction: column;
|
|
1364
1421
|
width: 100%;
|
|
@@ -1370,20 +1427,6 @@ var CSS = `
|
|
|
1370
1427
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 4px 14px rgba(0, 0, 0, 0.05);
|
|
1371
1428
|
overflow: hidden;
|
|
1372
1429
|
}
|
|
1373
|
-
@media (prefers-color-scheme: light) {
|
|
1374
|
-
.dsh-pe-panel {
|
|
1375
|
-
--pe-bg: #ffffff;
|
|
1376
|
-
--pe-fg: #1c1e24;
|
|
1377
|
-
--pe-fg-dim: rgba(28, 30, 36, 0.55);
|
|
1378
|
-
--pe-border: rgba(0, 0, 0, 0.18);
|
|
1379
|
-
--pe-separator: rgba(0, 0, 0, 0.12);
|
|
1380
|
-
--pe-hover: rgba(0, 0, 0, 0.08);
|
|
1381
|
-
--pe-danger: #a63a2e;
|
|
1382
|
-
--pe-warn-fg: #8a5a00;
|
|
1383
|
-
--pe-warn-border: rgba(176, 122, 0, 0.4);
|
|
1384
|
-
--pe-warn-bg: rgba(230, 158, 60, 0.15);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
1430
|
.dsh-pe-head {
|
|
1388
1431
|
display: flex;
|
|
1389
1432
|
align-items: center;
|
|
@@ -1475,7 +1518,7 @@ var CSS = `
|
|
|
1475
1518
|
.dsh-pe-spin.small { width: 11px; height: 11px; border-width: 1px; }
|
|
1476
1519
|
.dsh-pe-spin {
|
|
1477
1520
|
width: 22px; height: 22px; border-radius: 50%;
|
|
1478
|
-
border: 2px solid var(--pe-separator); border-top-color: #6ea8ff;
|
|
1521
|
+
border: 2px solid var(--pe-separator); border-top-color: var(--dsw-alias-brand-primary, #6ea8ff);
|
|
1479
1522
|
animation: dsh-pe-spin 0.9s linear infinite;
|
|
1480
1523
|
}
|
|
1481
1524
|
.dsh-pe-foot {
|
|
@@ -1506,10 +1549,20 @@ var CSS = `
|
|
|
1506
1549
|
.dsh-pe-btn-action.primary {
|
|
1507
1550
|
min-width: 112px;
|
|
1508
1551
|
border-color: transparent;
|
|
1509
|
-
|
|
1510
|
-
|
|
1552
|
+
/* Fill and label are a PAIR: the alias layer flips brand-primary from
|
|
1553
|
+
near-black (light theme) to near-white (dark theme), so the label has to
|
|
1554
|
+
flip with it \u2014 a hardcoded foreground turns the dark theme into
|
|
1555
|
+
white-on-white. label-primary-inverted is the color the shell itself
|
|
1556
|
+
paints onto an inverted surface; the fallback chain keeps an inverted label
|
|
1557
|
+
on hosts that predate that token. */
|
|
1558
|
+
background: var(--dsw-alias-brand-primary, #3f76e1);
|
|
1559
|
+
color: var(--dsw-alias-label-primary-inverted, var(--dsw-alias-bg-base, #ffffff));
|
|
1560
|
+
}
|
|
1561
|
+
.dsh-pe-btn-action.primary:hover {
|
|
1562
|
+
/* Blend toward the panel surface, not toward white: in the dark theme white
|
|
1563
|
+
IS the fill, so a white-ward blend would show no hover change at all. */
|
|
1564
|
+
background: color-mix(in srgb, var(--dsw-alias-brand-primary, #3f76e1) 88%, var(--dsw-alias-bg-layer-1, #1f2127));
|
|
1511
1565
|
}
|
|
1512
|
-
.dsh-pe-btn-action.primary:hover { background: #4d82ec; }
|
|
1513
1566
|
.dsh-pe-btn-action.plain { background: transparent; color: inherit; }
|
|
1514
1567
|
.dsh-pe-btn-action.plain:hover { background: var(--pe-hover); }
|
|
1515
1568
|
.dsh-pe-btn-action.dsh-pe-copy { min-width: 96px; }
|
|
@@ -2048,7 +2101,7 @@ var SETTINGS_SECTION_ORDER = 70;
|
|
|
2048
2101
|
var SETTINGS_SECTION_LABEL = "\u63D0\u793A\u8BCD\u589E\u5F3A";
|
|
2049
2102
|
var SETTINGS_ROW_CONFIG_SLOT = "plugins.row.config";
|
|
2050
2103
|
var SETTINGS_NAMESPACE = "dsh-prompt-enhance";
|
|
2051
|
-
var SETTINGS_BUNDLE = "@surfishs/dsh-prompt-enhance";
|
|
2104
|
+
var SETTINGS_BUNDLE = true ? "@surfishs/dsh-prompt-enhance" : "@surfishs/dsh-prompt-enhance";
|
|
2052
2105
|
var SETTINGS_ROW_ID = "dsh-prompt-enhance";
|
|
2053
2106
|
var SETTINGS_ROW_CONFIG_KEY = `${SETTINGS_BUNDLE}#${SETTINGS_ROW_ID}`;
|
|
2054
2107
|
function settingsBooleanField(key) {
|
|
@@ -2340,7 +2393,7 @@ var REPOSITORY_URL = "https://github.com/surfishs/dsh-prompt-enhance";
|
|
|
2340
2393
|
var NPM_URL = "https://www.npmjs.com/package/@surfishs/dsh-prompt-enhance";
|
|
2341
2394
|
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";
|
|
2342
2395
|
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";
|
|
2343
|
-
var PLUGIN_VERSION = true ? "0.0
|
|
2396
|
+
var PLUGIN_VERSION = true ? "0.1.0" : "0.0.0";
|
|
2344
2397
|
var HEADER_STYLE = { display: "flex", flexDirection: "column", gap: 12, padding: "2px 0" };
|
|
2345
2398
|
var HEADER_ROW_STYLE = { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" };
|
|
2346
2399
|
var HEADER_TITLE_STYLE = {
|