@synova-cloud/sdk 1.6.0 → 1.8.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/dist/index.d.cts CHANGED
@@ -1,24 +1,82 @@
1
- type TSynovaMessageRole = 'system' | 'user' | 'assistant' | 'tool';
2
- type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'audio' | 'error';
3
- type TSynovaModelType = 'text' | 'image';
4
- type TSynovaUsageType = 'tokens' | 'images' | 'time';
5
- type TSynovaJsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array';
6
- interface ISynovaJsonSchema {
7
- /** Schema type */
8
- type?: TSynovaJsonSchemaType;
9
- /** Description of the field */
1
+ /**
2
+ * JSON Schema primitive types
3
+ */
4
+ type TJsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array';
5
+ /**
6
+ * JSON Schema string formats
7
+ * @see https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
8
+ */
9
+ type TJsonSchemaFormat = 'date-time' | 'date' | 'time' | 'duration' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'iri-reference' | 'uuid' | 'json-pointer' | 'relative-json-pointer' | 'regex';
10
+ /**
11
+ * JSON Schema definition
12
+ * @see https://json-schema.org/specification
13
+ */
14
+ interface IJsonSchema {
15
+ type?: TJsonSchemaType | TJsonSchemaType[];
10
16
  description?: string;
11
- /** Allowed values (for enum-like fields) */
17
+ examples?: unknown[];
18
+ default?: unknown;
12
19
  enum?: (string | number | boolean | null)[];
13
- /** Schema for array items (when type='array') */
14
- items?: ISynovaJsonSchema;
15
- /** Object properties (when type='object') */
16
- properties?: Record<string, ISynovaJsonSchema>;
17
- /** Required property names (when type='object') */
20
+ minLength?: number;
21
+ maxLength?: number;
22
+ pattern?: string;
23
+ format?: TJsonSchemaFormat;
24
+ minimum?: number;
25
+ maximum?: number;
26
+ exclusiveMinimum?: number;
27
+ exclusiveMaximum?: number;
28
+ multipleOf?: number;
29
+ items?: IJsonSchema;
30
+ minItems?: number;
31
+ maxItems?: number;
32
+ uniqueItems?: boolean;
33
+ properties?: Record<string, IJsonSchema>;
18
34
  required?: string[];
19
- /** Whether additional properties are allowed (when type='object') */
35
+ additionalProperties?: boolean | IJsonSchema;
36
+ allOf?: IJsonSchema[];
37
+ anyOf?: IJsonSchema[];
38
+ oneOf?: IJsonSchema[];
39
+ not?: IJsonSchema;
40
+ }
41
+ /**
42
+ * Metadata keys used by schema decorators
43
+ */
44
+ declare const SCHEMA_METADATA_KEYS: {
45
+ readonly DESCRIPTION: "synova:schema:description";
46
+ readonly EXAMPLES: "synova:schema:examples";
47
+ readonly DEFAULT: "synova:schema:default";
48
+ readonly FORMAT: "synova:schema:format";
49
+ readonly ARRAY_ITEM_TYPE: "synova:schema:arrayItemType";
50
+ readonly NULLABLE: "synova:schema:nullable";
51
+ readonly ENUM: "synova:schema:enum";
52
+ readonly MIN_LENGTH: "synova:schema:minLength";
53
+ readonly MAX_LENGTH: "synova:schema:maxLength";
54
+ readonly PATTERN: "synova:schema:pattern";
55
+ readonly MINIMUM: "synova:schema:minimum";
56
+ readonly MAXIMUM: "synova:schema:maximum";
57
+ readonly EXCLUSIVE_MINIMUM: "synova:schema:exclusiveMinimum";
58
+ readonly EXCLUSIVE_MAXIMUM: "synova:schema:exclusiveMaximum";
59
+ readonly MULTIPLE_OF: "synova:schema:multipleOf";
60
+ readonly MIN_ITEMS: "synova:schema:minItems";
61
+ readonly MAX_ITEMS: "synova:schema:maxItems";
62
+ readonly UNIQUE_ITEMS: "synova:schema:uniqueItems";
63
+ };
64
+ /**
65
+ * Options for schema generation
66
+ */
67
+ interface IGenerateSchemaOptions {
68
+ /** Allow additional properties on objects (default: false) */
20
69
  additionalProperties?: boolean;
21
70
  }
71
+ /**
72
+ * Constructor type for classes
73
+ */
74
+ type TClassConstructor<T = unknown> = new (...args: any[]) => T;
75
+
76
+ type TSynovaMessageRole = 'system' | 'user' | 'assistant' | 'tool';
77
+ type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'audio' | 'error';
78
+ type TSynovaModelType = 'text' | 'image';
79
+ type TSynovaUsageType = 'tokens' | 'images' | 'time';
22
80
  interface ISynovaLogger {
23
81
  debug: (message: string, ...args: unknown[]) => void;
24
82
  info: (message: string, ...args: unknown[]) => void;
@@ -119,7 +177,9 @@ interface ISynovaExecuteOptions {
119
177
  /** Model parameters (temperature, maxTokens, topP, topK, etc.) */
120
178
  parameters?: Record<string, unknown>;
121
179
  /** JSON Schema for structured output */
122
- responseSchema?: ISynovaJsonSchema;
180
+ responseSchema?: IJsonSchema;
181
+ /** Session ID for trace grouping (enables multi-call trace view in observability) */
182
+ sessionId?: string;
123
183
  }
124
184
  interface ISynovaExecutionUsage {
125
185
  /** Usage type: 'tokens' for LLM, 'images' for image generation, 'time' for time-based billing */
@@ -152,8 +212,10 @@ interface ISynovaExecutionErrorDetails {
152
212
  promptId?: string;
153
213
  /** Prompt version (if execution was via prompt) */
154
214
  promptVersion?: string;
155
- /** Execution log ID for debugging */
215
+ /** @deprecated Use spanDataId instead */
156
216
  executionLogId?: string;
217
+ /** SpanData ID for debugging */
218
+ spanDataId?: string;
157
219
  /** Input tokens count (for CONTEXT_TOO_LONG errors) */
158
220
  inputTokens?: number;
159
221
  /** Model context window limit (for CONTEXT_TOO_LONG errors) */
@@ -202,6 +264,14 @@ interface ISynovaExecuteResponse {
202
264
  error?: ISynovaExecutionError;
203
265
  /** Execution usage statistics (tokens, images, or time-based) */
204
266
  executionUsage?: ISynovaExecutionUsage;
267
+ /** @deprecated Use spanDataId instead */
268
+ executionId?: string;
269
+ /** SpanData ID (contains execution details: messages, response, usage) */
270
+ spanDataId?: string;
271
+ /** Trace ID (for observability - grouping multiple calls) */
272
+ traceId?: string;
273
+ /** Span ID (for observability - individual call within trace) */
274
+ spanId?: string;
205
275
  }
206
276
  interface ISynovaModelCapabilities {
207
277
  text_generation?: boolean;
@@ -276,6 +346,81 @@ interface ISynovaUploadOptions {
276
346
  /** Project ID to associate files with */
277
347
  projectId: string;
278
348
  }
349
+ type TSynovaSpanType = 'generation' | 'tool' | 'retriever' | 'embedding' | 'custom';
350
+ type TSynovaSpanStatus = 'pending' | 'completed' | 'error';
351
+ type TSynovaSpanLevel = 'default' | 'debug' | 'warning' | 'error';
352
+ interface ISynovaCreateSpanOptions {
353
+ /** Span type */
354
+ type: TSynovaSpanType;
355
+ /** Parent span ID (for nested spans) */
356
+ parentSpanId?: string;
357
+ /** Span name (defaults to toolName for tool spans) */
358
+ name?: string;
359
+ /** Input data (for custom/retriever/embedding spans) */
360
+ input?: unknown;
361
+ /** Tool name (for tool spans) */
362
+ toolName?: string;
363
+ /** Tool arguments (for tool spans) */
364
+ toolArguments?: Record<string, unknown>;
365
+ /** Custom metadata */
366
+ metadata?: Record<string, string>;
367
+ }
368
+ interface ISynovaEndSpanOptions {
369
+ /** Span completion status */
370
+ status?: TSynovaSpanStatus;
371
+ /** Span level (for filtering/highlighting) */
372
+ level?: TSynovaSpanLevel;
373
+ /** Status message (e.g., error message) */
374
+ statusMessage?: string;
375
+ /** Output data (for custom/retriever/embedding spans) */
376
+ output?: unknown;
377
+ /** Tool execution result (for tool spans) */
378
+ toolResult?: unknown;
379
+ /** Duration in milliseconds (auto-calculated if not provided) */
380
+ durationMs?: number;
381
+ }
382
+ interface ISynovaSpanData {
383
+ id: string;
384
+ type: TSynovaSpanType;
385
+ toolName?: string;
386
+ toolArguments?: unknown;
387
+ toolResult?: unknown;
388
+ input?: unknown;
389
+ output?: unknown;
390
+ messages?: ISynovaMessage[];
391
+ response?: {
392
+ type: TSynovaResponseType;
393
+ content?: string;
394
+ object?: unknown;
395
+ toolCalls?: ISynovaToolCall[];
396
+ };
397
+ usage?: ISynovaExecutionUsage;
398
+ provider?: string;
399
+ model?: string;
400
+ executionTimeMs?: number;
401
+ errorMessage?: string;
402
+ metadata?: Record<string, string>;
403
+ createdAt: string;
404
+ }
405
+ interface ISynovaSpan {
406
+ id: string;
407
+ traceId: string;
408
+ parentSpanId?: string;
409
+ type: TSynovaSpanType;
410
+ name?: string;
411
+ status: TSynovaSpanStatus;
412
+ level: TSynovaSpanLevel;
413
+ statusMessage?: string;
414
+ startTime: string;
415
+ endTime?: string;
416
+ durationMs?: number;
417
+ provider?: string;
418
+ model?: string;
419
+ metadata?: Record<string, string>;
420
+ createdAt: string;
421
+ /** SpanData (included when fetching span details) */
422
+ spanData?: ISynovaSpanData;
423
+ }
279
424
  interface IApiErrorResponse {
280
425
  code: string;
281
426
  httpCode: number;
@@ -303,7 +448,7 @@ interface IHttpClientConfig {
303
448
  logger: ISynovaLogger;
304
449
  }
305
450
  interface IRequestOptions {
306
- method: 'GET' | 'POST' | 'PUT' | 'DELETE';
451
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
307
452
  path: string;
308
453
  body?: unknown;
309
454
  query?: Record<string, string | undefined>;
@@ -327,97 +472,82 @@ declare class HttpClient {
327
472
  private log;
328
473
  }
329
474
 
475
+ /**
476
+ * Execute options with optional responseClass for typed responses
477
+ */
478
+ interface ISynovaExecuteTypedOptions<T> extends Omit<ISynovaExecuteOptions, 'responseSchema'> {
479
+ /** Class to use for response typing and schema generation */
480
+ responseClass: TClassConstructor<T>;
481
+ /** Enable class-validator validation (default: true) */
482
+ validate?: boolean;
483
+ }
330
484
  declare class PromptsResource {
331
485
  private readonly http;
332
486
  constructor(http: HttpClient);
333
487
  /**
334
488
  * Get a prompt by ID (returns version with 'latest' tag)
335
- *
336
- * @param promptId - The prompt ID (e.g., 'prm_abc123')
337
- * @param options - Optional settings
338
- * @returns The prompt data
489
+ */
490
+ get(promptId: string, options?: ISynovaGetPromptOptions): Promise<ISynovaPrompt>;
491
+ /**
492
+ * Execute a prompt with typed response
339
493
  *
340
494
  * @example
341
495
  * ```ts
342
- * // Get default (latest) version
343
- * const prompt = await client.prompts.get('prm_abc123');
344
- *
345
- * // Get by specific tag
346
- * const production = await client.prompts.get('prm_abc123', { tag: 'production' });
347
- *
348
- * // Get specific version
349
- * const v2 = await client.prompts.get('prm_abc123', { version: '2.0.0' });
496
+ * // With responseClass - returns typed object
497
+ * const topic = await client.prompts.execute('prm_abc123', {
498
+ * provider: 'openai',
499
+ * model: 'gpt-4o',
500
+ * responseClass: TopicDto,
501
+ * });
502
+ * console.log(topic.title); // Typed as string
350
503
  * ```
351
504
  */
352
- get(promptId: string, options?: ISynovaGetPromptOptions): Promise<ISynovaPrompt>;
505
+ execute<T>(promptId: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
353
506
  /**
354
- * Execute a prompt with 'latest' tag
355
- *
356
- * @param promptId - The prompt ID
357
- * @param options - Execution options including provider, model and variables
358
- * @returns The execution response
507
+ * Execute a prompt
359
508
  *
360
509
  * @example
361
510
  * ```ts
511
+ * // Without responseClass - returns ISynovaExecuteResponse
362
512
  * const result = await client.prompts.execute('prm_abc123', {
363
513
  * provider: 'openai',
364
514
  * model: 'gpt-4o',
365
- * variables: { topic: 'TypeScript' },
366
515
  * });
367
- *
368
516
  * if (result.type === 'message') {
369
517
  * console.log(result.content);
370
518
  * }
371
- *
372
- * // Image generation
373
- * const imageResult = await client.prompts.execute('prm_image123', {
374
- * provider: 'google',
375
- * model: 'gemini-2.0-flash-exp',
376
- * variables: { style: 'modern' },
377
- * });
378
- *
379
- * if (imageResult.type === 'image') {
380
- * console.log('Generated images:', imageResult.files);
381
- * }
382
519
  * ```
383
520
  */
384
521
  execute(promptId: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
522
+ /**
523
+ * Execute a prompt by tag with typed response
524
+ */
525
+ executeByTag<T>(promptId: string, tag: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
385
526
  /**
386
527
  * Execute a prompt by tag
387
- *
388
- * @param promptId - The prompt ID
389
- * @param tag - The tag (e.g., 'latest', 'production', 'staging')
390
- * @param options - Execution options
391
- * @returns The execution response
392
- *
393
- * @example
394
- * ```ts
395
- * const result = await client.prompts.executeByTag('prm_abc123', 'production', {
396
- * provider: 'openai',
397
- * model: 'gpt-4o',
398
- * variables: { topic: 'TypeScript' },
399
- * });
400
- * ```
401
528
  */
402
529
  executeByTag(promptId: string, tag: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
530
+ /**
531
+ * Execute a prompt by version with typed response
532
+ */
533
+ executeByVersion<T>(promptId: string, version: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
403
534
  /**
404
535
  * Execute a prompt by version
405
- *
406
- * @param promptId - The prompt ID
407
- * @param version - The semantic version (e.g., '1.0.0', '2.1.0')
408
- * @param options - Execution options
409
- * @returns The execution response
410
- *
411
- * @example
412
- * ```ts
413
- * const result = await client.prompts.executeByVersion('prm_abc123', '1.2.0', {
414
- * provider: 'openai',
415
- * model: 'gpt-4o',
416
- * variables: { topic: 'TypeScript' },
417
- * });
418
- * ```
419
536
  */
420
537
  executeByVersion(promptId: string, version: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
538
+ /**
539
+ * Execute raw request without typed response
540
+ * @throws {ExecutionSynovaError} If LLM returns an error
541
+ */
542
+ private executeRaw;
543
+ /**
544
+ * Execute with typed response class
545
+ */
546
+ private executeTyped;
547
+ /**
548
+ * Validate object using class-validator
549
+ */
550
+ private validateObject;
421
551
  }
422
552
 
423
553
  declare class ModelsResource {
@@ -513,6 +643,120 @@ declare class FilesResource {
513
643
  upload(files: (File | Blob)[], options: ISynovaUploadOptions): Promise<ISynovaUploadResponse>;
514
644
  }
515
645
 
646
+ /**
647
+ * Options for wrapping a function with span tracking
648
+ */
649
+ interface ISynovaWrapOptions {
650
+ /** Trace ID */
651
+ traceId: string;
652
+ /** Span type */
653
+ type: TSynovaSpanType;
654
+ /** Span name */
655
+ name?: string;
656
+ /** Parent span ID */
657
+ parentSpanId?: string;
658
+ /** Custom metadata */
659
+ metadata?: Record<string, string>;
660
+ }
661
+ /**
662
+ * Options for wrapping a tool function
663
+ */
664
+ interface ISynovaWrapToolOptions {
665
+ /** Trace ID */
666
+ traceId: string;
667
+ /** Tool name */
668
+ toolName: string;
669
+ /** Parent span ID */
670
+ parentSpanId?: string;
671
+ /** Custom metadata */
672
+ metadata?: Record<string, string>;
673
+ }
674
+ /**
675
+ * Spans resource for observability
676
+ *
677
+ * @example
678
+ * ```ts
679
+ * // Manual: create and end span
680
+ * const span = await client.spans.create('trc_123', {
681
+ * type: 'tool',
682
+ * toolName: 'fetch_weather',
683
+ * toolArguments: { city: 'NYC' },
684
+ * });
685
+ * const result = await fetchWeather('NYC');
686
+ * await client.spans.end(span.id, { status: 'completed', toolResult: result });
687
+ *
688
+ * // Wrapper: automatic span lifecycle
689
+ * const weather = await client.spans.wrapTool(
690
+ * { traceId: 'trc_123', toolName: 'fetch_weather' },
691
+ * { city: 'NYC' },
692
+ * (args) => fetchWeather(args.city),
693
+ * );
694
+ *
695
+ * // Generic wrapper for custom spans
696
+ * const result = await client.spans.wrap(
697
+ * { traceId: 'trc_123', type: 'custom', name: 'validate' },
698
+ * { input: data },
699
+ * async () => validateData(data),
700
+ * );
701
+ * ```
702
+ */
703
+ declare class SpansResource {
704
+ private readonly http;
705
+ constructor(http: HttpClient);
706
+ /**
707
+ * Create a new span within a trace
708
+ *
709
+ * @param traceId - The trace ID to create span in
710
+ * @param options - Span creation options
711
+ * @returns Created span
712
+ */
713
+ create(traceId: string, options: ISynovaCreateSpanOptions): Promise<ISynovaSpan>;
714
+ /**
715
+ * End/complete a span
716
+ *
717
+ * @param spanId - The span ID to end
718
+ * @param options - Span end options
719
+ * @returns Updated span
720
+ */
721
+ end(spanId: string, options?: ISynovaEndSpanOptions): Promise<ISynovaSpan>;
722
+ /**
723
+ * Wrap an async function with automatic span tracking
724
+ *
725
+ * @param options - Span options (traceId, type, name, etc.)
726
+ * @param input - Input data to record in span
727
+ * @param fn - Async function to execute
728
+ * @returns Result of the function
729
+ *
730
+ * @example
731
+ * ```ts
732
+ * const result = await client.spans.wrap(
733
+ * { traceId: 'trc_123', type: 'retriever', name: 'vector_search' },
734
+ * { query: 'how to...', topK: 5 },
735
+ * async () => vectorDb.search(query),
736
+ * );
737
+ * ```
738
+ */
739
+ wrap<T>(options: ISynovaWrapOptions, input: unknown, fn: () => Promise<T>): Promise<T>;
740
+ /**
741
+ * Wrap a tool function with automatic span tracking
742
+ *
743
+ * @param options - Tool span options (traceId, toolName, etc.)
744
+ * @param args - Tool arguments to record
745
+ * @param fn - Tool function to execute
746
+ * @returns Result of the tool
747
+ *
748
+ * @example
749
+ * ```ts
750
+ * const weather = await client.spans.wrapTool(
751
+ * { traceId: 'trc_123', toolName: 'fetch_weather', parentSpanId: 'spn_abc' },
752
+ * { city: 'NYC' },
753
+ * async (args) => fetchWeather(args.city),
754
+ * );
755
+ * ```
756
+ */
757
+ wrapTool<TArgs extends Record<string, unknown>, TResult>(options: ISynovaWrapToolOptions, args: TArgs, fn: (args: TArgs) => Promise<TResult>): Promise<TResult>;
758
+ }
759
+
516
760
  /**
517
761
  * Synova Cloud SDK client
518
762
  *
@@ -562,6 +806,7 @@ declare class SynovaCloudSdk {
562
806
  readonly prompts: PromptsResource;
563
807
  readonly models: ModelsResource;
564
808
  readonly files: FilesResource;
809
+ readonly spans: SpansResource;
565
810
  private readonly http;
566
811
  /**
567
812
  * Create a new Synova Cloud SDK client
@@ -632,5 +877,336 @@ declare class NetworkSynovaError extends SynovaError {
632
877
  readonly cause?: Error;
633
878
  constructor(message: string, cause?: Error);
634
879
  }
880
+ /**
881
+ * Error thrown when LLM execution fails (returned in response with type='error')
882
+ */
883
+ declare class ExecutionSynovaError extends SynovaError {
884
+ readonly code: string;
885
+ readonly provider?: string;
886
+ readonly retryable: boolean;
887
+ readonly retryAfterMs?: number;
888
+ readonly details?: ISynovaExecutionError['details'];
889
+ constructor(error: ISynovaExecutionError);
890
+ }
891
+ /**
892
+ * Validation violation details
893
+ */
894
+ interface IValidationViolation {
895
+ property: string;
896
+ constraints: Record<string, string>;
897
+ value?: unknown;
898
+ }
899
+ /**
900
+ * Error thrown when LLM response fails class-validator validation
901
+ */
902
+ declare class ValidationSynovaError extends SynovaError {
903
+ readonly violations: IValidationViolation[];
904
+ constructor(violations: IValidationViolation[]);
905
+ }
906
+
907
+ /**
908
+ * Generates JSON Schema from TypeScript classes decorated with schema decorators.
909
+ *
910
+ * @example
911
+ * ```typescript
912
+ * import { ClassSchema, Description, Example, SchemaMin, SchemaMax } from '@synova-cloud/sdk';
913
+ *
914
+ * class User {
915
+ * @Description('User ID')
916
+ * @Example('usr_123')
917
+ * id: string;
918
+ *
919
+ * @Description('User age')
920
+ * @SchemaMin(0)
921
+ * @SchemaMax(150)
922
+ * age: number;
923
+ * }
924
+ *
925
+ * const schema = ClassSchema.generate(User);
926
+ * ```
927
+ */
928
+ declare class ClassSchema {
929
+ /**
930
+ * Generate JSON Schema from a class
931
+ */
932
+ static generate<T>(targetClass: TClassConstructor<T>, options?: IGenerateSchemaOptions): IJsonSchema;
933
+ /**
934
+ * Get all properties with their schemas
935
+ */
936
+ private static getProperties;
937
+ /**
938
+ * Get property names from class-validator metadata
939
+ */
940
+ private static getClassValidatorProperties;
941
+ /**
942
+ * Get property names from our decorator metadata
943
+ */
944
+ private static getDecoratorProperties;
945
+ /**
946
+ * Get JSON Schema for a single property
947
+ */
948
+ private static getPropertySchema;
949
+ /**
950
+ * Get base schema from TypeScript type
951
+ */
952
+ private static getBaseTypeSchema;
953
+ /**
954
+ * Get schema for array items
955
+ */
956
+ private static getArrayItemSchema;
957
+ /**
958
+ * Apply class-validator constraints to schema
959
+ */
960
+ private static applyClassValidatorConstraints;
961
+ /**
962
+ * Apply a single class-validator constraint
963
+ */
964
+ private static applyValidationConstraint;
965
+ /**
966
+ * Apply our decorator metadata to schema.
967
+ * Our decorators take precedence over class-validator if both are used.
968
+ */
969
+ private static applyDecoratorMetadata;
970
+ /**
971
+ * Get required properties (properties without @IsOptional)
972
+ */
973
+ private static getRequiredProperties;
974
+ }
975
+
976
+ /**
977
+ * Adds a description to the property schema.
978
+ * Helps LLMs understand the expected content.
979
+ *
980
+ * @example
981
+ * ```typescript
982
+ * class Article {
983
+ * @Description('SEO-optimized article title, 50-60 characters')
984
+ * title: string;
985
+ * }
986
+ * ```
987
+ */
988
+ declare function Description(description: string): PropertyDecorator;
989
+ /**
990
+ * Adds example values to the property schema.
991
+ * Helps LLMs understand the expected format.
992
+ *
993
+ * @example
994
+ * ```typescript
995
+ * class Article {
996
+ * @Example('How to Optimize SQL Queries', '10 Tips for Better Code')
997
+ * title: string;
998
+ * }
999
+ * ```
1000
+ */
1001
+ declare function Example(...examples: unknown[]): PropertyDecorator;
1002
+ /**
1003
+ * Sets the default value for the property.
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * class Settings {
1008
+ * @Default('en')
1009
+ * language: string;
1010
+ * }
1011
+ * ```
1012
+ */
1013
+ declare function Default(value: unknown): PropertyDecorator;
1014
+ /**
1015
+ * Sets the type of array items.
1016
+ * Required since TypeScript loses array item types at runtime.
1017
+ *
1018
+ * @example
1019
+ * ```typescript
1020
+ * class Article {
1021
+ * @ArrayItems(String)
1022
+ * keywords: string[];
1023
+ *
1024
+ * @ArrayItems(Comment)
1025
+ * comments: Comment[];
1026
+ * }
1027
+ * ```
1028
+ */
1029
+ declare function ArrayItems(itemType: TClassConstructor | StringConstructor | NumberConstructor | BooleanConstructor): PropertyDecorator;
1030
+ /**
1031
+ * Sets semantic format for string (email, uri, uuid, date-time, etc.).
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * class User {
1036
+ * @Format('email')
1037
+ * email: string;
1038
+ *
1039
+ * @Format('date-time')
1040
+ * createdAt: string;
1041
+ * }
1042
+ * ```
1043
+ */
1044
+ declare function Format(format: TJsonSchemaFormat): PropertyDecorator;
1045
+ /**
1046
+ * Marks the property as nullable (can be null).
1047
+ *
1048
+ * @example
1049
+ * ```typescript
1050
+ * class User {
1051
+ * @Nullable()
1052
+ * middleName: string | null;
1053
+ * }
1054
+ * ```
1055
+ */
1056
+ declare function Nullable(): PropertyDecorator;
1057
+ /**
1058
+ * Sets minimum string length.
1059
+ *
1060
+ * @example
1061
+ * ```typescript
1062
+ * class User {
1063
+ * @SchemaMinLength(3)
1064
+ * username: string;
1065
+ * }
1066
+ * ```
1067
+ */
1068
+ declare function SchemaMinLength(length: number): PropertyDecorator;
1069
+ /**
1070
+ * Sets maximum string length.
1071
+ *
1072
+ * @example
1073
+ * ```typescript
1074
+ * class User {
1075
+ * @SchemaMaxLength(100)
1076
+ * bio: string;
1077
+ * }
1078
+ * ```
1079
+ */
1080
+ declare function SchemaMaxLength(length: number): PropertyDecorator;
1081
+ /**
1082
+ * Sets regex pattern for string validation.
1083
+ *
1084
+ * @example
1085
+ * ```typescript
1086
+ * class User {
1087
+ * @SchemaPattern('^[a-z0-9_]+$')
1088
+ * username: string;
1089
+ * }
1090
+ * ```
1091
+ */
1092
+ declare function SchemaPattern(pattern: string): PropertyDecorator;
1093
+ /**
1094
+ * Sets minimum value (inclusive).
1095
+ *
1096
+ * @example
1097
+ * ```typescript
1098
+ * class Product {
1099
+ * @SchemaMin(0)
1100
+ * price: number;
1101
+ * }
1102
+ * ```
1103
+ */
1104
+ declare function SchemaMin(value: number): PropertyDecorator;
1105
+ /**
1106
+ * Sets maximum value (inclusive).
1107
+ *
1108
+ * @example
1109
+ * ```typescript
1110
+ * class Rating {
1111
+ * @SchemaMax(5)
1112
+ * score: number;
1113
+ * }
1114
+ * ```
1115
+ */
1116
+ declare function SchemaMax(value: number): PropertyDecorator;
1117
+ /**
1118
+ * Sets minimum value (exclusive).
1119
+ *
1120
+ * @example
1121
+ * ```typescript
1122
+ * class Discount {
1123
+ * @ExclusiveMin(0) // must be > 0
1124
+ * percentage: number;
1125
+ * }
1126
+ * ```
1127
+ */
1128
+ declare function ExclusiveMin(value: number): PropertyDecorator;
1129
+ /**
1130
+ * Sets maximum value (exclusive).
1131
+ *
1132
+ * @example
1133
+ * ```typescript
1134
+ * class Probability {
1135
+ * @ExclusiveMax(1) // must be < 1
1136
+ * value: number;
1137
+ * }
1138
+ * ```
1139
+ */
1140
+ declare function ExclusiveMax(value: number): PropertyDecorator;
1141
+ /**
1142
+ * Value must be a multiple of this number.
1143
+ *
1144
+ * @example
1145
+ * ```typescript
1146
+ * class Currency {
1147
+ * @MultipleOf(0.01)
1148
+ * amount: number;
1149
+ * }
1150
+ * ```
1151
+ */
1152
+ declare function MultipleOf(value: number): PropertyDecorator;
1153
+ /**
1154
+ * Sets minimum array length.
1155
+ *
1156
+ * @example
1157
+ * ```typescript
1158
+ * class Order {
1159
+ * @SchemaMinItems(1)
1160
+ * items: OrderItem[];
1161
+ * }
1162
+ * ```
1163
+ */
1164
+ declare function SchemaMinItems(count: number): PropertyDecorator;
1165
+ /**
1166
+ * Sets maximum array length.
1167
+ *
1168
+ * @example
1169
+ * ```typescript
1170
+ * class Article {
1171
+ * @SchemaMaxItems(10)
1172
+ * tags: string[];
1173
+ * }
1174
+ * ```
1175
+ */
1176
+ declare function SchemaMaxItems(count: number): PropertyDecorator;
1177
+ /**
1178
+ * Requires all array items to be unique.
1179
+ *
1180
+ * @example
1181
+ * ```typescript
1182
+ * class User {
1183
+ * @SchemaUniqueItems()
1184
+ * roles: string[];
1185
+ * }
1186
+ * ```
1187
+ */
1188
+ declare function SchemaUniqueItems(): PropertyDecorator;
1189
+ /**
1190
+ * Sets allowed enum values.
1191
+ *
1192
+ * @example
1193
+ * ```typescript
1194
+ * class User {
1195
+ * @SchemaEnum(['admin', 'user', 'guest'])
1196
+ * role: string;
1197
+ * }
1198
+ * ```
1199
+ *
1200
+ * With TypeScript enum:
1201
+ * ```typescript
1202
+ * enum Status { Active = 'active', Inactive = 'inactive' }
1203
+ *
1204
+ * class User {
1205
+ * @SchemaEnum(Object.values(Status))
1206
+ * status: Status;
1207
+ * }
1208
+ * ```
1209
+ */
1210
+ declare function SchemaEnum(values: (string | number | boolean | null)[]): PropertyDecorator;
635
1211
 
636
- export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaProviderResponse, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, NetworkSynovaError, NotFoundSynovaError, RateLimitSynovaError, ServerSynovaError, SynovaCloudSdk, SynovaError, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaUsageType, TimeoutSynovaError };
1212
+ export { ApiSynovaError, ArrayItems, AuthSynovaError, ClassSchema, Default, Description, Example, ExclusiveMax, ExclusiveMin, ExecutionSynovaError, Format, type IGenerateSchemaOptions, type IJsonSchema, type ISynovaConfig, type ISynovaCreateSpanOptions, type ISynovaEndSpanOptions, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecuteTypedOptions, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaProviderResponse, type ISynovaRetryConfig, type ISynovaSpan, type ISynovaSpanData, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, type ISynovaWrapOptions, type ISynovaWrapToolOptions, type IValidationViolation, MultipleOf, NetworkSynovaError, NotFoundSynovaError, Nullable, RateLimitSynovaError, SCHEMA_METADATA_KEYS, SchemaEnum, SchemaMax, SchemaMaxItems, SchemaMaxLength, SchemaMin, SchemaMinItems, SchemaMinLength, SchemaPattern, SchemaUniqueItems, ServerSynovaError, SynovaCloudSdk, SynovaError, type TClassConstructor, type TJsonSchemaFormat, type TJsonSchemaType, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaSpanLevel, type TSynovaSpanStatus, type TSynovaSpanType, type TSynovaUsageType, TimeoutSynovaError, ValidationSynovaError };