@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.
@@ -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 };