beddel 0.1.0 → 0.1.1
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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +357 -196
- package/dist/agents/agentRegistry.d.ts +14 -1
- package/dist/agents/agentRegistry.d.ts.map +1 -1
- package/dist/agents/agentRegistry.js +98 -1
- package/dist/agents/agentRegistry.js.map +1 -1
- package/dist/runtime/schemaCompiler.js +5 -4
- package/dist/runtime/schemaCompiler.js.map +1 -1
- package/package.json +5 -2
- package/src/agents/agentRegistry.ts +115 -2
- package/src/runtime/schemaCompiler.ts +5 -5
- package/dist/agents/formatter-agent.d.ts +0 -10
- package/dist/agents/formatter-agent.d.ts.map +0 -1
- package/dist/agents/formatter-agent.js +0 -49
- package/dist/agents/formatter-agent.js.map +0 -1
- package/dist/agents/genkit-agent.d.ts +0 -12
- package/dist/agents/genkit-agent.d.ts.map +0 -1
- package/dist/agents/genkit-agent.js +0 -119
- package/dist/agents/genkit-agent.js.map +0 -1
- package/dist/agents/i18n-messages.d.ts +0 -17
- package/dist/agents/i18n-messages.d.ts.map +0 -1
- package/dist/agents/i18n-messages.js +0 -92
- package/dist/agents/i18n-messages.js.map +0 -1
- package/dist/agents/index.d.ts +0 -10
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -26
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/pipeline.d.ts +0 -15
- package/dist/agents/pipeline.d.ts.map +0 -1
- package/dist/agents/pipeline.js +0 -45
- package/dist/agents/pipeline.js.map +0 -1
- package/dist/agents/schema-factory.d.ts +0 -40
- package/dist/agents/schema-factory.d.ts.map +0 -1
- package/dist/agents/schema-factory.js +0 -121
- package/dist/agents/schema-factory.js.map +0 -1
- package/dist/agents/translation-validators.d.ts +0 -26
- package/dist/agents/translation-validators.d.ts.map +0 -1
- package/dist/agents/translation-validators.js +0 -77
- package/dist/agents/translation-validators.js.map +0 -1
- package/dist/agents/translator-agents.d.ts +0 -184
- package/dist/agents/translator-agents.d.ts.map +0 -1
- package/dist/agents/translator-agents.js +0 -613
- package/dist/agents/translator-agents.js.map +0 -1
- package/dist/agents/types/translation.types.d.ts +0 -100
- package/dist/agents/types/translation.types.d.ts.map +0 -1
- package/dist/agents/types/translation.types.js +0 -3
- package/dist/agents/types/translation.types.js.map +0 -1
- package/dist/agents/validator-agent.d.ts +0 -42
- package/dist/agents/validator-agent.d.ts.map +0 -1
- package/dist/agents/validator-agent.js +0 -122
- package/dist/agents/validator-agent.js.map +0 -1
- package/dist/security/test-security.d.ts +0 -22
- package/dist/security/test-security.d.ts.map +0 -1
- package/dist/security/test-security.js +0 -154
- package/dist/security/test-security.js.map +0 -1
- package/tools/seed.ts +0 -365
- package/tools/test-endpoints.ts +0 -174
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
interface TranslationRequest {
|
|
3
|
-
texto: string;
|
|
4
|
-
idioma_origem: string;
|
|
5
|
-
idioma_destino: string;
|
|
6
|
-
}
|
|
7
|
-
interface TranslationResponse {
|
|
8
|
-
texto_traduzido: string;
|
|
9
|
-
metadados: {
|
|
10
|
-
modelo_utilizado: string;
|
|
11
|
-
tempo_processamento: number;
|
|
12
|
-
confianca: number;
|
|
13
|
-
idiomas_suportados?: string[];
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Enhanced validation error with multiple validation failures support
|
|
18
|
-
*/
|
|
19
|
-
export interface ValidationError {
|
|
20
|
-
campo: string;
|
|
21
|
-
mensagem: string;
|
|
22
|
-
codigo: string;
|
|
23
|
-
issues?: ValidationIssue[];
|
|
24
|
-
}
|
|
25
|
-
export interface ValidationIssue {
|
|
26
|
-
path: (string | number)[];
|
|
27
|
-
message: string;
|
|
28
|
-
type: string;
|
|
29
|
-
expected?: unknown;
|
|
30
|
-
received?: unknown;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Configuration options for validation behavior
|
|
34
|
-
*/
|
|
35
|
-
export interface ValidationOptions {
|
|
36
|
-
stripUnknown?: boolean;
|
|
37
|
-
abortEarly?: boolean;
|
|
38
|
-
allowExtraKeys?: boolean;
|
|
39
|
-
description?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Enhanced validation result with multiple validation failures support
|
|
43
|
-
*/
|
|
44
|
-
export interface ValidationResult<T> {
|
|
45
|
-
success: boolean;
|
|
46
|
-
data?: T;
|
|
47
|
-
error?: ValidationError;
|
|
48
|
-
}
|
|
49
|
-
export declare class ValidatorAgent {
|
|
50
|
-
private static schemaCache;
|
|
51
|
-
private static readonly DEFAULT_OPTIONS;
|
|
52
|
-
/**
|
|
53
|
-
* Enhanced validate input with comprehensive error handling and type safety
|
|
54
|
-
* @param schema - Zod schema for validation
|
|
55
|
-
* @param data - Unknown data to validate
|
|
56
|
-
* @param options - Validation behavior options
|
|
57
|
-
* @returns Validated typed data
|
|
58
|
-
* @throws {ValidationError} with detailed error information
|
|
59
|
-
*/
|
|
60
|
-
static validateInput<T>(schema: z.ZodSchema, data: unknown, options?: ValidationOptions): T;
|
|
61
|
-
/**
|
|
62
|
-
* Safe validation that returns result object instead of throwing
|
|
63
|
-
*/
|
|
64
|
-
static safeValidate<T>(schema: z.ZodSchema, data: unknown, options?: ValidationOptions): ValidationResult<T>;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a cached schema validator for better performance
|
|
67
|
-
*/
|
|
68
|
-
static createCachedValidator(schema: z.ZodSchema, schemaId: string, options?: ValidationOptions): <T>(data: unknown) => T;
|
|
69
|
-
/**
|
|
70
|
-
* Create a validator with pre-configured schema
|
|
71
|
-
*/
|
|
72
|
-
static createValidator<T>(schema: z.ZodSchema, options?: ValidationOptions): (data: unknown) => T;
|
|
73
|
-
/**
|
|
74
|
-
* Build comprehensive validation error from ZodError
|
|
75
|
-
*/
|
|
76
|
-
private static buildValidationError;
|
|
77
|
-
static validateSchema(schema: z.ZodSchema): boolean;
|
|
78
|
-
}
|
|
79
|
-
export declare const translatorSchema: z.ZodObject<{
|
|
80
|
-
texto: z.ZodString;
|
|
81
|
-
idioma_origem: z.ZodString;
|
|
82
|
-
idioma_destino: z.ZodString;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
export declare class GenkitAgent {
|
|
85
|
-
private static readonly IDIOMAS_SUPORTADOS;
|
|
86
|
-
static processResource(resource: string, params: TranslationRequest): Promise<TranslationResponse>;
|
|
87
|
-
private static handleTranslation;
|
|
88
|
-
private static processBasicTranslation;
|
|
89
|
-
}
|
|
90
|
-
export declare class FormatterAgent {
|
|
91
|
-
private static readonly OUTPUT_SCHEMA;
|
|
92
|
-
static formatOutput(data: TranslationResponse): TranslationResponse;
|
|
93
|
-
}
|
|
94
|
-
interface AgentConfig {
|
|
95
|
-
resource?: string;
|
|
96
|
-
cacheTTL?: number;
|
|
97
|
-
fallbackModels?: string[];
|
|
98
|
-
}
|
|
99
|
-
export declare function translatorPipeline(request: TranslationRequest, config?: AgentConfig): Promise<TranslationResponse>;
|
|
100
|
-
export declare function createValidatorAgent(schema: z.ZodSchema): <T>(data: unknown) => T;
|
|
101
|
-
export declare class SchemaFactory {
|
|
102
|
-
private static readonly IDIOMAS_SUPORTADOS;
|
|
103
|
-
private static readonly MAX_TEXT_LENGTH;
|
|
104
|
-
private static readonly MIN_TEXT_LENGTH;
|
|
105
|
-
/**
|
|
106
|
-
* Creates a dynamic translation request schema with custom validation rules
|
|
107
|
-
*/
|
|
108
|
-
static createTranslationSchema(options?: {
|
|
109
|
-
maxTextLength?: number;
|
|
110
|
-
supportedLanguages?: string[];
|
|
111
|
-
requireMetadata?: boolean;
|
|
112
|
-
}): z.ZodSchema<TranslationRequest>;
|
|
113
|
-
/**
|
|
114
|
-
* Creates a schema for translation response with enhanced validation
|
|
115
|
-
*/
|
|
116
|
-
static createTranslationResponseSchema(options?: {
|
|
117
|
-
minConfidence?: number;
|
|
118
|
-
maxProcessingTime?: number;
|
|
119
|
-
includeLanguageSupport?: boolean;
|
|
120
|
-
}): z.ZodSchema<TranslationResponse>;
|
|
121
|
-
/**
|
|
122
|
-
* Creates a schema for batch translation requests
|
|
123
|
-
*/
|
|
124
|
-
static createBatchTranslationSchema(maxBatchSize?: number): z.ZodSchema<TranslationRequest[]>;
|
|
125
|
-
/**
|
|
126
|
-
* Creates a schema for translation configuration
|
|
127
|
-
*/
|
|
128
|
-
static createTranslationConfigSchema(): z.ZodObject<{
|
|
129
|
-
sourceLanguage: z.ZodEnum<{
|
|
130
|
-
pt: "pt";
|
|
131
|
-
en: "en";
|
|
132
|
-
es: "es";
|
|
133
|
-
fr: "fr";
|
|
134
|
-
}>;
|
|
135
|
-
targetLanguage: z.ZodEnum<{
|
|
136
|
-
pt: "pt";
|
|
137
|
-
en: "en";
|
|
138
|
-
es: "es";
|
|
139
|
-
fr: "fr";
|
|
140
|
-
}>;
|
|
141
|
-
preserveFormatting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
142
|
-
enableCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
143
|
-
cacheTTL: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
144
|
-
fallbackModel: z.ZodOptional<z.ZodString>;
|
|
145
|
-
confidenceThreshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
146
|
-
}, z.core.$strip>;
|
|
147
|
-
}
|
|
148
|
-
export declare class TranslationValidators {
|
|
149
|
-
private static readonly LINGUAS_COM_CARACTERES_ESPECIAIS;
|
|
150
|
-
private static readonly LINGUAS_SEM_ACENTOS;
|
|
151
|
-
/**
|
|
152
|
-
* Validates if text contains appropriate characters for the target language
|
|
153
|
-
*/
|
|
154
|
-
static validateTextForLanguage(text: string, language: string): ValidationResult<boolean>;
|
|
155
|
-
/**
|
|
156
|
-
* Validates translation confidence level
|
|
157
|
-
*/
|
|
158
|
-
static validateConfidenceLevel(confidence: number, threshold?: number): ValidationResult<boolean>;
|
|
159
|
-
/**
|
|
160
|
-
* Validates language compatibility
|
|
161
|
-
*/
|
|
162
|
-
static validateLanguageCompatibility(sourceLang: string, targetLang: string, supportedPairs?: Set<string>): ValidationResult<boolean>;
|
|
163
|
-
/**
|
|
164
|
-
* Validates translation request limits
|
|
165
|
-
*/
|
|
166
|
-
static validateTranslationLimits(request: TranslationRequest, limits?: {
|
|
167
|
-
maxTextLength?: number;
|
|
168
|
-
minTextLength?: number;
|
|
169
|
-
supportedLanguages?: string[];
|
|
170
|
-
}): ValidationResult<TranslationRequest>;
|
|
171
|
-
}
|
|
172
|
-
export declare class I18nValidatorMessages {
|
|
173
|
-
private static messages;
|
|
174
|
-
/**
|
|
175
|
-
* Get localized error message
|
|
176
|
-
*/
|
|
177
|
-
static getLocalizedMessage(errorCode: string, language?: string): string;
|
|
178
|
-
/**
|
|
179
|
-
* Localize validation error
|
|
180
|
-
*/
|
|
181
|
-
static localizeValidationError(error: ValidationError, language?: string): ValidationError;
|
|
182
|
-
}
|
|
183
|
-
export type { TranslationRequest, TranslationResponse, AgentConfig };
|
|
184
|
-
//# sourceMappingURL=translator-agents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"translator-agents.d.ts","sourceRoot":"","sources":["../../src/agents/translator-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE;QACT,gBAAgB,EAAE,MAAM,CAAC;QACzB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,SAAS,EAAE,MAAM,CAAC;QAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAA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