dsh-composer-send-key 0.0.0-stage → 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Licheung228
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,63 @@
1
- # Temporary Holding Version
1
+ # Composer send key
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
+ [English](README.md) | [中文](README.zh.md)
4
+
5
+ Choose how the DeepSeek Harness message composer sends.
6
+
7
+ | Mode | Enter | Send with |
8
+ |---|---|---|
9
+ | Default | Sends | `Enter` |
10
+ | Edit-friendly | Inserts a new line | `Shift + Enter` or `Ctrl + Enter` |
11
+
12
+ ## Install
13
+
14
+ 1. Open **Plugins** in DeepSeek Harness.
15
+ 2. Choose **Add plugin**.
16
+ 3. Enter `dsh-composer-send-key` and confirm.
17
+
18
+ The package installs from npm, so no local path is needed. From a terminal:
19
+
20
+ ```sh
21
+ dsh plugin --profile <profile> add dsh-composer-send-key
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ Open **Settings → Send shortcut**. The page has two choices:
27
+
28
+ - **Default** — `Enter` sends and `Shift + Enter` starts a new line.
29
+ - **Edit-friendly** — `Enter` starts a new line. The shortcut row underneath chooses whether `Shift + Enter` or `Ctrl + Enter` sends.
30
+
31
+ The change applies immediately and is stored in your profile. You can also set it in the profile patch:
32
+
33
+ ```yaml
34
+ - id: composer-send-key
35
+ name: 'dsh-composer-send-key'
36
+ config:
37
+ mode: edit-friendly # or: default
38
+ combo: shift # or: ctrl
39
+ ```
40
+
41
+ ## Behavior
42
+
43
+ - Scope is the message composer only. The sidebar terminal, search fields and other inputs keep their own `Enter` behavior.
44
+ - **Default** leaves the shipped keyboard handling untouched.
45
+ - **Edit-friendly** lets exactly one shortcut send: the chosen `Shift + Enter` or `Ctrl + Enter`. Every other Enter chord inserts a new line, including `⌘ + Enter` and the shipped `Ctrl/⌘ + Enter` accelerated delivery.
46
+ - With the command or suggestion menu open, the chosen shortcut confirms the highlighted item and the other chords insert a new line.
47
+ - IME composition is untouched: a composition-closing `Enter` never submits or inserts a stray newline.
48
+ - The busy-composer queue/steer preference, the Send button and the shortcuts reference keep their shipped behavior.
49
+ - Disabling or removing the plugin restores the default behavior.
50
+
51
+ ## Development
52
+
53
+ The project is TypeScript. Host and Client sources live in `src/` and build to `lib/`:
54
+
55
+ ```sh
56
+ pnpm install
57
+ pnpm build # typecheck, then bundle lib/index.js and lib/client.js
58
+ pnpm typecheck
59
+ ```
60
+
61
+ `src/index.ts` is the Host half (the two volatile preferences). `src/client/` holds the Settings page, the dictionaries and the composer-only key guard. The Client bundle is a single self-contained file that registers through the page's module loader.
62
+
63
+ This plugin relies on the composer's internal DOM (`[data-composer-card]`) and keyboard handling. Re-check it after a DeepSeek Harness upgrade; if the internals change, the plugin falls back to the shipped behavior instead of breaking input.
package/README.zh.md ADDED
@@ -0,0 +1,63 @@
1
+ # 发送快捷键
2
+
3
+ [English](README.md) | [中文](README.zh.md)
4
+
5
+ 选择 DeepSeek Harness 消息框的发送方式。
6
+
7
+ | 模式 | Enter | 发送键 |
8
+ |---|---|---|
9
+ | 默认 | 发送 | `Enter` |
10
+ | 编辑友好 | 换行 | `Shift + Enter` 或 `Ctrl + Enter` |
11
+
12
+ ## 安装
13
+
14
+ 1. 在 DeepSeek Harness 中打开 **插件**。
15
+ 2. 选择 **安装插件**。
16
+ 3. 输入 `dsh-composer-send-key` 并确认。
17
+
18
+ 包直接从 npm 安装,不需要本地路径。也可以在终端执行:
19
+
20
+ ```sh
21
+ dsh plugin --profile <profile> add dsh-composer-send-key
22
+ ```
23
+
24
+ ## 使用
25
+
26
+ 打开 **设置 → 发送快捷键**。页面只有两项:
27
+
28
+ - **默认** — `Enter` 发送,`Shift + Enter` 换行。
29
+ - **编辑友好模式** — `Enter` 换行;下方选择用 `Shift + Enter` 还是 `Ctrl + Enter` 发送。
30
+
31
+ 修改立即生效,并保存在当前配置档案中。你也可以直接写在 profile patch 里:
32
+
33
+ ```yaml
34
+ - id: composer-send-key
35
+ name: 'dsh-composer-send-key'
36
+ config:
37
+ mode: edit-friendly # 或 default
38
+ combo: shift # 或 ctrl
39
+ ```
40
+
41
+ ## 行为
42
+
43
+ - 只作用于消息发送框。右侧栏终端、搜索框和其他输入框保持各自的 `Enter` 行为。
44
+ - **默认模式**不改动内置键盘处理。
45
+ - **编辑友好模式**下只有一个快捷键会发送:你选择的 `Shift + Enter` 或 `Ctrl + Enter`。其余 Enter 组合一律换行,包括 `⌘ + Enter` 以及内置的 `Ctrl/⌘ + Enter` 加速发送。
46
+ - 命令/候选菜单打开时,选中的快捷键确认高亮项,其余组合换行。
47
+ - 输入法合成不受影响:用于结束候选的 `Enter` 不会发送,也不会多插入换行。
48
+ - 运行中消息框的排队/插话偏好、发送按钮和快捷键参考页保持原样。
49
+ - 停用或移除插件后恢复默认行为。
50
+
51
+ ## 开发
52
+
53
+ 项目使用 TypeScript。Host 与 Client 源码在 `src/`,构建产物在 `lib/`:
54
+
55
+ ```sh
56
+ pnpm install
57
+ pnpm build # 先类型检查,再打包 lib/index.js 和 lib/client.js
58
+ pnpm typecheck
59
+ ```
60
+
61
+ `src/index.ts` 是 Host 侧(两个 volatile 配置项)。`src/client/` 包含设置页、文案和仅作用于消息框的按键守卫。Client 打包为单个自包含文件,通过页面模块加载器注册。
62
+
63
+ 本插件依赖消息框内部 DOM(`[data-composer-card]`)与键盘处理。升级 DeepSeek Harness 后请重新验证;若内部结构变化,插件会退回内置行为,而不是破坏输入。
@@ -0,0 +1,6 @@
1
+ - insert:
2
+ - id: composer-send-key
3
+ name: 'dsh-composer-send-key'
4
+ config:
5
+ mode: default
6
+ combo: shift
package/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
2
+ <path d="M18 2.5 14.5 7.5h7z" fill="#247bbf"/>
3
+ <rect x="4" y="10" width="28" height="19" rx="4.5" fill="#eaf2fc" stroke="#247bbf" stroke-width="1.8"/>
4
+ <path d="M23 15v5a2 2 0 0 1-2 2H12.5" fill="none" stroke="#247bbf" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M16 18.5 12.5 22 16 25.5" fill="none" stroke="#247bbf" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </svg>
package/lib/client.js ADDED
@@ -0,0 +1,447 @@
1
+ "use strict";
2
+ (() => {
3
+ // src/constants.ts
4
+ var PLUGIN_ID = "dsh-composer-send-key";
5
+ var LOCALE_NS = "composer-send-key";
6
+ var MODE_FIELD = "mode";
7
+ var COMBO_FIELD = "combo";
8
+ var DEFAULT_MODE = "default";
9
+ var EDIT_FRIENDLY_MODE = "edit-friendly";
10
+ var DEFAULT_COMBO = "shift";
11
+ var CTRL_COMBO = "ctrl";
12
+ var SETTINGS_SECTION_ID = "composer-send-key";
13
+ var SETTINGS_SECTION_ORDER = 5;
14
+ var COMPOSER_CARD_SELECTOR = "[data-composer-card]";
15
+ var NON_COMPOSER_SELECTOR = ".xterm, [data-sidebar-terminal], input, textarea, select";
16
+ var MODE_RADIO_NAME = "dsh-composer-send-key-mode";
17
+ var COMBO_RADIO_NAME = "dsh-composer-send-key-combo";
18
+ var COMPOSITION_GUARD_MS = 10;
19
+
20
+ // src/settings.ts
21
+ function readSettings(value) {
22
+ const record = typeof value === "object" && value !== null ? value : {};
23
+ return {
24
+ mode: record.mode === EDIT_FRIENDLY_MODE ? EDIT_FRIENDLY_MODE : DEFAULT_MODE,
25
+ combo: record.combo === CTRL_COMBO ? CTRL_COMBO : DEFAULT_COMBO
26
+ };
27
+ }
28
+
29
+ // src/keys.ts
30
+ var NEWLINE_REWRITE = { shiftKey: true, ctrlKey: false, metaKey: false };
31
+ function resolveEnterRewrite(facts, mode, combo) {
32
+ if (mode !== EDIT_FRIENDLY_MODE) return null;
33
+ if (facts.key !== "Enter" || facts.composing || facts.altGraph || facts.altKey) return null;
34
+ const isSendChord = combo === CTRL_COMBO ? facts.ctrlKey && !facts.shiftKey && !facts.metaKey : facts.shiftKey && !facts.ctrlKey && !facts.metaKey;
35
+ if (isSendChord) return combo === CTRL_COMBO ? { ctrlKey: false } : { shiftKey: false };
36
+ if (facts.ctrlKey || facts.metaKey) return { ...NEWLINE_REWRITE };
37
+ if (facts.shiftKey) return null;
38
+ return { shiftKey: true };
39
+ }
40
+
41
+ // src/client/dom.ts
42
+ function isComposerEditable(target) {
43
+ if (!(target instanceof HTMLElement)) return false;
44
+ if (!target.isContentEditable) return false;
45
+ if (target.closest(NON_COMPOSER_SELECTOR) !== null) return false;
46
+ return target.closest(COMPOSER_CARD_SELECTOR) !== null;
47
+ }
48
+
49
+ // src/client/keyboard.ts
50
+ function keyFacts(event, composingRecently) {
51
+ return {
52
+ key: event.key,
53
+ shiftKey: event.shiftKey,
54
+ ctrlKey: event.ctrlKey,
55
+ metaKey: event.metaKey,
56
+ altKey: event.altKey,
57
+ altGraph: typeof event.getModifierState === "function" && event.getModifierState("AltGraph"),
58
+ composing: event.isComposing || event.keyCode === 229 || composingRecently
59
+ };
60
+ }
61
+ function setModifier(event, modifier, value, warned) {
62
+ try {
63
+ Object.defineProperty(event, modifier, {
64
+ configurable: true,
65
+ enumerable: true,
66
+ get: () => value
67
+ });
68
+ } catch {
69
+ if (warned.has(modifier)) return;
70
+ warned.add(modifier);
71
+ console.warn(`[composer-send-key] ${modifier} is not configurable; edit-friendly mode is inactive for this event`);
72
+ }
73
+ }
74
+ function installComposerKeyGuard(read) {
75
+ let composing = false;
76
+ let composingUntil = 0;
77
+ const warned = /* @__PURE__ */ new Set();
78
+ const recentlyComposing = () => composing || Date.now() < composingUntil;
79
+ const onCompositionStart = (event) => {
80
+ if (isComposerEditable(event.target)) composing = true;
81
+ };
82
+ const onCompositionEnd = () => {
83
+ if (!composing) return;
84
+ composing = false;
85
+ composingUntil = Date.now() + COMPOSITION_GUARD_MS;
86
+ };
87
+ const onKeyDown = (event) => {
88
+ if (!isComposerEditable(event.target)) return;
89
+ const settings = read();
90
+ const rewrite = resolveEnterRewrite(keyFacts(event, recentlyComposing()), settings.mode, settings.combo);
91
+ if (rewrite === null) return;
92
+ if (rewrite.shiftKey !== void 0) setModifier(event, "shiftKey", rewrite.shiftKey, warned);
93
+ if (rewrite.ctrlKey !== void 0) setModifier(event, "ctrlKey", rewrite.ctrlKey, warned);
94
+ if (rewrite.metaKey !== void 0) setModifier(event, "metaKey", rewrite.metaKey, warned);
95
+ };
96
+ const options = { capture: true };
97
+ document.addEventListener("keydown", onKeyDown, options);
98
+ document.addEventListener("compositionstart", onCompositionStart, options);
99
+ document.addEventListener("compositionend", onCompositionEnd, options);
100
+ return () => {
101
+ document.removeEventListener("keydown", onKeyDown, options);
102
+ document.removeEventListener("compositionstart", onCompositionStart, options);
103
+ document.removeEventListener("compositionend", onCompositionEnd, options);
104
+ };
105
+ }
106
+
107
+ // src/client/locales.ts
108
+ var en = {
109
+ nav: "Send shortcut",
110
+ "mode.default": "Default",
111
+ "mode.editFriendly": "Edit-friendly",
112
+ "mode.label": "Send mode",
113
+ "combo.label": "Shortcut key",
114
+ "action.send": "Sends",
115
+ "action.newline": "New line",
116
+ saveFailed: "Could not save; the change applies to this session only."
117
+ };
118
+ var zh = {
119
+ nav: "\u53D1\u9001\u5FEB\u6377\u952E",
120
+ "mode.default": "\u9ED8\u8BA4",
121
+ "mode.editFriendly": "\u7F16\u8F91\u53CB\u597D\u6A21\u5F0F",
122
+ "mode.label": "\u53D1\u9001\u6A21\u5F0F",
123
+ "combo.label": "\u7EC4\u5408\u952E",
124
+ "action.send": "\u53D1\u9001",
125
+ "action.newline": "\u6362\u884C",
126
+ saveFailed: "\u4FDD\u5B58\u5931\u8D25\uFF0C\u672C\u6B21\u4FEE\u6539\u4EC5\u5728\u5F53\u524D\u4F1A\u8BDD\u751F\u6548\u3002"
127
+ };
128
+ var DICTIONARIES = { en, zh };
129
+
130
+ // src/client/section-icon.ts
131
+ function createSectionIcon(h) {
132
+ return function SectionIcon({ size, active }) {
133
+ const stroke = {
134
+ fill: "none",
135
+ stroke: "currentColor",
136
+ strokeWidth: active ? 1.75 : 1.5,
137
+ strokeLinecap: "round",
138
+ strokeLinejoin: "round"
139
+ };
140
+ return h(
141
+ "svg",
142
+ {
143
+ "data-el-id": "csk-icon",
144
+ width: size,
145
+ height: size,
146
+ viewBox: "0 0 16 16",
147
+ "aria-hidden": "true",
148
+ focusable: "false"
149
+ },
150
+ h("path", {
151
+ "data-el-id": "csk-icon-corner",
152
+ d: "M13 3v5a3 3 0 0 1-3 3H4",
153
+ ...stroke
154
+ }),
155
+ h("path", {
156
+ "data-el-id": "csk-icon-arrow",
157
+ d: "M7 8 4 11l3 3",
158
+ ...stroke
159
+ })
160
+ );
161
+ };
162
+ }
163
+
164
+ // src/client/settings-page.ts
165
+ function keyCap(h, id, text) {
166
+ return h("kbd", { className: "csk-kbd", "data-el-id": id }, text);
167
+ }
168
+ function action(h, id, text) {
169
+ return h("span", { className: "csk-action", "data-el-id": id }, text);
170
+ }
171
+ function keyLine({ h, t, prefix, sendKey, newlineKey }) {
172
+ return h(
173
+ "span",
174
+ { className: "csk-keys", "data-el-id": `${prefix}-keys` },
175
+ h(
176
+ "span",
177
+ { className: "csk-pair", "data-el-id": `${prefix}-pair-send` },
178
+ keyCap(h, `${prefix}-kbd-send`, sendKey),
179
+ action(h, `${prefix}-action-send`, t("action.send"))
180
+ ),
181
+ h(
182
+ "span",
183
+ { className: "csk-pair", "data-el-id": `${prefix}-pair-newline` },
184
+ keyCap(h, `${prefix}-kbd-newline`, newlineKey),
185
+ action(h, `${prefix}-action-newline`, t("action.newline"))
186
+ )
187
+ );
188
+ }
189
+ function renderModeOption({ h, id, title, checked, keys, onSelect }) {
190
+ return h(
191
+ "label",
192
+ { className: "csk-option", "data-el-id": `csk-option-${id}` },
193
+ h("input", {
194
+ className: "csk-radio",
195
+ "data-el-id": `csk-radio-${id}`,
196
+ type: "radio",
197
+ name: MODE_RADIO_NAME,
198
+ value: id,
199
+ checked,
200
+ onChange: onSelect
201
+ }),
202
+ h("span", { className: "csk-title", "data-el-id": `csk-title-${id}` }, title),
203
+ keys
204
+ );
205
+ }
206
+ function renderComboChip({ h, id, label, checked, onSelect }) {
207
+ return h(
208
+ "label",
209
+ {
210
+ className: checked ? "csk-chip csk-chip-selected" : "csk-chip",
211
+ "data-el-id": `csk-combo-${id}`
212
+ },
213
+ h("input", {
214
+ className: "csk-radio",
215
+ "data-el-id": `csk-combo-radio-${id}`,
216
+ type: "radio",
217
+ name: COMBO_RADIO_NAME,
218
+ value: id,
219
+ checked,
220
+ onChange: onSelect
221
+ }),
222
+ keyCap(h, `csk-combo-kbd-${id}`, label)
223
+ );
224
+ }
225
+ function createSettingsPage(h) {
226
+ return function SettingsPage(props) {
227
+ const { useMode, useCombo, useSaveError, setMode, setCombo, t } = props;
228
+ const mode = useMode((value) => value);
229
+ const combo = useCombo((value) => value);
230
+ const saveError = useSaveError((value) => value);
231
+ const editFriendly = mode === EDIT_FRIENDLY_MODE;
232
+ const comboLabel = combo === CTRL_COMBO ? "Ctrl + Enter" : "Shift + Enter";
233
+ return h(
234
+ "section",
235
+ { className: "csk-section", "data-el-id": "csk-section" },
236
+ h(
237
+ "div",
238
+ { className: "csk-card", "data-el-id": "csk-card" },
239
+ h(
240
+ "div",
241
+ {
242
+ className: "csk-options",
243
+ "data-el-id": "csk-options",
244
+ role: "radiogroup",
245
+ "aria-label": t("mode.label")
246
+ },
247
+ renderModeOption({
248
+ h,
249
+ id: "default",
250
+ title: t("mode.default"),
251
+ checked: mode === DEFAULT_MODE,
252
+ keys: keyLine({
253
+ h,
254
+ t,
255
+ prefix: "csk-default",
256
+ sendKey: "Enter",
257
+ newlineKey: "Shift + Enter"
258
+ }),
259
+ onSelect: () => {
260
+ setMode(DEFAULT_MODE);
261
+ }
262
+ }),
263
+ renderModeOption({
264
+ h,
265
+ id: "edit-friendly",
266
+ title: t("mode.editFriendly"),
267
+ checked: editFriendly,
268
+ keys: keyLine({
269
+ h,
270
+ t,
271
+ prefix: "csk-edit",
272
+ sendKey: comboLabel,
273
+ newlineKey: "Enter"
274
+ }),
275
+ onSelect: () => {
276
+ setMode(EDIT_FRIENDLY_MODE);
277
+ }
278
+ })
279
+ ),
280
+ editFriendly ? h(
281
+ "div",
282
+ {
283
+ className: "csk-combo",
284
+ "data-el-id": "csk-combo",
285
+ role: "radiogroup",
286
+ "aria-label": t("combo.label")
287
+ },
288
+ renderComboChip({
289
+ h,
290
+ id: DEFAULT_COMBO,
291
+ label: "Shift + Enter",
292
+ checked: combo === DEFAULT_COMBO,
293
+ onSelect: () => {
294
+ setCombo(DEFAULT_COMBO);
295
+ }
296
+ }),
297
+ renderComboChip({
298
+ h,
299
+ id: CTRL_COMBO,
300
+ label: "Ctrl + Enter",
301
+ checked: combo === CTRL_COMBO,
302
+ onSelect: () => {
303
+ setCombo(CTRL_COMBO);
304
+ }
305
+ })
306
+ ) : null
307
+ ),
308
+ saveError === "" ? null : h("p", { className: "csk-error", "data-el-id": "csk-error", role: "status" }, saveError)
309
+ );
310
+ };
311
+ }
312
+
313
+ // src/client/store.ts
314
+ function createStore(initial) {
315
+ let value = initial;
316
+ const listeners = /* @__PURE__ */ new Set();
317
+ return {
318
+ getSnapshot: () => value,
319
+ subscribe: (listener) => {
320
+ listeners.add(listener);
321
+ return () => {
322
+ listeners.delete(listener);
323
+ };
324
+ },
325
+ set: (next) => {
326
+ if (Object.is(next, value)) return;
327
+ value = next;
328
+ for (const listener of [...listeners]) listener();
329
+ }
330
+ };
331
+ }
332
+
333
+ // src/client/styles.ts
334
+ var CSS = `
335
+ .csk-section{display:flex;flex-direction:column;gap:12px;max-width:720px;font-size:14px;line-height:22px;color:var(--dsw-alias-label-primary);}
336
+ .csk-card{display:flex;flex-direction:column;overflow:hidden;border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);}
337
+ .csk-options{display:flex;flex-direction:column;min-width:0;}
338
+ .csk-option{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:12px 14px;cursor:pointer;}
339
+ .csk-option+.csk-option{border-top:.5px solid var(--dsw-alias-border-l2);}
340
+ @media (hover:hover){.csk-option:hover{background:var(--dsw-alias-interactive-bg-hover);}}
341
+ .csk-radio{flex:none;width:16px;height:16px;margin:0;accent-color:var(--dsw-alias-brand-primary);cursor:inherit;}
342
+ .csk-radio:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px;}
343
+ .csk-title{font-weight:500;}
344
+ .csk-keys{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-left:auto;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;}
345
+ .csk-pair{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;}
346
+ .csk-kbd{font-family:var(--ds-font-family-code);font-size:11px;line-height:16px;padding:1px 5px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-primary);}
347
+ .csk-combo{display:flex;flex-wrap:wrap;gap:8px;padding:12px 14px 12px 42px;border-top:.5px solid var(--dsw-alias-border-l2);}
348
+ .csk-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);cursor:pointer;}
349
+ @media (hover:hover){.csk-chip:hover{background:var(--dsw-alias-interactive-bg-hover);}}
350
+ .csk-chip-selected{border-color:var(--dsw-alias-border-l3);background:var(--dsw-alias-interactive-bg-hover);}
351
+ .csk-chip .csk-radio{width:14px;height:14px;}
352
+ .csk-error{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary);}
353
+ @media (max-width:600px){.csk-keys{margin-left:28px;}.csk-combo{padding-left:28px;}}
354
+ `;
355
+
356
+ // src/client/runtime.ts
357
+ function installStyle() {
358
+ const tag = document.createElement("style");
359
+ tag.dataset.plugin = "dsh-composer-send-key";
360
+ tag.textContent = CSS;
361
+ document.head.append(tag);
362
+ return () => {
363
+ tag.remove();
364
+ };
365
+ }
366
+ function createRuntime(ctx, h) {
367
+ ctx.effect(() => ctx.locale.register(LOCALE_NS, DICTIONARIES), "composer-send-key: dictionaries");
368
+ const t = ctx.locale.bind(LOCALE_NS);
369
+ ctx.effect(installStyle, "composer-send-key: stylesheet");
370
+ const form = ctx.configForms?.get(LOCALE_NS);
371
+ let settings = readSettings(form?.getSnapshot().value);
372
+ const modeStore = createStore(settings.mode);
373
+ const comboStore = createStore(settings.combo);
374
+ const errorStore = createStore("");
375
+ const adopt = () => {
376
+ const next = readSettings(form?.getSnapshot().value);
377
+ if (next.mode !== settings.mode) modeStore.set(next.mode);
378
+ if (next.combo !== settings.combo) comboStore.set(next.combo);
379
+ settings = next;
380
+ };
381
+ ctx.effect(() => {
382
+ const off = form?.subscribe(adopt);
383
+ adopt();
384
+ return off;
385
+ }, "composer-send-key: settings adoption");
386
+ const persist = (field, value) => {
387
+ if (form === void 0) {
388
+ errorStore.set(t("saveFailed"));
389
+ return;
390
+ }
391
+ void form.set(field, value).then((accepted) => {
392
+ adopt();
393
+ errorStore.set(accepted ? "" : t("saveFailed"));
394
+ }, () => {
395
+ adopt();
396
+ errorStore.set(t("saveFailed"));
397
+ });
398
+ };
399
+ const setMode = (next) => {
400
+ if (next === settings.mode) return;
401
+ settings = { ...settings, mode: next };
402
+ modeStore.set(next);
403
+ persist(MODE_FIELD, next);
404
+ };
405
+ const setCombo = (next) => {
406
+ if (next === settings.combo) return;
407
+ settings = { ...settings, combo: next };
408
+ comboStore.set(next);
409
+ persist(COMBO_FIELD, next);
410
+ };
411
+ ctx.effect(() => installComposerKeyGuard(() => settings), "composer-send-key: composer key guard");
412
+ const page = createSettingsPage(h);
413
+ ctx.slots.inject("settings.section", () => ctx.slots.register({
414
+ name: "settings.section",
415
+ id: SETTINGS_SECTION_ID,
416
+ order: SETTINGS_SECTION_ORDER,
417
+ label: () => t("nav"),
418
+ inject: () => ({
419
+ hooks: { mode: modeStore, combo: comboStore, saveError: errorStore },
420
+ setMode,
421
+ setCombo,
422
+ t
423
+ })
424
+ }, page));
425
+ const icon = createSectionIcon(h);
426
+ ctx.slots.inject("settings.section.icon", () => ctx.slots.register({
427
+ name: "settings.section.icon",
428
+ id: SETTINGS_SECTION_ID
429
+ }, icon));
430
+ }
431
+
432
+ // src/client/index.ts
433
+ var loader = globalThis.__ModuleLoader__;
434
+ loader.load({
435
+ id: PLUGIN_ID,
436
+ factory(modules) {
437
+ const react = modules("react");
438
+ const createElement = react.createElement;
439
+ return {
440
+ inject: ["slots", "locale", "configForms"],
441
+ apply(ctx) {
442
+ createRuntime(ctx, createElement);
443
+ }
444
+ };
445
+ }
446
+ });
447
+ })();
package/lib/index.js ADDED
@@ -0,0 +1,15 @@
1
+ // src/index.ts
2
+ import z from "@deepseek-ai/schemastery";
3
+ var Config = z.object({
4
+ mode: z.union(["default", "edit-friendly"]).default("default").volatile(),
5
+ combo: z.union(["shift", "ctrl"]).default("shift").volatile()
6
+ });
7
+ function apply(ctx) {
8
+ ctx.inject(["settings"], (child) => {
9
+ child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
10
+ });
11
+ }
12
+ export {
13
+ Config,
14
+ apply
15
+ };
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Composer send key",
4
+ "description": "Adds a Send shortcut page to Settings with two modes: Default (Enter sends, Shift+Enter inserts a new line) and Edit-friendly (Enter inserts a new line; choose Shift+Enter or Ctrl+Enter to send). The choice applies immediately and only affects the message composer."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "发送快捷键",
4
+ "description": "在设置中新增「发送快捷键」页面:默认模式为 Enter 发送、Shift+Enter 换行;编辑友好模式为 Enter 换行,可选择 Shift+Enter 或 Ctrl+Enter 发送。选择即时生效,且只影响消息发送框。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "dsh-composer-send-key",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Switch the DeepSeek Harness message composer send shortcut: Enter sends, or edit-friendly mode where Enter inserts a new line and Shift+Enter or Ctrl+Enter sends.",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./lib/index.js",
8
+ "./client": "./lib/client.js",
9
+ "./locale/*.json": "./locale/*.json",
10
+ "./icon": "./icon.svg"
11
+ },
12
+ "files": ["lib", "cordis.patch.yml", "locale/*.json", "README.md", "README.zh.md", "icon.svg"],
13
+ "scripts": {
14
+ "build": "pnpm run typecheck && pnpm run build:host && pnpm run build:client",
15
+ "typecheck": "tsc --noEmit -p tsconfig.json",
16
+ "build:host": "esbuild src/index.ts --bundle --platform=node --format=esm --external:@deepseek-ai/schemastery --outfile=lib/index.js",
17
+ "build:client": "esbuild src/client/index.ts --bundle --platform=browser --format=iife --target=es2022 --outfile=lib/client.js",
18
+ "prepublishOnly": "pnpm run build"
19
+ },
20
+ "license": "MIT",
21
+ "author": "Licheung228",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Licheung228/dsh-composer-send-key.git"
25
+ },
26
+ "homepage": "https://github.com/Licheung228/dsh-composer-send-key#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/Licheung228/dsh-composer-send-key/issues"
29
+ },
30
+ "keywords": [
31
+ "deepseek-harness",
32
+ "dsh",
33
+ "dsh-plugin",
34
+ "composer",
35
+ "keyboard-shortcuts",
36
+ "enter",
37
+ "shift-enter",
38
+ "ctrl-enter"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "@deepseek-ai/schemastery": "3.19.0"
45
+ },
46
+ "devDependencies": {
47
+ "esbuild": "^0.25.0",
48
+ "typescript": "^5.8.3"
49
+ },
50
+ "dsh": {
51
+ "bundle": { "patch": "./cordis.patch.yml" },
52
+ "client": {
53
+ "platform": "web",
54
+ "immediately": true,
55
+ "inject": [
56
+ "@deepseek-ai/dsh-client-ui-renderer",
57
+ "@deepseek-ai/dsh-client-ui-settings",
58
+ "@deepseek-ai/dsh-client-ui-settings-general"
59
+ ]
60
+ }
61
+ }
62
+ }