intention-coding 0.3.2 → 0.3.5

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.
Files changed (46) hide show
  1. package/dist/config.d.ts +1 -0
  2. package/dist/index.js +7598 -8747
  3. package/dist/services/claude-code/index.d.ts +12 -12
  4. package/dist/services/code-generator/index.d.ts +29 -84
  5. package/dist/services/code-generator/stages/execution-stage.d.ts +95 -0
  6. package/dist/services/code-generator/stages/ideation-stage.d.ts +33 -0
  7. package/dist/services/code-generator/stages/optimization-stage.d.ts +46 -0
  8. package/dist/services/code-generator/stages/planning-stage.d.ts +33 -0
  9. package/dist/services/code-generator/stages/research-stage.d.ts +35 -0
  10. package/dist/services/code-generator/stages/review-stage.d.ts +33 -0
  11. package/dist/services/code-generator/types.d.ts +232 -0
  12. package/dist/services/code-generator/utils/instruction-executor.d.ts +69 -0
  13. package/dist/services/code-generator/workflow-manager.d.ts +46 -0
  14. package/dist/services/image-analysis/analyzer.d.ts +62 -0
  15. package/dist/services/image-analysis/index.d.ts +74 -27
  16. package/dist/services/image-analysis/types.d.ts +175 -143
  17. package/dist/services/image-converter/converter.d.ts +20 -65
  18. package/dist/services/image-converter/index.d.ts +28 -96
  19. package/dist/services/image-converter/types.d.ts +61 -0
  20. package/dist/services/integrated-generator/index.d.ts +24 -24
  21. package/dist/services/requirement-analyzer/core/document-generator.d.ts +36 -0
  22. package/dist/services/requirement-analyzer/core/intelligent-analyzer.d.ts +35 -0
  23. package/dist/services/requirement-analyzer/core/project-analyzer.d.ts +36 -0
  24. package/dist/services/requirement-analyzer/core/requirement-analyzer-service.d.ts +30 -0
  25. package/dist/services/requirement-analyzer/core/template-selector.d.ts +35 -0
  26. package/dist/services/requirement-analyzer/core/types.d.ts +83 -0
  27. package/dist/services/requirement-analyzer/index.d.ts +57 -215
  28. package/dist/services/requirement-analyzer/prompt/intelligent-requirement-analysis.d.ts +1 -0
  29. package/dist/services/requirement-analyzer/utils/file-reader.d.ts +8 -0
  30. package/dist/utils/openai.d.ts +3 -0
  31. package/package.json +4 -2
  32. package/dist/services/code-generator/database-manager.d.ts +0 -65
  33. package/dist/services/code-generator/enhanced-tools.d.ts +0 -392
  34. package/dist/services/code-generator/export-excel.d.ts +0 -21
  35. package/dist/services/code-generator/task-queue.d.ts +0 -114
  36. package/dist/services/image-analysis/config.d.ts +0 -14
  37. package/dist/services/image-analysis/factory.d.ts +0 -33
  38. package/dist/services/image-analysis/image-analysis.d.ts +0 -36
  39. package/dist/services/image-analysis/image-encoder.d.ts +0 -20
  40. package/dist/services/image-analysis/image-validator.d.ts +0 -30
  41. package/dist/services/image-analysis/tools.d.ts +0 -55
  42. package/dist/services/index.d.ts +0 -0
  43. package/dist/services/requirement-analyzer/prompt/enhanced-feature-extraction.d.ts +0 -1
  44. package/dist/services/requirement-analyzer/prompt/fallback-document.d.ts +0 -1
  45. package/dist/services/requirement-analyzer/prompt/feature-dependency-analysis.d.ts +0 -1
  46. package/dist/services/requirement-analyzer/prompt/feature-extraction.d.ts +0 -2
@@ -1,154 +1,186 @@
1
- import { z } from 'zod';
2
1
  /**
3
- * Parameters for image analysis requests
4
- *
5
- * @example
6
- * ```typescript
7
- * const params: ImageAnalysisParams = {
8
- * imagePath: '/path/to/image.jpg',
9
- * prompt: 'Describe this image in detail',
10
- * maxTokens: 2000,
11
- * temperature: 0.5,
12
- * systemPrompt: 'You are a helpful assistant'
13
- * };
14
- * ```
2
+ * 图片内容理解智能体的类型定义
15
3
  */
16
- export declare const ImageAnalysisParams: z.ZodObject<{
17
- imagePath: z.ZodEffects<z.ZodString, string, string>;
18
- prompt: z.ZodString;
19
- maxTokens: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
20
- temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
21
- systemPrompt: z.ZodOptional<z.ZodString>;
22
- }, "strip", z.ZodTypeAny, {
23
- prompt: string;
24
- temperature: number;
25
- imagePath: string;
26
- maxTokens: number;
27
- systemPrompt?: string | undefined;
28
- }, {
29
- prompt: string;
30
- imagePath: string;
31
- temperature?: number | undefined;
32
- maxTokens?: number | undefined;
33
- systemPrompt?: string | undefined;
34
- }>;
35
- export type ImageAnalysisParams = z.infer<typeof ImageAnalysisParams>;
36
- /**
37
- * Result of image analysis
38
- *
39
- * @example
40
- * ```typescript
41
- * const result: ImageAnalysisResult = {
42
- * content: 'This is an image of a cat sitting on a windowsill...',
43
- * usage: {
44
- * promptTokens: 100,
45
- * completionTokens: 50,
46
- * totalTokens: 150
47
- * },
48
- * metadata: {
49
- * imagePath: '/path/to/image.jpg',
50
- * imageSize: 1024000,
51
- * imageFormat: 'jpg',
52
- * processingTime: 1500
53
- * }
54
- * };
55
- * ```
56
- */
57
- export interface ImageAnalysisResult {
58
- content: string;
59
- usage?: {
60
- promptTokens: number;
61
- completionTokens: number;
62
- totalTokens: number;
63
- };
64
- metadata: {
65
- imagePath: string;
66
- imageSize: number;
67
- imageFormat: string;
68
- processingTime: number;
69
- };
4
+ export interface ImageAnalysisParams {
5
+ image_path: string;
6
+ analysis_type: AnalysisType;
7
+ custom_prompt?: string;
8
+ detail_level?: DetailLevel;
9
+ language?: string;
70
10
  }
71
- /**
72
- * Information about an image file
73
- */
74
- export interface ImageFileInfo {
75
- exists: boolean;
76
- size: number;
11
+ export declare enum AnalysisType {
12
+ GENERAL = "general",// 通用分析
13
+ OBJECTS = "objects",// 物体识别
14
+ TEXT = "text",// 文字识别
15
+ SCENE = "scene",// 场景分析
16
+ PEOPLE = "people",// 人物分析
17
+ TECHNICAL = "technical",// 技术分析
18
+ UI_DESIGN = "ui_design",// UI设计稿分析
19
+ REQUIREMENT = "requirement",// 需求识别分析
20
+ CUSTOM = "custom"
21
+ }
22
+ export declare enum DetailLevel {
23
+ BRIEF = "brief",// 简要
24
+ DETAILED = "detailed",// 详细
25
+ COMPREHENSIVE = "comprehensive"
26
+ }
27
+ export interface ImageBasicInfo {
28
+ path: string;
77
29
  format: string;
78
- isSupported: boolean;
79
- mimeType: string;
30
+ dimensions: {
31
+ width: number;
32
+ height: number;
33
+ };
34
+ file_size: number;
35
+ color_space?: string;
36
+ has_alpha?: boolean;
80
37
  }
81
- /**
82
- * Vision API request structure
83
- * Note: The model is hardcoded to 'moonshot-v1-8k-vision-preview' and cannot be configured.
84
- */
85
- export interface VisionRequest {
86
- model: string;
87
- messages: Array<{
88
- role: 'user' | 'system';
89
- content: Array<{
90
- type: 'text' | 'image_url';
91
- text?: string;
92
- image_url?: {
93
- url: string;
94
- };
95
- }>;
96
- }>;
97
- max_tokens?: number;
98
- temperature?: number;
38
+ export interface AnalysisResult {
39
+ basic_info: ImageBasicInfo;
40
+ analysis_type: AnalysisType;
41
+ detail_level: DetailLevel;
42
+ content: AnalysisContent;
43
+ processing_time_ms: number;
44
+ confidence_score?: number;
99
45
  }
100
- /**
101
- * Vision API response structure
102
- */
103
- export interface VisionResponse {
104
- choices: Array<{
105
- message: {
106
- content: string;
107
- role: string;
108
- };
109
- finish_reason: string;
110
- }>;
111
- usage: {
112
- prompt_tokens: number;
113
- completion_tokens: number;
114
- total_tokens: number;
46
+ export interface AnalysisContent {
47
+ summary: string;
48
+ details: Record<string, any>;
49
+ tags?: string[];
50
+ objects?: DetectedObject[];
51
+ text_content?: ExtractedText[];
52
+ scene_info?: SceneInfo;
53
+ people_info?: PersonInfo[];
54
+ technical_info?: TechnicalInfo;
55
+ ui_design_info?: UIDesignInfo;
56
+ requirement_info?: RequirementInfo;
57
+ }
58
+ export interface DetectedObject {
59
+ name: string;
60
+ confidence: number;
61
+ bounding_box?: BoundingBox;
62
+ attributes?: Record<string, any>;
63
+ }
64
+ export interface BoundingBox {
65
+ x: number;
66
+ y: number;
67
+ width: number;
68
+ height: number;
69
+ }
70
+ export interface ExtractedText {
71
+ text: string;
72
+ confidence: number;
73
+ bounding_box?: BoundingBox;
74
+ language?: string;
75
+ }
76
+ export interface SceneInfo {
77
+ location_type: string;
78
+ environment: string;
79
+ lighting: string;
80
+ weather?: string;
81
+ time_of_day?: string;
82
+ mood?: string;
83
+ }
84
+ export interface PersonInfo {
85
+ count: number;
86
+ age_range?: string;
87
+ gender?: string;
88
+ emotions?: string[];
89
+ activities?: string[];
90
+ clothing?: string[];
91
+ }
92
+ export interface TechnicalInfo {
93
+ color_analysis: {
94
+ dominant_colors: string[];
95
+ color_palette: string[];
96
+ brightness: number;
97
+ contrast: number;
98
+ };
99
+ composition: {
100
+ rule_of_thirds: boolean;
101
+ symmetry: boolean;
102
+ leading_lines: boolean;
103
+ };
104
+ quality_metrics: {
105
+ sharpness: number;
106
+ noise_level: number;
107
+ exposure: string;
115
108
  };
116
109
  }
117
- /**
118
- * Error codes for image analysis
119
- *
120
- * @example
121
- * ```typescript
122
- * try {
123
- * await imageAnalysisService.analyzeImage(params);
124
- * } catch (error) {
125
- * if (error instanceof ImageAnalysisError) {
126
- * switch (error.code) {
127
- * case ErrorCodes.FILE_NOT_FOUND:
128
- * console.error('Image file not found');
129
- * break;
130
- * case ErrorCodes.API_ERROR:
131
- * console.error('API error:', error.message);
132
- * break;
133
- * // Handle other error codes
134
- * }
135
- * }
136
- * }
137
- * ```
138
- */
139
- export declare enum ErrorCodes {
140
- FILE_NOT_FOUND = "FILE_NOT_FOUND",
110
+ export declare class ImageAnalysisError extends Error {
111
+ readonly code: string;
112
+ readonly context?: any | undefined;
113
+ constructor(message: string, code: string, context?: any | undefined);
114
+ }
115
+ export declare enum AnalysisErrorCodes {
116
+ INVALID_IMAGE_PATH = "INVALID_IMAGE_PATH",
141
117
  UNSUPPORTED_FORMAT = "UNSUPPORTED_FORMAT",
142
- FILE_TOO_LARGE = "FILE_TOO_LARGE",
143
- PERMISSION_DENIED = "PERMISSION_DENIED",
144
- API_ERROR = "API_ERROR",
145
- VALIDATION_ERROR = "VALIDATION_ERROR"
118
+ FILE_NOT_FOUND = "FILE_NOT_FOUND",
119
+ IMAGE_CORRUPTED = "IMAGE_CORRUPTED",
120
+ ANALYSIS_FAILED = "ANALYSIS_FAILED",
121
+ AI_SERVICE_ERROR = "AI_SERVICE_ERROR",
122
+ INVALID_ANALYSIS_TYPE = "INVALID_ANALYSIS_TYPE"
146
123
  }
147
- /**
148
- * Custom error class for image analysis errors
149
- */
150
- export declare class ImageAnalysisError extends Error {
151
- code: ErrorCodes;
152
- details?: any | undefined;
153
- constructor(message: string, code: ErrorCodes, details?: any | undefined);
124
+ export interface UIDesignInfo {
125
+ layout_type: string;
126
+ components: UIComponent[];
127
+ color_scheme: {
128
+ primary_colors: string[];
129
+ secondary_colors: string[];
130
+ background_colors: string[];
131
+ };
132
+ typography: {
133
+ fonts: string[];
134
+ text_hierarchy: string[];
135
+ };
136
+ navigation: {
137
+ type: string;
138
+ elements: string[];
139
+ };
140
+ responsive_design: boolean;
141
+ design_patterns: string[];
142
+ accessibility_features: string[];
143
+ }
144
+ export interface UIComponent {
145
+ type: string;
146
+ name: string;
147
+ position: {
148
+ x: number;
149
+ y: number;
150
+ width: number;
151
+ height: number;
152
+ };
153
+ properties: Record<string, any>;
154
+ interactions?: string[];
155
+ }
156
+ export interface RequirementInfo {
157
+ functional_requirements: FunctionalRequirement[];
158
+ non_functional_requirements: NonFunctionalRequirement[];
159
+ user_stories: UserStory[];
160
+ business_rules: string[];
161
+ constraints: string[];
162
+ assumptions: string[];
163
+ }
164
+ export interface FunctionalRequirement {
165
+ id: string;
166
+ title: string;
167
+ description: string;
168
+ priority: 'high' | 'medium' | 'low';
169
+ category: string;
170
+ acceptance_criteria: string[];
171
+ }
172
+ export interface NonFunctionalRequirement {
173
+ type: string;
174
+ description: string;
175
+ metric?: string;
176
+ target_value?: string;
177
+ }
178
+ export interface UserStory {
179
+ as_a: string;
180
+ i_want: string;
181
+ so_that: string;
182
+ acceptance_criteria: string[];
183
+ priority: 'high' | 'medium' | 'low';
154
184
  }
185
+ export declare const SUPPORTED_IMAGE_FORMATS: readonly ["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp"];
186
+ export type SupportedImageFormat = typeof SUPPORTED_IMAGE_FORMATS[number];
@@ -1,84 +1,39 @@
1
- export interface ConvertImageOptions {
2
- input_path: string;
3
- output_format: string;
4
- quality?: number;
5
- width?: number;
6
- height?: number;
7
- maintain_aspect_ratio?: boolean;
8
- output_path?: string;
9
- }
10
- export interface BatchConvertOptions {
11
- input_paths: string[];
12
- output_format: string;
13
- quality?: number;
14
- width?: number;
15
- height?: number;
16
- maintain_aspect_ratio?: boolean;
17
- output_directory?: string;
18
- }
19
- export interface ConvertResult {
20
- output_path: string;
21
- file_size: number;
22
- dimensions: {
23
- width: number;
24
- height: number;
25
- };
26
- format: string;
27
- }
28
- export interface BatchConvertResult {
29
- success: boolean;
30
- output_path?: string;
31
- error?: string;
32
- }
33
- export interface ImageInfo {
34
- format: string;
35
- width: number;
36
- height: number;
37
- channels: number;
38
- size: number;
39
- space?: string;
40
- }
1
+ import { ImageConversionParams, BatchConversionResult } from './types';
2
+ /**
3
+ * 图片格式转换核心服务
4
+ * 职责:处理单张和批量图片的格式转换
5
+ */
41
6
  export declare class ImageConverter {
42
- private supportedInputFormats;
43
- private supportedOutputFormats;
44
- constructor();
45
- /**
46
- * 转换单个图片
47
- */
48
- convertImage(options: ConvertImageOptions): Promise<ConvertResult>;
49
7
  /**
50
- * 批量转换图片
8
+ * 转换图片(支持单张和批量)
51
9
  */
52
- batchConvertImages(options: BatchConvertOptions): Promise<BatchConvertResult[]>;
10
+ convertImages(params: ImageConversionParams): Promise<BatchConversionResult>;
53
11
  /**
54
- * 获取图片信息
12
+ * 转换单张图片
55
13
  */
56
- getImageInfo(imagePath: string): Promise<ImageInfo>;
14
+ private convertSingleImage;
57
15
  /**
58
- * 获取支持的格式列表
16
+ * 执行实际的图片转换
59
17
  */
60
- getSupportedFormats(): {
61
- input: string[];
62
- output: string[];
63
- };
18
+ private performConversion;
64
19
  /**
65
- * 转换为SVG格式
20
+ * 获取图片元数据
66
21
  */
67
- private convertToSvg;
22
+ private getImageMetadata;
68
23
  /**
69
- * 转换为ICO格式(简化版本)
24
+ * 验证参数
70
25
  */
71
- private convertToIco;
26
+ private validateParams;
72
27
  /**
73
- * 获取文件格式
28
+ * 验证输入文件
74
29
  */
75
- private getFileFormat;
30
+ private validateInputFile;
76
31
  /**
77
- * 生成输出文件路径
32
+ * 生成输出路径
78
33
  */
79
34
  private generateOutputPath;
80
35
  /**
81
- * 生成输出文件名
36
+ * 确保输出目录存在
82
37
  */
83
- private generateOutputFilename;
38
+ private ensureOutputDirectory;
84
39
  }
@@ -1,132 +1,64 @@
1
- import { z } from 'zod';
2
- declare const ConvertImageArgsSchema: z.ZodObject<{
3
- input_path: z.ZodString;
4
- output_format: z.ZodString;
5
- quality: z.ZodOptional<z.ZodNumber>;
6
- width: z.ZodOptional<z.ZodNumber>;
7
- height: z.ZodOptional<z.ZodNumber>;
8
- maintain_aspect_ratio: z.ZodDefault<z.ZodBoolean>;
9
- output_path: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- input_path: string;
12
- output_format: string;
13
- maintain_aspect_ratio: boolean;
14
- quality?: number | undefined;
15
- width?: number | undefined;
16
- height?: number | undefined;
17
- output_path?: string | undefined;
18
- }, {
19
- input_path: string;
20
- output_format: string;
21
- quality?: number | undefined;
22
- width?: number | undefined;
23
- height?: number | undefined;
24
- maintain_aspect_ratio?: boolean | undefined;
25
- output_path?: string | undefined;
26
- }>;
27
- declare const BatchConvertArgsSchema: z.ZodObject<{
28
- input_paths: z.ZodArray<z.ZodString, "many">;
29
- output_format: z.ZodString;
1
+ import { z } from "zod";
2
+ declare const ImageConversionParamsSchema: z.ZodObject<{
3
+ input_paths: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
4
+ output_format: z.ZodEnum<["jpg", "jpeg", "png", "gif", "bmp", "tiff", "webp", "ico"]>;
30
5
  quality: z.ZodOptional<z.ZodNumber>;
31
6
  width: z.ZodOptional<z.ZodNumber>;
32
7
  height: z.ZodOptional<z.ZodNumber>;
33
8
  maintain_aspect_ratio: z.ZodDefault<z.ZodBoolean>;
34
9
  output_directory: z.ZodOptional<z.ZodString>;
35
10
  }, "strip", z.ZodTypeAny, {
36
- output_format: string;
11
+ input_paths: string | string[];
12
+ output_format: "jpg" | "jpeg" | "png" | "gif" | "bmp" | "tiff" | "webp" | "ico";
37
13
  maintain_aspect_ratio: boolean;
38
- input_paths: string[];
39
- quality?: number | undefined;
40
14
  width?: number | undefined;
41
15
  height?: number | undefined;
16
+ quality?: number | undefined;
42
17
  output_directory?: string | undefined;
43
18
  }, {
44
- output_format: string;
45
- input_paths: string[];
46
- quality?: number | undefined;
19
+ input_paths: string | string[];
20
+ output_format: "jpg" | "jpeg" | "png" | "gif" | "bmp" | "tiff" | "webp" | "ico";
47
21
  width?: number | undefined;
48
22
  height?: number | undefined;
23
+ quality?: number | undefined;
49
24
  maintain_aspect_ratio?: boolean | undefined;
50
25
  output_directory?: string | undefined;
51
26
  }>;
52
- export declare const convertImageTool: {
53
- name: string;
54
- description: string;
55
- parameters: z.ZodObject<{
56
- input_path: z.ZodString;
57
- output_format: z.ZodString;
58
- quality: z.ZodOptional<z.ZodNumber>;
59
- width: z.ZodOptional<z.ZodNumber>;
60
- height: z.ZodOptional<z.ZodNumber>;
61
- maintain_aspect_ratio: z.ZodDefault<z.ZodBoolean>;
62
- output_path: z.ZodOptional<z.ZodString>;
63
- }, "strip", z.ZodTypeAny, {
64
- input_path: string;
65
- output_format: string;
66
- maintain_aspect_ratio: boolean;
67
- quality?: number | undefined;
68
- width?: number | undefined;
69
- height?: number | undefined;
70
- output_path?: string | undefined;
71
- }, {
72
- input_path: string;
73
- output_format: string;
74
- quality?: number | undefined;
75
- width?: number | undefined;
76
- height?: number | undefined;
77
- maintain_aspect_ratio?: boolean | undefined;
78
- output_path?: string | undefined;
79
- }>;
80
- execute: (args: z.infer<typeof ConvertImageArgsSchema>) => Promise<string>;
81
- };
82
- export declare const batchConvertImagesTool: {
27
+ export type ImageConversionToolParams = z.infer<typeof ImageConversionParamsSchema>;
28
+ /**
29
+ * 图片格式转换智能体
30
+ * 支持单张图片和批量图片转换
31
+ */
32
+ export declare const imageConverterTool: {
83
33
  name: string;
84
34
  description: string;
85
35
  parameters: z.ZodObject<{
86
- input_paths: z.ZodArray<z.ZodString, "many">;
87
- output_format: z.ZodString;
36
+ input_paths: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
37
+ output_format: z.ZodEnum<["jpg", "jpeg", "png", "gif", "bmp", "tiff", "webp", "ico"]>;
88
38
  quality: z.ZodOptional<z.ZodNumber>;
89
39
  width: z.ZodOptional<z.ZodNumber>;
90
40
  height: z.ZodOptional<z.ZodNumber>;
91
41
  maintain_aspect_ratio: z.ZodDefault<z.ZodBoolean>;
92
42
  output_directory: z.ZodOptional<z.ZodString>;
93
43
  }, "strip", z.ZodTypeAny, {
94
- output_format: string;
44
+ input_paths: string | string[];
45
+ output_format: "jpg" | "jpeg" | "png" | "gif" | "bmp" | "tiff" | "webp" | "ico";
95
46
  maintain_aspect_ratio: boolean;
96
- input_paths: string[];
97
- quality?: number | undefined;
98
47
  width?: number | undefined;
99
48
  height?: number | undefined;
49
+ quality?: number | undefined;
100
50
  output_directory?: string | undefined;
101
51
  }, {
102
- output_format: string;
103
- input_paths: string[];
104
- quality?: number | undefined;
52
+ input_paths: string | string[];
53
+ output_format: "jpg" | "jpeg" | "png" | "gif" | "bmp" | "tiff" | "webp" | "ico";
105
54
  width?: number | undefined;
106
55
  height?: number | undefined;
56
+ quality?: number | undefined;
107
57
  maintain_aspect_ratio?: boolean | undefined;
108
58
  output_directory?: string | undefined;
109
59
  }>;
110
- execute: (args: z.infer<typeof BatchConvertArgsSchema>) => Promise<string>;
111
- };
112
- export declare const getImageInfoTool: {
113
- name: string;
114
- description: string;
115
- parameters: z.ZodObject<{
116
- image_path: z.ZodString;
117
- }, "strip", z.ZodTypeAny, {
118
- image_path: string;
119
- }, {
120
- image_path: string;
121
- }>;
122
- execute: (args: {
123
- image_path: string;
124
- }) => Promise<string>;
125
- };
126
- export declare const listSupportedFormatsTool: {
127
- name: string;
128
- description: string;
129
- parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
130
- execute: () => Promise<string>;
60
+ execute: (args: ImageConversionToolParams) => Promise<string>;
131
61
  };
132
- export {};
62
+ export { ImageConverter } from "./converter";
63
+ export type { ImageConversionParams, BatchConversionResult, ConversionResult, ImageMetadata, } from "./types";
64
+ export { ImageConversionError, ConversionErrorCodes } from "./types";
@@ -0,0 +1,61 @@
1
+ /**
2
+ * 图片格式转换智能体的类型定义
3
+ */
4
+ export interface ImageConversionParams {
5
+ input_paths: string | string[];
6
+ output_format: string;
7
+ quality?: number;
8
+ width?: number;
9
+ height?: number;
10
+ maintain_aspect_ratio?: boolean;
11
+ output_directory?: string;
12
+ }
13
+ export interface ImageDimensions {
14
+ width: number;
15
+ height: number;
16
+ }
17
+ export interface ConversionResult {
18
+ input_path: string;
19
+ output_path: string;
20
+ success: boolean;
21
+ error?: string;
22
+ format?: string;
23
+ dimensions?: ImageDimensions;
24
+ file_size?: number;
25
+ }
26
+ export interface BatchConversionSummary {
27
+ total: number;
28
+ successful: number;
29
+ failed: number;
30
+ processing_time_ms: number;
31
+ }
32
+ export interface BatchConversionResult {
33
+ results: ConversionResult[];
34
+ summary: BatchConversionSummary;
35
+ }
36
+ export interface ImageMetadata {
37
+ format: string;
38
+ width: number;
39
+ height: number;
40
+ channels: number;
41
+ hasAlpha: boolean;
42
+ density?: number;
43
+ }
44
+ export declare class ImageConversionError extends Error {
45
+ readonly code: string;
46
+ readonly context?: any | undefined;
47
+ constructor(message: string, code: string, context?: any | undefined);
48
+ }
49
+ export declare enum ConversionErrorCodes {
50
+ INVALID_INPUT_PATH = "INVALID_INPUT_PATH",
51
+ UNSUPPORTED_FORMAT = "UNSUPPORTED_FORMAT",
52
+ FILE_NOT_FOUND = "FILE_NOT_FOUND",
53
+ INVALID_DIMENSIONS = "INVALID_DIMENSIONS",
54
+ CONVERSION_FAILED = "CONVERSION_FAILED",
55
+ OUTPUT_WRITE_FAILED = "OUTPUT_WRITE_FAILED",
56
+ INVALID_QUALITY = "INVALID_QUALITY"
57
+ }
58
+ export declare const SUPPORTED_INPUT_FORMATS: readonly ["jpg", "jpeg", "png", "gif", "bmp", "tiff", "tif", "webp", "svg", "ico"];
59
+ export declare const SUPPORTED_OUTPUT_FORMATS: readonly ["jpg", "jpeg", "png", "gif", "bmp", "tiff", "webp", "ico"];
60
+ export type SupportedInputFormat = typeof SUPPORTED_INPUT_FORMATS[number];
61
+ export type SupportedOutputFormat = typeof SUPPORTED_OUTPUT_FORMATS[number];