@lynn123411/dsh-chat-translate 1.2.4 → 1.2.6
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/docs//351/205/215/347/275/256.md +2 -2
- package/lib/client.js +40 -3
- package/lib/client.js.map +3 -3
- package/lib/index.js +42 -20
- package/lib/index.js.map +4 -4
- package/lib/types/client/translate/viewport-observer.d.ts +6 -0
- package/lib/types/describe-error.d.ts +12 -0
- package/lib/types/server/config.d.ts +6 -2
- package/lib/types/server/credentials.d.ts +7 -1
- package/lib/types/server/types.d.ts +0 -12
- package/package.json +4 -6
|
@@ -16,6 +16,12 @@ export interface ViewportObserverOptions {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class StreamDebounceViewportObserver {
|
|
18
18
|
private intersectionObserver;
|
|
19
|
+
/**
|
|
20
|
+
* Pending per-element streaming debounce timers. A Map (not a WeakMap)
|
|
21
|
+
* because disconnect() must enumerate and clear every pending timer: a
|
|
22
|
+
* WeakMap cannot be iterated, so a debounce armed just before the switch was
|
|
23
|
+
* turned off would still fire registerForViewport() afterwards.
|
|
24
|
+
*/
|
|
19
25
|
private streamingTimers;
|
|
20
26
|
private pendingQueue;
|
|
21
27
|
private batchFlushTimer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把 fetch / 网络失败的可读原因展开成单行文本(宿主与客户端共用)。
|
|
3
|
+
*
|
|
4
|
+
* 背景:Node 18+ 与浏览器的 fetch 在网络层失败时只给一句 `TypeError: fetch failed`
|
|
5
|
+
* (浏览器是 `Failed to fetch`),真实原因藏在 `err.cause` 里——例如
|
|
6
|
+
* `connect ENETUNREACH 172.24.52.126:8081`、`other side closed [UND_ERR_SOCKET]`、
|
|
7
|
+
* `getaddrinfo ENOTFOUND`。只上报 `err.message` 会让「端点不可达 / 被代理断开」和
|
|
8
|
+
* 「插件自身出错」长得一模一样:用户只看到无信息量的 fetch failed,无从判断该改什么。
|
|
9
|
+
*
|
|
10
|
+
* 这里把 message 与 cause 链(含 AggregateError 的多地址失败)拼成 `A ← B ← C`。
|
|
11
|
+
*/
|
|
12
|
+
export declare function describeError(err: unknown): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginConfig
|
|
1
|
+
import type { PluginConfig } from './types.ts';
|
|
2
2
|
import type { CredentialsReader } from './credentials.ts';
|
|
3
3
|
/** Hard cap for the translation concurrency pool. */
|
|
4
4
|
export declare const MAX_CONCURRENCY = 100;
|
|
@@ -37,12 +37,16 @@ export declare class ConfigManager {
|
|
|
37
37
|
getConfig(): PluginConfig;
|
|
38
38
|
/** Whether the AI channel has every required piece: baseUrl, model and key. */
|
|
39
39
|
isAiConfigured(): boolean;
|
|
40
|
-
getMaskedConfig(): MaskedPluginConfig;
|
|
41
40
|
onConfigChange(listener: (config: PluginConfig) => void): () => void;
|
|
42
41
|
/**
|
|
43
42
|
* Merge a partial update into the settings namespace. Values are sanitized
|
|
44
43
|
* here (bounds, trimming) so the schema's own constraints act as a second
|
|
45
44
|
* line of defence rather than the only one.
|
|
45
|
+
*
|
|
46
|
+
* @internal Test-only. No production path calls this: the host writes the
|
|
47
|
+
* settings namespace from the browser through the DSH settings service, and
|
|
48
|
+
* this facade is only driven by `scripts/test-*.mjs` (regression suite).
|
|
49
|
+
* Kept (with this marker) so those tests keep exercising the sanitizer.
|
|
46
50
|
*/
|
|
47
51
|
updateConfig(partial: Partial<PluginConfig>): Promise<PluginConfig>;
|
|
48
52
|
}
|
|
@@ -45,7 +45,13 @@ export declare class CredentialsReader implements KeyReader {
|
|
|
45
45
|
refresh(): Promise<void>;
|
|
46
46
|
/** Synchronous cached read — the hot translation path stays sync. */
|
|
47
47
|
getApiKey(): string;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Status-only view of the ref (plaintext never crosses the wire).
|
|
50
|
+
*
|
|
51
|
+
* @internal Test-only. The settings UI reads key status through the
|
|
52
|
+
* `credentials` Remote API with its own client-side shape, so nothing in
|
|
53
|
+
* `src/` calls this host-side method; only `scripts/test-*.mjs` do.
|
|
54
|
+
*/
|
|
49
55
|
describe(): Promise<{
|
|
50
56
|
configured: boolean;
|
|
51
57
|
writable: boolean;
|
|
@@ -9,18 +9,6 @@ export interface PluginConfig {
|
|
|
9
9
|
model: string;
|
|
10
10
|
targetLang: string;
|
|
11
11
|
}
|
|
12
|
-
export interface MaskedPluginConfig {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
concurrency: number;
|
|
15
|
-
timeoutMs: number;
|
|
16
|
-
aiTimeoutMs: number;
|
|
17
|
-
aiEnabled: boolean;
|
|
18
|
-
bingEnabled: boolean;
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
model: string;
|
|
21
|
-
targetLang: string;
|
|
22
|
-
aiConfigured: boolean;
|
|
23
|
-
}
|
|
24
12
|
export interface TranslateItemResult {
|
|
25
13
|
original: string;
|
|
26
14
|
translated: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynn123411/dsh-chat-translate",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Tool-call & think-summary translation with dual AI (OpenAI-compatible) + Bing channels for the DeepSeek Harness Web UI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "lynn123411",
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
"node": "^22.19 || >=24"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@deepseek-ai/dsh-home-paths": "0.1.
|
|
69
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1",
|
|
70
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
70
71
|
"@eslint/js": "^9.30.0",
|
|
71
72
|
"@types/node": "^22.19.0",
|
|
72
73
|
"@types/react": "^19.2.18",
|
|
@@ -74,10 +75,7 @@
|
|
|
74
75
|
"jsdom": "^26.1.0",
|
|
75
76
|
"typescript": "^6.0.0"
|
|
76
77
|
},
|
|
77
|
-
"dependencies": {
|
|
78
|
-
"@deepseek-ai/schemastery": "^3.18.2"
|
|
79
|
-
},
|
|
80
78
|
"peerDependencies": {
|
|
81
|
-
"@deepseek-ai/dsh-home-paths": "^0.1.
|
|
79
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1"
|
|
82
80
|
}
|
|
83
81
|
}
|