@lynn123411/dsh-chat-translate 3.9.6 → 3.9.7
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.md +7 -7
- package/lib/client.js +70 -63
- package/lib/client.js.map +3 -3
- package/lib/index.js +67 -47
- package/lib/index.js.map +4 -4
- package/lib/types/client/chat/assistant-step.d.ts +2 -1
- package/lib/types/client/chat/styles.d.ts +2 -2
- package/lib/types/client/chat/translate-store.d.ts +6 -11
- package/lib/types/client/index.d.ts +0 -1
- package/lib/types/server/cache.d.ts +5 -10
- package/lib/types/server/dispatcher.d.ts +4 -0
- package/lib/types/server/prompt-revision.d.ts +4 -16
- package/lib/types/translation-config.d.ts +6 -0
- package/package.json +13 -13
|
@@ -69,6 +69,7 @@ export interface AssistantStepProps {
|
|
|
69
69
|
* 好把一行渲染成某个指定的结果态,而不必先让单例池产出那个结果。
|
|
70
70
|
*/
|
|
71
71
|
readonly store?: RowTranslateStore;
|
|
72
|
+
readonly sessionId?: string;
|
|
72
73
|
readonly node: {
|
|
73
74
|
readonly data: NodeDataLike;
|
|
74
75
|
/**
|
|
@@ -110,6 +111,6 @@ export interface AssistantStepProps {
|
|
|
110
111
|
/** 折叠钩子的结构镜像:传隐藏态与揭示回调,返回承载 hidden 的稳定 ref。 */
|
|
111
112
|
type GroupActionLike = (hidden: boolean, reveal: () => void) => React.RefObject<HTMLDivElement | null>;
|
|
112
113
|
/** 行的翻译池:默认是客户端半边那一个单例,测试可以按座次注入自己的池。 */
|
|
113
|
-
export type RowTranslateStore = Pick<ChatTranslateStore, 'ensure' | 'getState' | 'getVersion' | 'subscribe'>;
|
|
114
|
+
export type RowTranslateStore = Pick<ChatTranslateStore, 'ensure' | 'getState' | 'getVersion' | 'getGeneration' | 'subscribe'>;
|
|
114
115
|
export declare const AssistantStepView: React.MemoExoticComponent<(props: AssistantStepProps) => ReactElement | null>;
|
|
115
116
|
export {};
|
|
@@ -58,5 +58,5 @@ export declare const RETRY_BUSY_ATTR = "data-busy";
|
|
|
58
58
|
export declare const RETRY_UNCONFIGURED_ATTR = "data-unconfigured";
|
|
59
59
|
/** ↻ 的转圈图标类名(转的是图标本身,按钮位置不动)。 */
|
|
60
60
|
export declare const RETRY_SPIN_CLASS = "dsh-ct-retry-spin";
|
|
61
|
-
/**
|
|
62
|
-
export declare function
|
|
61
|
+
/** 由 Client effect 挂载,插件卸载时随 effect 清理。 */
|
|
62
|
+
export declare function mountAssistantStyles(): void | (() => void);
|
|
@@ -88,6 +88,7 @@ export declare class ChatTranslateStore {
|
|
|
88
88
|
private rows;
|
|
89
89
|
private listeners;
|
|
90
90
|
private version;
|
|
91
|
+
private generation;
|
|
91
92
|
private fetch;
|
|
92
93
|
/** 已送达的译文,按原文内容寻址:跨行、跨代复用同一段文本的结果。 */
|
|
93
94
|
private translated;
|
|
@@ -99,17 +100,11 @@ export declare class ChatTranslateStore {
|
|
|
99
100
|
constructor(fetcher: ReplyFetcher);
|
|
100
101
|
/** 单调版本号:任何状态变化(含单批落定、整池换代)都前进一位,供渲染层判等重渲。 */
|
|
101
102
|
getVersion(): number;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* 世代作废,这里跟着作废,两边的「换一代」说的是同一件事。
|
|
108
|
-
*
|
|
109
|
-
* 已经显示在屏幕上的译文不动(行状态里那份还在),下一轮需要新译文时才重发。
|
|
110
|
-
* @returns 池里原本是否有东西可丢。
|
|
111
|
-
*/
|
|
112
|
-
dropTranslations(): boolean;
|
|
103
|
+
getGeneration(): number;
|
|
104
|
+
/** 配置变更只作废可复用的译文与在途请求,行内已经落下的结果继续显示。 */
|
|
105
|
+
dropTranslations(): void;
|
|
106
|
+
/** Client 卸载时同时清掉行内结果。 */
|
|
107
|
+
reset(): void;
|
|
113
108
|
subscribe: (listener: () => void) => (() => void);
|
|
114
109
|
/** 读一行状态,并把该行刷成最近使用。 */
|
|
115
110
|
getState(rowKey: string): RowState | undefined;
|
|
@@ -49,7 +49,6 @@ export { AssistantStepView } from './chat/assistant-step.tsx';
|
|
|
49
49
|
export { planAssistantRow } from './chat/row-plan.ts';
|
|
50
50
|
export { chatTranslate, createTranslateStore } from './chat/translate-store.ts';
|
|
51
51
|
export { chatPresentation, createChatPresentation, policyForMode } from './chat/presentation.ts';
|
|
52
|
-
export { ensureAssistantStyles } from './chat/styles.ts';
|
|
53
52
|
export { setupSettingsUi } from './settings/ui.tsx';
|
|
54
53
|
export { setupComposerToggle, ComposerTranslateToggle } from './composer/dock-toggle.tsx';
|
|
55
54
|
export { settingsStore } from './settings/store.ts';
|
|
@@ -3,19 +3,13 @@ export declare class LruDiskCache {
|
|
|
3
3
|
private maxEntries;
|
|
4
4
|
private filePath;
|
|
5
5
|
private revision;
|
|
6
|
+
private revisionEpoch;
|
|
6
7
|
private saveTimer;
|
|
7
8
|
private dirty;
|
|
9
|
+
private saving;
|
|
10
|
+
private disposed;
|
|
8
11
|
constructor(maxEntries?: number, fileName?: string, revision?: string);
|
|
9
|
-
/**
|
|
10
|
-
* Move the pool to the generation a prompt edit produced.
|
|
11
|
-
*
|
|
12
|
-
* Called whenever the prompt in force changes. A different revision means the
|
|
13
|
-
* entries already held were written under wording the reader has replaced, so
|
|
14
|
-
* they are dropped rather than served under the new prompt; the same revision
|
|
15
|
-
* is a no-op, so re-committing the same text costs nothing.
|
|
16
|
-
*
|
|
17
|
-
* @param revision - the generation the current prompt resolves to.
|
|
18
|
-
*/
|
|
12
|
+
/** 配置换代时清空内存,并安排覆写磁盘中的旧池。 */
|
|
19
13
|
setRevision(revision: string): void;
|
|
20
14
|
init(): Promise<void>;
|
|
21
15
|
/** Adopt loaded entries, dropping malformed ones. */
|
|
@@ -24,5 +18,6 @@ export declare class LruDiskCache {
|
|
|
24
18
|
set(key: string, value: string): void;
|
|
25
19
|
private scheduleSave;
|
|
26
20
|
flush(): Promise<void>;
|
|
21
|
+
private writeSnapshot;
|
|
27
22
|
dispose(): Promise<void>;
|
|
28
23
|
}
|
|
@@ -6,9 +6,13 @@ export declare class TranslationDispatcher {
|
|
|
6
6
|
private configManager;
|
|
7
7
|
private cache;
|
|
8
8
|
private adapters;
|
|
9
|
+
private revision;
|
|
10
|
+
private generation;
|
|
9
11
|
/** 正文请求的串行队列尾,保证同时最多一个在途请求。 */
|
|
10
12
|
private replyTail;
|
|
11
13
|
constructor(configManager: ConfigManager, cache: LruDiskCache, credentials?: KeyReader);
|
|
14
|
+
watchConfig(): () => void;
|
|
15
|
+
private updateGeneration;
|
|
12
16
|
private registerAdapter;
|
|
13
17
|
/**
|
|
14
18
|
* 翻译回答正文的块:本次唯一的翻译入口。
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* changes what the model is asked to do. Copy-only edits may ride.
|
|
4
|
-
*/
|
|
1
|
+
import { translationConfigKey } from '../translation-config.ts';
|
|
2
|
+
/** 内置提示词改变译文要求时递增此修订号。 */
|
|
5
3
|
export declare const PROMPT_REVISION = "r7";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* The digest covers the effective prompt — the reader's text when they wrote
|
|
10
|
-
* one, the built-in default otherwise — and the sampling parameters the request
|
|
11
|
-
* goes out with, so editing either one retires every translation the previous
|
|
12
|
-
* settings produced, and landing on the same settings again reuses the pool.
|
|
13
|
-
*
|
|
14
|
-
* @param prompt - the configured prompt; blank means the built-in default.
|
|
15
|
-
* @returns the generation string a cache document is written and matched under.
|
|
16
|
-
*/
|
|
17
|
-
export declare function cacheGeneration(prompt: string | undefined): string;
|
|
4
|
+
/** 磁盘缓存代号包含原文键格式、提示词、通道和采样参数。 */
|
|
5
|
+
export declare function cacheGeneration(config?: Parameters<typeof translationConfigKey>[0]): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynn123411/dsh-chat-translate",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.7",
|
|
4
4
|
"description": "Assistant reply-body translation for the DeepSeek Harness Web UI (OpenAI-compatible channel)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "lynn123411",
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": "^22.19 || >=24",
|
|
75
|
-
"dsh": ">=0.2.
|
|
75
|
+
"dsh": ">=0.2.3-alpha.2"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@deepseek-ai/cordis": "^4.
|
|
79
|
-
"@deepseek-ai/dsh-client-connection": ">=0.2.
|
|
80
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.
|
|
84
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.
|
|
85
|
-
"@deepseek-ai/dsh-home-paths": ">=0.2.
|
|
86
|
-
"@deepseek-ai/schemastery": "^3.
|
|
78
|
+
"@deepseek-ai/cordis": "^4.2.0-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-client-connection": ">=0.2.3-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.3-alpha.2",
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.2",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.3-alpha.2",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.3-alpha.2",
|
|
84
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.3-alpha.2",
|
|
85
|
+
"@deepseek-ai/dsh-home-paths": ">=0.2.3-alpha.2",
|
|
86
|
+
"@deepseek-ai/schemastery": "^3.20.0-alpha.1",
|
|
87
87
|
"@types/node": "^22.19.0",
|
|
88
88
|
"@types/react": "^19.2.18",
|
|
89
89
|
"@types/react-dom": "^19.3.0",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"typescript": "^6.0.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.
|
|
98
|
-
"@deepseek-ai/dsh-home-paths": ">=0.2.
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.3-alpha.2",
|
|
98
|
+
"@deepseek-ai/dsh-home-paths": ">=0.2.3-alpha.2"
|
|
99
99
|
},
|
|
100
100
|
"peerDependenciesMeta": {
|
|
101
101
|
"@deepseek-ai/dsh-client-ui-primitives": {
|