@lynn123411/dsh-chat-translate 3.0.0 → 3.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.md +7 -7
- package/docs//351/205/215/347/275/256.md +5 -5
- package/lib/client.js +274 -174
- package/lib/client.js.map +3 -3
- package/lib/index.js +369 -335
- package/lib/index.js.map +4 -4
- package/lib/types/client/chat/assistant-step.d.ts +4 -3
- package/lib/types/client/chat/row-plan.d.ts +25 -8
- package/lib/types/client/chat/styles.d.ts +15 -6
- package/lib/types/client/chat/translate-store.d.ts +16 -16
- package/lib/types/client/locales.d.ts +12 -2
- package/lib/types/client/translate/api.d.ts +1 -8
- package/lib/types/server/cache.d.ts +1 -1
- package/lib/types/server/dispatcher.d.ts +30 -26
- package/lib/types/server/pipeline/blocks.d.ts +7 -11
- package/lib/types/server/pipeline/segments.d.ts +68 -0
- package/lib/types/server/prompt-revision.d.ts +1 -1
- package/lib/types/server/types.d.ts +15 -13
- package/package.json +10 -10
- package/lib/types/server/pipeline/mask-tokens.d.ts +0 -64
- package/lib/types/server/pipeline/masking.d.ts +0 -45
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { hasMaskResidue } from './mask-tokens.ts';
|
|
2
|
-
export interface MaskResult {
|
|
3
|
-
maskedText: string;
|
|
4
|
-
/**
|
|
5
|
-
* Restore every protected fragment. Throws `MaskRestoreError` when the
|
|
6
|
-
* translated text did not carry the token sequence back intact; the caller
|
|
7
|
-
* must discard that translation instead of showing a repaired guess.
|
|
8
|
-
*/
|
|
9
|
-
unmask: (translatedText: string) => string;
|
|
10
|
-
}
|
|
11
|
-
/** Which spaces `mask()` inserted directly before and after a token. */
|
|
12
|
-
export interface InsertedSpacing {
|
|
13
|
-
leading: boolean;
|
|
14
|
-
trailing: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare class MaskRestoreError extends Error {
|
|
17
|
-
readonly expectedCount: number;
|
|
18
|
-
readonly foundCount: number;
|
|
19
|
-
constructor(message: string, expectedCount: number, foundCount: number);
|
|
20
|
-
}
|
|
21
|
-
export declare class ContentMaskingPipeline {
|
|
22
|
-
mask(text: string): MaskResult;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Restore every token of `id` in `text` from `masks`.
|
|
26
|
-
*
|
|
27
|
-
* Each fragment of the pass is resolved exactly once, no matter how the engine
|
|
28
|
-
* reordered the sentence: the index embedded in the token identifies the
|
|
29
|
-
* fragment, and the random id identifies the masking pass that owns it. The
|
|
30
|
-
* spaces recorded in `inserted` are removed together with their token, so the
|
|
31
|
-
* spacing the translation produced around the fragment survives untouched.
|
|
32
|
-
*
|
|
33
|
-
* @throws MaskRestoreError when the text does not carry every token exactly
|
|
34
|
-
* once, or still shows a token of some other pass or a damaged one — the
|
|
35
|
-
* caller discards such a translation instead of rendering a repaired guess.
|
|
36
|
-
*/
|
|
37
|
-
export declare function replaceMaskTokens(text: string, id: string, masks: string[], inserted?: InsertedSpacing[]): string;
|
|
38
|
-
/**
|
|
39
|
-
* True when a translated string still shows a mask token to the user. Callers
|
|
40
|
-
* use it to discard a poisoned translation, to keep it out of the caches, and
|
|
41
|
-
* to drop poisoned entries when a cache document is loaded (the file on disk
|
|
42
|
-
* outlives the process and may carry anything).
|
|
43
|
-
*/
|
|
44
|
-
export declare function isMaskLeak(translatedText: string): boolean;
|
|
45
|
-
export { hasMaskResidue };
|