transl8-srt 1.0.2 → 1.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 +14 -0
- package/dist/index.cjs +102 -6988
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +91 -6985
- package/dist/index.js.map +1 -1
- package/package.json +7 -10
package/dist/index.d.cts
CHANGED
|
@@ -57,6 +57,19 @@ interface TranslateOptions {
|
|
|
57
57
|
concurrency?: number;
|
|
58
58
|
/** Enable AI primer call — for general/unknown content only */
|
|
59
59
|
primer?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Soft token budget per batch (default 4000), estimated at ~4 chars/token.
|
|
62
|
+
* A batch closes early (before hitting batchSize) once its accumulated
|
|
63
|
+
* sentence text would exceed this, so unusually long sentences don't
|
|
64
|
+
* produce oversized requests. Purely a heuristic — no tokenizer dependency.
|
|
65
|
+
*/
|
|
66
|
+
maxBatchTokens?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Request strict JSON output via the provider's response_format param
|
|
69
|
+
* (default true). Disable for custom providers that reject or ignore
|
|
70
|
+
* response_format — the system prompt's JSON instructions still apply.
|
|
71
|
+
*/
|
|
72
|
+
jsonMode?: boolean;
|
|
60
73
|
}
|
|
61
74
|
interface TranslatedCue extends Cue {
|
|
62
75
|
translatedText: string;
|
|
@@ -76,9 +89,13 @@ interface TranslationStats {
|
|
|
76
89
|
totalCues: number;
|
|
77
90
|
totalSentences: number;
|
|
78
91
|
totalBatches: number;
|
|
92
|
+
/** Indices of batches that failed after all retries — their sentences fall back to original text */
|
|
93
|
+
failedBatches: number[];
|
|
79
94
|
inputTokens: number;
|
|
80
95
|
outputTokens: number;
|
|
81
96
|
estimatedCostUsd: number;
|
|
97
|
+
/** False when the resolved model isn't in the known price table — estimatedCostUsd is a meaningless 0 in that case */
|
|
98
|
+
costTracked: boolean;
|
|
82
99
|
durationMs: number;
|
|
83
100
|
}
|
|
84
101
|
interface BatchPayload {
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,19 @@ interface TranslateOptions {
|
|
|
57
57
|
concurrency?: number;
|
|
58
58
|
/** Enable AI primer call — for general/unknown content only */
|
|
59
59
|
primer?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Soft token budget per batch (default 4000), estimated at ~4 chars/token.
|
|
62
|
+
* A batch closes early (before hitting batchSize) once its accumulated
|
|
63
|
+
* sentence text would exceed this, so unusually long sentences don't
|
|
64
|
+
* produce oversized requests. Purely a heuristic — no tokenizer dependency.
|
|
65
|
+
*/
|
|
66
|
+
maxBatchTokens?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Request strict JSON output via the provider's response_format param
|
|
69
|
+
* (default true). Disable for custom providers that reject or ignore
|
|
70
|
+
* response_format — the system prompt's JSON instructions still apply.
|
|
71
|
+
*/
|
|
72
|
+
jsonMode?: boolean;
|
|
60
73
|
}
|
|
61
74
|
interface TranslatedCue extends Cue {
|
|
62
75
|
translatedText: string;
|
|
@@ -76,9 +89,13 @@ interface TranslationStats {
|
|
|
76
89
|
totalCues: number;
|
|
77
90
|
totalSentences: number;
|
|
78
91
|
totalBatches: number;
|
|
92
|
+
/** Indices of batches that failed after all retries — their sentences fall back to original text */
|
|
93
|
+
failedBatches: number[];
|
|
79
94
|
inputTokens: number;
|
|
80
95
|
outputTokens: number;
|
|
81
96
|
estimatedCostUsd: number;
|
|
97
|
+
/** False when the resolved model isn't in the known price table — estimatedCostUsd is a meaningless 0 in that case */
|
|
98
|
+
costTracked: boolean;
|
|
82
99
|
durationMs: number;
|
|
83
100
|
}
|
|
84
101
|
interface BatchPayload {
|