The subagent attachment path, session-controller, and client labels already name this failure MODEL_DOES_NOT_SUPPORT_IMAGES. Rename the unreleased ImageInputError code IMAGE_UNSUPPORTED_MODEL so one fact has one code. Refs #7869
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
/** Typed `read_image` failures. @module @deepseek-ai/dsh-tool-fs/src/image-error */
|
|
|
|
import { HarnessError } from '@deepseek-ai/dsh-error'
|
|
|
|
/**
|
|
* Every `read_image` failure the tool classifies itself, before the attachment store sees the bytes:
|
|
*
|
|
* - `MODEL_DOES_NOT_SUPPORT_IMAGES`: the calling route does not declare image input; switch to an image-capable model.
|
|
* - `IMAGE_UNSUPPORTED_FORMAT`: the extension, the file signature, or the deployment's accepted media types
|
|
* exclude the format; convert the file to an accepted format or read another file.
|
|
*
|
|
* Failures the attachment store classifies keep their `AttachmentError` codes.
|
|
*/
|
|
export const IMAGE_INPUT_ERROR_CODES = [
|
|
'MODEL_DOES_NOT_SUPPORT_IMAGES',
|
|
'IMAGE_UNSUPPORTED_FORMAT',
|
|
] as const
|
|
|
|
/** One `read_image` failure code. */
|
|
export type ImageInputErrorCode = typeof IMAGE_INPUT_ERROR_CODES[number]
|
|
|
|
/** Typed `read_image` failure; `code` is one of {@link IMAGE_INPUT_ERROR_CODES}. */
|
|
export class ImageInputError extends HarnessError {
|
|
override readonly code: ImageInputErrorCode
|
|
|
|
/**
|
|
* @param message - model-facing refusal naming the path and the safe next step.
|
|
* @param code - stable failure code.
|
|
* @param options - standard `cause` chaining.
|
|
*/
|
|
constructor(message: string, code: ImageInputErrorCode, options?: ErrorOptions) {
|
|
super(message, code, options)
|
|
this.name = 'ImageInputError'
|
|
this.code = code
|
|
}
|
|
}
|