visual-ai-assertions 0.6.0 → 0.7.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 +20 -18
- package/dist/index.cjs +144 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.js +143 -42
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,7 @@ declare const Model: {
|
|
|
23
23
|
};
|
|
24
24
|
readonly Google: {
|
|
25
25
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
26
|
+
readonly GEMINI_3_1_FLASH_LITE_PREVIEW: "gemini-3.1-flash-lite-preview";
|
|
26
27
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -124,16 +125,20 @@ type StatementResult = z.infer<typeof StatementResultSchema>;
|
|
|
124
125
|
declare const UsageInfoSchema: z.ZodObject<{
|
|
125
126
|
inputTokens: z.ZodNumber;
|
|
126
127
|
outputTokens: z.ZodNumber;
|
|
128
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
129
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
127
130
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
128
131
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
129
132
|
}, "strip", z.ZodTypeAny, {
|
|
130
133
|
inputTokens: number;
|
|
131
134
|
outputTokens: number;
|
|
135
|
+
reasoningTokens?: number | undefined;
|
|
132
136
|
estimatedCost?: number | undefined;
|
|
133
137
|
durationSeconds?: number | undefined;
|
|
134
138
|
}, {
|
|
135
139
|
inputTokens: number;
|
|
136
140
|
outputTokens: number;
|
|
141
|
+
reasoningTokens?: number | undefined;
|
|
137
142
|
estimatedCost?: number | undefined;
|
|
138
143
|
durationSeconds?: number | undefined;
|
|
139
144
|
}>;
|
|
@@ -146,16 +151,20 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
146
151
|
usage: z.ZodOptional<z.ZodObject<{
|
|
147
152
|
inputTokens: z.ZodNumber;
|
|
148
153
|
outputTokens: z.ZodNumber;
|
|
154
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
155
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
149
156
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
150
157
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
151
158
|
}, "strip", z.ZodTypeAny, {
|
|
152
159
|
inputTokens: number;
|
|
153
160
|
outputTokens: number;
|
|
161
|
+
reasoningTokens?: number | undefined;
|
|
154
162
|
estimatedCost?: number | undefined;
|
|
155
163
|
durationSeconds?: number | undefined;
|
|
156
164
|
}, {
|
|
157
165
|
inputTokens: number;
|
|
158
166
|
outputTokens: number;
|
|
167
|
+
reasoningTokens?: number | undefined;
|
|
159
168
|
estimatedCost?: number | undefined;
|
|
160
169
|
durationSeconds?: number | undefined;
|
|
161
170
|
}>>;
|
|
@@ -210,6 +219,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
210
219
|
usage?: {
|
|
211
220
|
inputTokens: number;
|
|
212
221
|
outputTokens: number;
|
|
222
|
+
reasoningTokens?: number | undefined;
|
|
213
223
|
estimatedCost?: number | undefined;
|
|
214
224
|
durationSeconds?: number | undefined;
|
|
215
225
|
} | undefined;
|
|
@@ -231,6 +241,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
231
241
|
usage?: {
|
|
232
242
|
inputTokens: number;
|
|
233
243
|
outputTokens: number;
|
|
244
|
+
reasoningTokens?: number | undefined;
|
|
234
245
|
estimatedCost?: number | undefined;
|
|
235
246
|
durationSeconds?: number | undefined;
|
|
236
247
|
} | undefined;
|
|
@@ -257,16 +268,20 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
257
268
|
usage: z.ZodOptional<z.ZodObject<{
|
|
258
269
|
inputTokens: z.ZodNumber;
|
|
259
270
|
outputTokens: z.ZodNumber;
|
|
271
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
272
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
260
273
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
261
274
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
262
275
|
}, "strip", z.ZodTypeAny, {
|
|
263
276
|
inputTokens: number;
|
|
264
277
|
outputTokens: number;
|
|
278
|
+
reasoningTokens?: number | undefined;
|
|
265
279
|
estimatedCost?: number | undefined;
|
|
266
280
|
durationSeconds?: number | undefined;
|
|
267
281
|
}, {
|
|
268
282
|
inputTokens: number;
|
|
269
283
|
outputTokens: number;
|
|
284
|
+
reasoningTokens?: number | undefined;
|
|
270
285
|
estimatedCost?: number | undefined;
|
|
271
286
|
durationSeconds?: number | undefined;
|
|
272
287
|
}>>;
|
|
@@ -291,6 +306,7 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
291
306
|
usage?: {
|
|
292
307
|
inputTokens: number;
|
|
293
308
|
outputTokens: number;
|
|
309
|
+
reasoningTokens?: number | undefined;
|
|
294
310
|
estimatedCost?: number | undefined;
|
|
295
311
|
durationSeconds?: number | undefined;
|
|
296
312
|
} | undefined;
|
|
@@ -304,6 +320,7 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
304
320
|
usage?: {
|
|
305
321
|
inputTokens: number;
|
|
306
322
|
outputTokens: number;
|
|
323
|
+
reasoningTokens?: number | undefined;
|
|
307
324
|
estimatedCost?: number | undefined;
|
|
308
325
|
durationSeconds?: number | undefined;
|
|
309
326
|
} | undefined;
|
|
@@ -334,16 +351,20 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
334
351
|
usage: z.ZodOptional<z.ZodObject<{
|
|
335
352
|
inputTokens: z.ZodNumber;
|
|
336
353
|
outputTokens: z.ZodNumber;
|
|
354
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
355
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
337
356
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
338
357
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
339
358
|
}, "strip", z.ZodTypeAny, {
|
|
340
359
|
inputTokens: number;
|
|
341
360
|
outputTokens: number;
|
|
361
|
+
reasoningTokens?: number | undefined;
|
|
342
362
|
estimatedCost?: number | undefined;
|
|
343
363
|
durationSeconds?: number | undefined;
|
|
344
364
|
}, {
|
|
345
365
|
inputTokens: number;
|
|
346
366
|
outputTokens: number;
|
|
367
|
+
reasoningTokens?: number | undefined;
|
|
347
368
|
estimatedCost?: number | undefined;
|
|
348
369
|
durationSeconds?: number | undefined;
|
|
349
370
|
}>>;
|
|
@@ -358,6 +379,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
358
379
|
usage?: {
|
|
359
380
|
inputTokens: number;
|
|
360
381
|
outputTokens: number;
|
|
382
|
+
reasoningTokens?: number | undefined;
|
|
361
383
|
estimatedCost?: number | undefined;
|
|
362
384
|
durationSeconds?: number | undefined;
|
|
363
385
|
} | undefined;
|
|
@@ -372,6 +394,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
372
394
|
usage?: {
|
|
373
395
|
inputTokens: number;
|
|
374
396
|
outputTokens: number;
|
|
397
|
+
reasoningTokens?: number | undefined;
|
|
375
398
|
estimatedCost?: number | undefined;
|
|
376
399
|
durationSeconds?: number | undefined;
|
|
377
400
|
} | undefined;
|
|
@@ -642,7 +665,7 @@ declare function visualAI(config?: VisualAIConfig): VisualAIClient;
|
|
|
642
665
|
/**
|
|
643
666
|
* Discrete error codes exposed by visual-ai-assertions for programmatic handling.
|
|
644
667
|
*/
|
|
645
|
-
type VisualAIErrorCode = "VISUAL_AI_ERROR" | "AUTH_FAILED" | "RATE_LIMITED" | "PROVIDER_ERROR" | "IMAGE_INVALID" | "RESPONSE_PARSE_FAILED" | "CONFIG_INVALID" | "ASSERTION_FAILED";
|
|
668
|
+
type VisualAIErrorCode = "VISUAL_AI_ERROR" | "AUTH_FAILED" | "RATE_LIMITED" | "PROVIDER_ERROR" | "IMAGE_INVALID" | "RESPONSE_PARSE_FAILED" | "RESPONSE_TRUNCATED" | "CONFIG_INVALID" | "ASSERTION_FAILED";
|
|
646
669
|
/**
|
|
647
670
|
* Base class for all library errors.
|
|
648
671
|
*
|
|
@@ -730,6 +753,23 @@ declare class VisualAIResponseParseError extends VisualAIError<"RESPONSE_PARSE_F
|
|
|
730
753
|
rawResponse: string;
|
|
731
754
|
constructor(message: string, rawResponse: string);
|
|
732
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Thrown when a provider response is truncated due to token budget exhaustion.
|
|
758
|
+
*
|
|
759
|
+
* Carries `partialResponse` and `maxTokens` so callers can inspect the output
|
|
760
|
+
* and adjust configuration.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```ts
|
|
764
|
+
* throw new VisualAITruncationError("Response truncated", partialText, 4096);
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
declare class VisualAITruncationError extends VisualAIError<"RESPONSE_TRUNCATED"> {
|
|
768
|
+
readonly code: "RESPONSE_TRUNCATED";
|
|
769
|
+
readonly partialResponse: string;
|
|
770
|
+
readonly maxTokens: number;
|
|
771
|
+
constructor(message: string, partialResponse: string, maxTokens: number);
|
|
772
|
+
}
|
|
733
773
|
/**
|
|
734
774
|
* Thrown when library configuration is missing or invalid.
|
|
735
775
|
*
|
|
@@ -760,7 +800,7 @@ declare class VisualAIAssertionError extends VisualAIError<"ASSERTION_FAILED"> {
|
|
|
760
800
|
/**
|
|
761
801
|
* Union of all concrete error subclasses exposed by the library.
|
|
762
802
|
*/
|
|
763
|
-
type VisualAIKnownError = VisualAIAuthError | VisualAIRateLimitError | VisualAIProviderError | VisualAIImageError | VisualAIResponseParseError | VisualAIConfigError | VisualAIAssertionError;
|
|
803
|
+
type VisualAIKnownError = VisualAIAuthError | VisualAIRateLimitError | VisualAIProviderError | VisualAIImageError | VisualAIResponseParseError | VisualAITruncationError | VisualAIConfigError | VisualAIAssertionError;
|
|
764
804
|
/**
|
|
765
805
|
* Narrows an unknown thrown value to the concrete visual-ai-assertions error union.
|
|
766
806
|
*
|
|
@@ -839,4 +879,4 @@ declare function assertVisualResult(result: CheckResult, label?: string): void;
|
|
|
839
879
|
*/
|
|
840
880
|
declare function assertVisualCompareResult(result: CompareResult, label?: string): void;
|
|
841
881
|
|
|
842
|
-
export { Accessibility, type AccessibilityCheckName, type AccessibilityOptions, type AskOptions, type AskResult, AskResultSchema, type ChangeEntry, ChangeEntrySchema, type CheckOptions, type CheckResult, CheckResultSchema, type CompareOptions, type CompareResult, CompareResultSchema, type Confidence, ConfidenceSchema, Content, type ContentCheckName, type ContentOptions, DEFAULT_MODELS, type DiffImageResult, type ElementsVisibilityOptions, type ImageInput, type Issue, type IssueCategory, IssueCategorySchema, type IssuePriority, IssuePrioritySchema, IssueSchema, type KnownModelName, Layout, type LayoutCheckName, type LayoutOptions, Model, type PageLoadOptions, Provider, type ProviderName, type ReasoningEffort, type StatementResult, StatementResultSchema, type SupportedMimeType, type UsageInfo, UsageInfoSchema, VisualAIAssertionError, VisualAIAuthError, type VisualAIClient, type VisualAIConfig, VisualAIConfigError, VisualAIError, type VisualAIErrorCode, VisualAIImageError, type VisualAIKnownError, VisualAIProviderError, VisualAIRateLimitError, VisualAIResponseParseError, assertVisualCompareResult, assertVisualResult, formatCheckResult, formatCompareResult, isVisualAIKnownError, visualAI };
|
|
882
|
+
export { Accessibility, type AccessibilityCheckName, type AccessibilityOptions, type AskOptions, type AskResult, AskResultSchema, type ChangeEntry, ChangeEntrySchema, type CheckOptions, type CheckResult, CheckResultSchema, type CompareOptions, type CompareResult, CompareResultSchema, type Confidence, ConfidenceSchema, Content, type ContentCheckName, type ContentOptions, DEFAULT_MODELS, type DiffImageResult, type ElementsVisibilityOptions, type ImageInput, type Issue, type IssueCategory, IssueCategorySchema, type IssuePriority, IssuePrioritySchema, IssueSchema, type KnownModelName, Layout, type LayoutCheckName, type LayoutOptions, Model, type PageLoadOptions, Provider, type ProviderName, type ReasoningEffort, type StatementResult, StatementResultSchema, type SupportedMimeType, type UsageInfo, UsageInfoSchema, VisualAIAssertionError, VisualAIAuthError, type VisualAIClient, type VisualAIConfig, VisualAIConfigError, VisualAIError, type VisualAIErrorCode, VisualAIImageError, type VisualAIKnownError, VisualAIProviderError, VisualAIRateLimitError, VisualAIResponseParseError, VisualAITruncationError, assertVisualCompareResult, assertVisualResult, formatCheckResult, formatCompareResult, isVisualAIKnownError, visualAI };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ declare const Model: {
|
|
|
23
23
|
};
|
|
24
24
|
readonly Google: {
|
|
25
25
|
readonly GEMINI_3_1_PRO_PREVIEW: "gemini-3.1-pro-preview";
|
|
26
|
+
readonly GEMINI_3_1_FLASH_LITE_PREVIEW: "gemini-3.1-flash-lite-preview";
|
|
26
27
|
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -124,16 +125,20 @@ type StatementResult = z.infer<typeof StatementResultSchema>;
|
|
|
124
125
|
declare const UsageInfoSchema: z.ZodObject<{
|
|
125
126
|
inputTokens: z.ZodNumber;
|
|
126
127
|
outputTokens: z.ZodNumber;
|
|
128
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
129
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
127
130
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
128
131
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
129
132
|
}, "strip", z.ZodTypeAny, {
|
|
130
133
|
inputTokens: number;
|
|
131
134
|
outputTokens: number;
|
|
135
|
+
reasoningTokens?: number | undefined;
|
|
132
136
|
estimatedCost?: number | undefined;
|
|
133
137
|
durationSeconds?: number | undefined;
|
|
134
138
|
}, {
|
|
135
139
|
inputTokens: number;
|
|
136
140
|
outputTokens: number;
|
|
141
|
+
reasoningTokens?: number | undefined;
|
|
137
142
|
estimatedCost?: number | undefined;
|
|
138
143
|
durationSeconds?: number | undefined;
|
|
139
144
|
}>;
|
|
@@ -146,16 +151,20 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
146
151
|
usage: z.ZodOptional<z.ZodObject<{
|
|
147
152
|
inputTokens: z.ZodNumber;
|
|
148
153
|
outputTokens: z.ZodNumber;
|
|
154
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
155
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
149
156
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
150
157
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
151
158
|
}, "strip", z.ZodTypeAny, {
|
|
152
159
|
inputTokens: number;
|
|
153
160
|
outputTokens: number;
|
|
161
|
+
reasoningTokens?: number | undefined;
|
|
154
162
|
estimatedCost?: number | undefined;
|
|
155
163
|
durationSeconds?: number | undefined;
|
|
156
164
|
}, {
|
|
157
165
|
inputTokens: number;
|
|
158
166
|
outputTokens: number;
|
|
167
|
+
reasoningTokens?: number | undefined;
|
|
159
168
|
estimatedCost?: number | undefined;
|
|
160
169
|
durationSeconds?: number | undefined;
|
|
161
170
|
}>>;
|
|
@@ -210,6 +219,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
210
219
|
usage?: {
|
|
211
220
|
inputTokens: number;
|
|
212
221
|
outputTokens: number;
|
|
222
|
+
reasoningTokens?: number | undefined;
|
|
213
223
|
estimatedCost?: number | undefined;
|
|
214
224
|
durationSeconds?: number | undefined;
|
|
215
225
|
} | undefined;
|
|
@@ -231,6 +241,7 @@ declare const CheckResultSchema: z.ZodObject<{
|
|
|
231
241
|
usage?: {
|
|
232
242
|
inputTokens: number;
|
|
233
243
|
outputTokens: number;
|
|
244
|
+
reasoningTokens?: number | undefined;
|
|
234
245
|
estimatedCost?: number | undefined;
|
|
235
246
|
durationSeconds?: number | undefined;
|
|
236
247
|
} | undefined;
|
|
@@ -257,16 +268,20 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
257
268
|
usage: z.ZodOptional<z.ZodObject<{
|
|
258
269
|
inputTokens: z.ZodNumber;
|
|
259
270
|
outputTokens: z.ZodNumber;
|
|
271
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
272
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
260
273
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
261
274
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
262
275
|
}, "strip", z.ZodTypeAny, {
|
|
263
276
|
inputTokens: number;
|
|
264
277
|
outputTokens: number;
|
|
278
|
+
reasoningTokens?: number | undefined;
|
|
265
279
|
estimatedCost?: number | undefined;
|
|
266
280
|
durationSeconds?: number | undefined;
|
|
267
281
|
}, {
|
|
268
282
|
inputTokens: number;
|
|
269
283
|
outputTokens: number;
|
|
284
|
+
reasoningTokens?: number | undefined;
|
|
270
285
|
estimatedCost?: number | undefined;
|
|
271
286
|
durationSeconds?: number | undefined;
|
|
272
287
|
}>>;
|
|
@@ -291,6 +306,7 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
291
306
|
usage?: {
|
|
292
307
|
inputTokens: number;
|
|
293
308
|
outputTokens: number;
|
|
309
|
+
reasoningTokens?: number | undefined;
|
|
294
310
|
estimatedCost?: number | undefined;
|
|
295
311
|
durationSeconds?: number | undefined;
|
|
296
312
|
} | undefined;
|
|
@@ -304,6 +320,7 @@ declare const CompareResultSchema: z.ZodObject<{
|
|
|
304
320
|
usage?: {
|
|
305
321
|
inputTokens: number;
|
|
306
322
|
outputTokens: number;
|
|
323
|
+
reasoningTokens?: number | undefined;
|
|
307
324
|
estimatedCost?: number | undefined;
|
|
308
325
|
durationSeconds?: number | undefined;
|
|
309
326
|
} | undefined;
|
|
@@ -334,16 +351,20 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
334
351
|
usage: z.ZodOptional<z.ZodObject<{
|
|
335
352
|
inputTokens: z.ZodNumber;
|
|
336
353
|
outputTokens: z.ZodNumber;
|
|
354
|
+
/** Reasoning/thinking tokens consumed by the model (informational, typically included within outputTokens). */
|
|
355
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
337
356
|
estimatedCost: z.ZodOptional<z.ZodNumber>;
|
|
338
357
|
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
339
358
|
}, "strip", z.ZodTypeAny, {
|
|
340
359
|
inputTokens: number;
|
|
341
360
|
outputTokens: number;
|
|
361
|
+
reasoningTokens?: number | undefined;
|
|
342
362
|
estimatedCost?: number | undefined;
|
|
343
363
|
durationSeconds?: number | undefined;
|
|
344
364
|
}, {
|
|
345
365
|
inputTokens: number;
|
|
346
366
|
outputTokens: number;
|
|
367
|
+
reasoningTokens?: number | undefined;
|
|
347
368
|
estimatedCost?: number | undefined;
|
|
348
369
|
durationSeconds?: number | undefined;
|
|
349
370
|
}>>;
|
|
@@ -358,6 +379,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
358
379
|
usage?: {
|
|
359
380
|
inputTokens: number;
|
|
360
381
|
outputTokens: number;
|
|
382
|
+
reasoningTokens?: number | undefined;
|
|
361
383
|
estimatedCost?: number | undefined;
|
|
362
384
|
durationSeconds?: number | undefined;
|
|
363
385
|
} | undefined;
|
|
@@ -372,6 +394,7 @@ declare const AskResultSchema: z.ZodObject<{
|
|
|
372
394
|
usage?: {
|
|
373
395
|
inputTokens: number;
|
|
374
396
|
outputTokens: number;
|
|
397
|
+
reasoningTokens?: number | undefined;
|
|
375
398
|
estimatedCost?: number | undefined;
|
|
376
399
|
durationSeconds?: number | undefined;
|
|
377
400
|
} | undefined;
|
|
@@ -642,7 +665,7 @@ declare function visualAI(config?: VisualAIConfig): VisualAIClient;
|
|
|
642
665
|
/**
|
|
643
666
|
* Discrete error codes exposed by visual-ai-assertions for programmatic handling.
|
|
644
667
|
*/
|
|
645
|
-
type VisualAIErrorCode = "VISUAL_AI_ERROR" | "AUTH_FAILED" | "RATE_LIMITED" | "PROVIDER_ERROR" | "IMAGE_INVALID" | "RESPONSE_PARSE_FAILED" | "CONFIG_INVALID" | "ASSERTION_FAILED";
|
|
668
|
+
type VisualAIErrorCode = "VISUAL_AI_ERROR" | "AUTH_FAILED" | "RATE_LIMITED" | "PROVIDER_ERROR" | "IMAGE_INVALID" | "RESPONSE_PARSE_FAILED" | "RESPONSE_TRUNCATED" | "CONFIG_INVALID" | "ASSERTION_FAILED";
|
|
646
669
|
/**
|
|
647
670
|
* Base class for all library errors.
|
|
648
671
|
*
|
|
@@ -730,6 +753,23 @@ declare class VisualAIResponseParseError extends VisualAIError<"RESPONSE_PARSE_F
|
|
|
730
753
|
rawResponse: string;
|
|
731
754
|
constructor(message: string, rawResponse: string);
|
|
732
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Thrown when a provider response is truncated due to token budget exhaustion.
|
|
758
|
+
*
|
|
759
|
+
* Carries `partialResponse` and `maxTokens` so callers can inspect the output
|
|
760
|
+
* and adjust configuration.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```ts
|
|
764
|
+
* throw new VisualAITruncationError("Response truncated", partialText, 4096);
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
declare class VisualAITruncationError extends VisualAIError<"RESPONSE_TRUNCATED"> {
|
|
768
|
+
readonly code: "RESPONSE_TRUNCATED";
|
|
769
|
+
readonly partialResponse: string;
|
|
770
|
+
readonly maxTokens: number;
|
|
771
|
+
constructor(message: string, partialResponse: string, maxTokens: number);
|
|
772
|
+
}
|
|
733
773
|
/**
|
|
734
774
|
* Thrown when library configuration is missing or invalid.
|
|
735
775
|
*
|
|
@@ -760,7 +800,7 @@ declare class VisualAIAssertionError extends VisualAIError<"ASSERTION_FAILED"> {
|
|
|
760
800
|
/**
|
|
761
801
|
* Union of all concrete error subclasses exposed by the library.
|
|
762
802
|
*/
|
|
763
|
-
type VisualAIKnownError = VisualAIAuthError | VisualAIRateLimitError | VisualAIProviderError | VisualAIImageError | VisualAIResponseParseError | VisualAIConfigError | VisualAIAssertionError;
|
|
803
|
+
type VisualAIKnownError = VisualAIAuthError | VisualAIRateLimitError | VisualAIProviderError | VisualAIImageError | VisualAIResponseParseError | VisualAITruncationError | VisualAIConfigError | VisualAIAssertionError;
|
|
764
804
|
/**
|
|
765
805
|
* Narrows an unknown thrown value to the concrete visual-ai-assertions error union.
|
|
766
806
|
*
|
|
@@ -839,4 +879,4 @@ declare function assertVisualResult(result: CheckResult, label?: string): void;
|
|
|
839
879
|
*/
|
|
840
880
|
declare function assertVisualCompareResult(result: CompareResult, label?: string): void;
|
|
841
881
|
|
|
842
|
-
export { Accessibility, type AccessibilityCheckName, type AccessibilityOptions, type AskOptions, type AskResult, AskResultSchema, type ChangeEntry, ChangeEntrySchema, type CheckOptions, type CheckResult, CheckResultSchema, type CompareOptions, type CompareResult, CompareResultSchema, type Confidence, ConfidenceSchema, Content, type ContentCheckName, type ContentOptions, DEFAULT_MODELS, type DiffImageResult, type ElementsVisibilityOptions, type ImageInput, type Issue, type IssueCategory, IssueCategorySchema, type IssuePriority, IssuePrioritySchema, IssueSchema, type KnownModelName, Layout, type LayoutCheckName, type LayoutOptions, Model, type PageLoadOptions, Provider, type ProviderName, type ReasoningEffort, type StatementResult, StatementResultSchema, type SupportedMimeType, type UsageInfo, UsageInfoSchema, VisualAIAssertionError, VisualAIAuthError, type VisualAIClient, type VisualAIConfig, VisualAIConfigError, VisualAIError, type VisualAIErrorCode, VisualAIImageError, type VisualAIKnownError, VisualAIProviderError, VisualAIRateLimitError, VisualAIResponseParseError, assertVisualCompareResult, assertVisualResult, formatCheckResult, formatCompareResult, isVisualAIKnownError, visualAI };
|
|
882
|
+
export { Accessibility, type AccessibilityCheckName, type AccessibilityOptions, type AskOptions, type AskResult, AskResultSchema, type ChangeEntry, ChangeEntrySchema, type CheckOptions, type CheckResult, CheckResultSchema, type CompareOptions, type CompareResult, CompareResultSchema, type Confidence, ConfidenceSchema, Content, type ContentCheckName, type ContentOptions, DEFAULT_MODELS, type DiffImageResult, type ElementsVisibilityOptions, type ImageInput, type Issue, type IssueCategory, IssueCategorySchema, type IssuePriority, IssuePrioritySchema, IssueSchema, type KnownModelName, Layout, type LayoutCheckName, type LayoutOptions, Model, type PageLoadOptions, Provider, type ProviderName, type ReasoningEffort, type StatementResult, StatementResultSchema, type SupportedMimeType, type UsageInfo, UsageInfoSchema, VisualAIAssertionError, VisualAIAuthError, type VisualAIClient, type VisualAIConfig, VisualAIConfigError, VisualAIError, type VisualAIErrorCode, VisualAIImageError, type VisualAIKnownError, VisualAIProviderError, VisualAIRateLimitError, VisualAIResponseParseError, VisualAITruncationError, assertVisualCompareResult, assertVisualResult, formatCheckResult, formatCompareResult, isVisualAIKnownError, visualAI };
|