dsh-external-toolbox 0.0.0-stage → 0.2.1

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/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "External toolbox",
4
+ "description": "Select text in any Windows application and a small floating bar appears. Translate it in place, or send the quote into the DSH composer to ask about it. More selection tools will live here, not only translation. Auto-detects the direction between Chinese and English and can translate into other languages."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "外部工具箱",
4
+ "description": "在任意 Windows 程序里选中文字,浮出一小条工具条:就地翻译,或把原文引用进 DSH 输入框继续提问。不止翻译,后续的取词工具都会挂在这里。中英自动互译,也可切换到其他语言。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
2
  "name": "dsh-external-toolbox",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "description": "Selection capture for DeepSeek Harness, anywhere on Windows: one gesture picks up the text you just selected in any application and offers translate, explain, quote-into-DSH, save-to-vocabulary and copy in a floating card that never steals focus.",
5
+ "keywords": [
6
+ "deepseek",
7
+ "deepseek-harness",
8
+ "dsh",
9
+ "dsh-plugin",
10
+ "web",
11
+ "selection",
12
+ "translate",
13
+ "hotkey",
14
+ "windows"
15
+ ],
16
+ "type": "module",
17
+ "license": "MIT",
18
+ "main": "./lib/index.js",
19
+ "exports": {
20
+ ".": "./lib/index.js",
21
+ "./client": "./lib/client.js",
22
+ "./icon": "./icon.png",
23
+ "./locale/*.json": "./locale/*.json",
24
+ "./package.json": "./package.json"
25
+ },
26
+ "files": [
27
+ "lib/index.js",
28
+ "lib/client.js",
29
+ "helper/capture.ps1",
30
+ "cordis.patch.yml",
31
+ "locale",
32
+ "icon.png",
33
+ "README.md",
34
+ "tools",
35
+ "LICENSE"
36
+ ],
37
+ "dsh": {
38
+ "client": {
39
+ "platform": "web"
40
+ },
41
+ "bundle": {
42
+ "patch": "./cordis.patch.yml"
43
+ }
44
+ },
45
+ "engines": {
46
+ "node": ">=22.19.0"
47
+ },
48
+ "os": [
49
+ "win32"
50
+ ],
51
+ "publishConfig": {
52
+ "registry": "https://registry.npmjs.org/",
53
+ "access": "public"
54
+ },
55
+ "peerDependencies": {
56
+ "@deepseek-ai/cordis": "^4.0.2"
57
+ },
58
+ "dependencies": {
59
+ "msedge-tts": "^2.1.1"
60
+ },
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/9-bai/dsh-external-toolbox.git"
64
+ },
65
+ "homepage": "https://github.com/9-bai/dsh-external-toolbox#readme",
66
+ "bugs": {
67
+ "url": "https://github.com/9-bai/dsh-external-toolbox/issues"
68
+ }
69
+ }
package/tools/say.mjs ADDED
@@ -0,0 +1,52 @@
1
+ // say.mjs — synthesize one sentence to an mp3 file with the Edge neural voices.
2
+ //
3
+ // node pkg/tools/say.mjs --text-file <in.txt> <out.mp3> [voice]
4
+ // node pkg/tools/say.mjs "<text>" <out.mp3> [voice]
5
+ //
6
+ // Windows only ships the old SAPI voices (Huihui / Zira), which sound robotic;
7
+ // the Edge endpoint serves the neural ones (Xiaoxiao, Aria, ...) with no API key.
8
+ // The helper plays the resulting file and falls back to SAPI when this fails.
9
+ // Text is normally passed as a file: selection can contain quotes and newlines,
10
+ // which do not survive a command line.
11
+ import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts";
12
+ import { readFileSync, writeFileSync } from "node:fs";
13
+
14
+ const argv = process.argv.slice(2);
15
+ let text = "";
16
+ let rest = [];
17
+ if (argv[0] === "--text-file") {
18
+ text = readFileSync(argv[1], "utf8");
19
+ rest = argv.slice(2);
20
+ } else {
21
+ text = argv[0] ?? "";
22
+ rest = argv.slice(1);
23
+ }
24
+
25
+ const [outPath, voice = "en-US-AriaNeural"] = rest;
26
+
27
+ if (!text.trim() || !outPath) {
28
+ console.error("usage: say.mjs (--text-file <in.txt> | <text>) <out.mp3> [voice]");
29
+ process.exit(2);
30
+ }
31
+
32
+ const tts = new MsEdgeTTS();
33
+ await tts.setMetadata(voice, OUTPUT_FORMAT.AUDIO_24KHZ_48KBITRATE_MONO_MP3);
34
+
35
+ // toStream hands back a node Readable, so collect it instead of iterating.
36
+ const { audioStream } = tts.toStream(text);
37
+ const chunks = [];
38
+ audioStream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
39
+ await new Promise((resolve, reject) => {
40
+ audioStream.on("end", resolve);
41
+ audioStream.on("error", reject);
42
+ });
43
+
44
+ const audio = Buffer.concat(chunks);
45
+ if (audio.length === 0) {
46
+ console.error("no audio returned");
47
+ process.exit(1);
48
+ }
49
+
50
+ writeFileSync(outPath, audio);
51
+ console.log(JSON.stringify({ ok: true, bytes: audio.length, voice }));
52
+ process.exit(0);