@verbatra/sdk 0.5.0-next.1 → 0.5.0-next.3
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 +1 -1
- package/dist/index.cjs +308 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -28
- package/dist/index.d.ts +38 -28
- package/dist/index.js +308 -81
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -100,7 +100,31 @@ interface Usage {
|
|
|
100
100
|
readonly inputTokens: number;
|
|
101
101
|
readonly outputTokens: number;
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Stable codes for a provider's graceful-degradation notices. These are returned DATA on a
|
|
105
|
+
* successful result, NOT thrown:
|
|
106
|
+
*
|
|
107
|
+
* - `FORMALITY_DOWNGRADED`: a requested formality was not applied (DeepL's free tier does not
|
|
108
|
+
* support it).
|
|
109
|
+
* - `GLOSSARY_IGNORED`: a supplied generic glossary term map was not applied (DeepL only applies a
|
|
110
|
+
* native glossary id, never a term map).
|
|
111
|
+
* - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
|
|
112
|
+
* because the provider cannot preserve those tokens; such entries are withheld (absent from the
|
|
113
|
+
* result maps) rather than sent to the provider and mangled.
|
|
114
|
+
*/
|
|
115
|
+
type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
|
|
116
|
+
/**
|
|
117
|
+
* An observable, structured signal that something was gracefully degraded (not an
|
|
118
|
+
* error). Carries only a stable code and a static message, never a key or content.
|
|
119
|
+
* Surfaced as result data, never thrown; callers inspect it but need not treat it as a failure.
|
|
120
|
+
*/
|
|
121
|
+
interface ProviderNotice {
|
|
122
|
+
/** The stable {@link ProviderNoticeCode} for what was degraded. */
|
|
123
|
+
readonly code: ProviderNoticeCode;
|
|
124
|
+
/** A static, safe description; never a key or translatable content. */
|
|
125
|
+
readonly message: string;
|
|
126
|
+
}
|
|
127
|
+
/** Result of a batch translation: per-key values, per-key integrity outcomes, and any notices. */
|
|
104
128
|
interface TranslateResult {
|
|
105
129
|
/** The translated value for each requested key. */
|
|
106
130
|
readonly values: ReadonlyMap<string, string>;
|
|
@@ -108,6 +132,12 @@ interface TranslateResult {
|
|
|
108
132
|
readonly integrity: ReadonlyMap<string, PlaceholderIntegrityResult$1>;
|
|
109
133
|
/** Token usage when the provider reports it; absent for token-less providers. */
|
|
110
134
|
readonly usage?: Usage;
|
|
135
|
+
/**
|
|
136
|
+
* Graceful-degradation notices for this batch. Every provider populates this as a present array:
|
|
137
|
+
* DeepL reports real notices (for example `GLOSSARY_IGNORED`); an LLM provider with nothing to
|
|
138
|
+
* report returns an empty array rather than omitting the field.
|
|
139
|
+
*/
|
|
140
|
+
readonly notices?: readonly ProviderNotice[];
|
|
111
141
|
}
|
|
112
142
|
/**
|
|
113
143
|
* The single contract every provider implements. It is narrow enough that a machine-translation API like
|
|
@@ -166,28 +196,6 @@ interface TranslationProvider {
|
|
|
166
196
|
* are still accepted. This drives editor completions only; the runtime schema validates.
|
|
167
197
|
*/
|
|
168
198
|
type AnthropicModel = Anthropic.Messages.Model;
|
|
169
|
-
/**
|
|
170
|
-
* Stable codes for the DeepL graceful-degradation notices, DeepL only. These are returned DATA on a
|
|
171
|
-
* successful result, NOT thrown:
|
|
172
|
-
*
|
|
173
|
-
* - `FORMALITY_DOWNGRADED`: a requested formality was not applied (the free tier does not support it).
|
|
174
|
-
* - `GLOSSARY_IGNORED`: a supplied generic glossary was not applied.
|
|
175
|
-
* - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
|
|
176
|
-
* because DeepL cannot preserve those tokens; such entries are withheld (absent from the result maps)
|
|
177
|
-
* rather than sent to DeepL and mangled.
|
|
178
|
-
*/
|
|
179
|
-
type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
|
|
180
|
-
/**
|
|
181
|
-
* An observable, structured signal that something was gracefully degraded (not an
|
|
182
|
-
* error). Carries only a stable code and a static message, never a key or content.
|
|
183
|
-
* Surfaced as result data, never thrown; callers inspect it but need not treat it as a failure.
|
|
184
|
-
*/
|
|
185
|
-
interface ProviderNotice {
|
|
186
|
-
/** The stable {@link ProviderNoticeCode} for what was degraded. */
|
|
187
|
-
readonly code: ProviderNoticeCode;
|
|
188
|
-
/** A static, safe description; never a key or translatable content. */
|
|
189
|
-
readonly message: string;
|
|
190
|
-
}
|
|
191
199
|
|
|
192
200
|
/**
|
|
193
201
|
* The Gemini authoring model type, sourced from the installed SDK's own model union so
|
|
@@ -943,11 +951,13 @@ interface LocaleSummary {
|
|
|
943
951
|
*/
|
|
944
952
|
readonly integrityMismatches: readonly string[];
|
|
945
953
|
/**
|
|
946
|
-
* Keys withheld because
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* {@link LocaleSummary.notices} entry carries the secret-free failure code
|
|
950
|
-
*
|
|
954
|
+
* Keys withheld because nothing was translated for them this run, as distinct from a translation
|
|
955
|
+
* that came back and failed the placeholder-integrity check. This covers two causes: the provider
|
|
956
|
+
* call itself failed (for example a revoked API key, a rate limit, or a network timeout), in which
|
|
957
|
+
* case the corresponding {@link LocaleSummary.notices} entry carries the secret-free failure code
|
|
958
|
+
* and message; or the call succeeded but the key was still missing or duplicated in the response
|
|
959
|
+
* after the shared LLM layer's bounded reconcile repair round, in which case no notice is added.
|
|
960
|
+
* Empty in a dry-run.
|
|
951
961
|
*/
|
|
952
962
|
readonly providerFailures: readonly string[];
|
|
953
963
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -100,7 +100,31 @@ interface Usage {
|
|
|
100
100
|
readonly inputTokens: number;
|
|
101
101
|
readonly outputTokens: number;
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Stable codes for a provider's graceful-degradation notices. These are returned DATA on a
|
|
105
|
+
* successful result, NOT thrown:
|
|
106
|
+
*
|
|
107
|
+
* - `FORMALITY_DOWNGRADED`: a requested formality was not applied (DeepL's free tier does not
|
|
108
|
+
* support it).
|
|
109
|
+
* - `GLOSSARY_IGNORED`: a supplied generic glossary term map was not applied (DeepL only applies a
|
|
110
|
+
* native glossary id, never a term map).
|
|
111
|
+
* - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
|
|
112
|
+
* because the provider cannot preserve those tokens; such entries are withheld (absent from the
|
|
113
|
+
* result maps) rather than sent to the provider and mangled.
|
|
114
|
+
*/
|
|
115
|
+
type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
|
|
116
|
+
/**
|
|
117
|
+
* An observable, structured signal that something was gracefully degraded (not an
|
|
118
|
+
* error). Carries only a stable code and a static message, never a key or content.
|
|
119
|
+
* Surfaced as result data, never thrown; callers inspect it but need not treat it as a failure.
|
|
120
|
+
*/
|
|
121
|
+
interface ProviderNotice {
|
|
122
|
+
/** The stable {@link ProviderNoticeCode} for what was degraded. */
|
|
123
|
+
readonly code: ProviderNoticeCode;
|
|
124
|
+
/** A static, safe description; never a key or translatable content. */
|
|
125
|
+
readonly message: string;
|
|
126
|
+
}
|
|
127
|
+
/** Result of a batch translation: per-key values, per-key integrity outcomes, and any notices. */
|
|
104
128
|
interface TranslateResult {
|
|
105
129
|
/** The translated value for each requested key. */
|
|
106
130
|
readonly values: ReadonlyMap<string, string>;
|
|
@@ -108,6 +132,12 @@ interface TranslateResult {
|
|
|
108
132
|
readonly integrity: ReadonlyMap<string, PlaceholderIntegrityResult$1>;
|
|
109
133
|
/** Token usage when the provider reports it; absent for token-less providers. */
|
|
110
134
|
readonly usage?: Usage;
|
|
135
|
+
/**
|
|
136
|
+
* Graceful-degradation notices for this batch. Every provider populates this as a present array:
|
|
137
|
+
* DeepL reports real notices (for example `GLOSSARY_IGNORED`); an LLM provider with nothing to
|
|
138
|
+
* report returns an empty array rather than omitting the field.
|
|
139
|
+
*/
|
|
140
|
+
readonly notices?: readonly ProviderNotice[];
|
|
111
141
|
}
|
|
112
142
|
/**
|
|
113
143
|
* The single contract every provider implements. It is narrow enough that a machine-translation API like
|
|
@@ -166,28 +196,6 @@ interface TranslationProvider {
|
|
|
166
196
|
* are still accepted. This drives editor completions only; the runtime schema validates.
|
|
167
197
|
*/
|
|
168
198
|
type AnthropicModel = Anthropic.Messages.Model;
|
|
169
|
-
/**
|
|
170
|
-
* Stable codes for the DeepL graceful-degradation notices, DeepL only. These are returned DATA on a
|
|
171
|
-
* successful result, NOT thrown:
|
|
172
|
-
*
|
|
173
|
-
* - `FORMALITY_DOWNGRADED`: a requested formality was not applied (the free tier does not support it).
|
|
174
|
-
* - `GLOSSARY_IGNORED`: a supplied generic glossary was not applied.
|
|
175
|
-
* - `PLACEHOLDER_UNSUPPORTED`: at least one placeholder- or ICU-bearing entry was left untranslated
|
|
176
|
-
* because DeepL cannot preserve those tokens; such entries are withheld (absent from the result maps)
|
|
177
|
-
* rather than sent to DeepL and mangled.
|
|
178
|
-
*/
|
|
179
|
-
type ProviderNoticeCode = "FORMALITY_DOWNGRADED" | "GLOSSARY_IGNORED" | "PLACEHOLDER_UNSUPPORTED";
|
|
180
|
-
/**
|
|
181
|
-
* An observable, structured signal that something was gracefully degraded (not an
|
|
182
|
-
* error). Carries only a stable code and a static message, never a key or content.
|
|
183
|
-
* Surfaced as result data, never thrown; callers inspect it but need not treat it as a failure.
|
|
184
|
-
*/
|
|
185
|
-
interface ProviderNotice {
|
|
186
|
-
/** The stable {@link ProviderNoticeCode} for what was degraded. */
|
|
187
|
-
readonly code: ProviderNoticeCode;
|
|
188
|
-
/** A static, safe description; never a key or translatable content. */
|
|
189
|
-
readonly message: string;
|
|
190
|
-
}
|
|
191
199
|
|
|
192
200
|
/**
|
|
193
201
|
* The Gemini authoring model type, sourced from the installed SDK's own model union so
|
|
@@ -943,11 +951,13 @@ interface LocaleSummary {
|
|
|
943
951
|
*/
|
|
944
952
|
readonly integrityMismatches: readonly string[];
|
|
945
953
|
/**
|
|
946
|
-
* Keys withheld because
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* {@link LocaleSummary.notices} entry carries the secret-free failure code
|
|
950
|
-
*
|
|
954
|
+
* Keys withheld because nothing was translated for them this run, as distinct from a translation
|
|
955
|
+
* that came back and failed the placeholder-integrity check. This covers two causes: the provider
|
|
956
|
+
* call itself failed (for example a revoked API key, a rate limit, or a network timeout), in which
|
|
957
|
+
* case the corresponding {@link LocaleSummary.notices} entry carries the secret-free failure code
|
|
958
|
+
* and message; or the call succeeded but the key was still missing or duplicated in the response
|
|
959
|
+
* after the shared LLM layer's bounded reconcile repair round, in which case no notice is added.
|
|
960
|
+
* Empty in a dry-run.
|
|
951
961
|
*/
|
|
952
962
|
readonly providerFailures: readonly string[];
|
|
953
963
|
/**
|