@veruna/api-contracts 1.0.50 → 1.0.52

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 (33) hide show
  1. package/build/locales/validation.d.ts +26 -0
  2. package/build/locales/validation.js +28 -0
  3. package/build/v1/ai/index.d.ts +1 -0
  4. package/build/v1/ai/index.js +1 -0
  5. package/build/v1/ai/plugins.types.d.ts +24 -0
  6. package/build/v1/ai/plugins.types.js +28 -0
  7. package/build/v1/ai-model/admin/commands/create-model.command.d.ts +8 -0
  8. package/build/v1/ai-model/admin/commands/update-model.command.d.ts +8 -0
  9. package/build/v1/ai-model/admin/queries/get-model.query.d.ts +4 -0
  10. package/build/v1/ai-model/admin/queries/get-models.query.d.ts +4 -0
  11. package/build/v1/ai-model/ai-model.errors.d.ts +2 -1
  12. package/build/v1/ai-model/ai-model.errors.js +5 -0
  13. package/build/v1/ai-model/public/queries/get-active-models.query.d.ts +4 -0
  14. package/build/v1/ai-model/public/queries/get-models-list.query.d.ts +4 -0
  15. package/build/v1/ai-model/schemas/create-model-request.schema.d.ts +4 -0
  16. package/build/v1/ai-model/schemas/create-model-request.schema.js +2 -0
  17. package/build/v1/ai-model/schemas/model-response.schema.d.ts +12 -0
  18. package/build/v1/ai-model/schemas/model-response.schema.js +2 -0
  19. package/build/v1/ai-model/schemas/models-list-response.schema.d.ts +12 -0
  20. package/build/v1/ai-model/schemas/unreg-models-list-response.schema.d.ts +12 -0
  21. package/build/v1/ai-model/schemas/update-model-request.schema.d.ts +4 -0
  22. package/build/v1/ai-model/schemas/update-model-request.schema.js +2 -0
  23. package/build/v1/ai-model/unreg/queries/get-models-list.query.d.ts +4 -0
  24. package/build/v1/message/commands/create-message.command.d.ts +8 -0
  25. package/build/v1/message/message.errors.d.ts +2 -1
  26. package/build/v1/message/message.errors.js +5 -0
  27. package/build/v1/message/schemas/create-message-request.schema.d.ts +1 -0
  28. package/build/v1/message/schemas/create-message-request.schema.js +2 -0
  29. package/build/v1/message/schemas/message-role.enum.d.ts +2 -1
  30. package/build/v1/message/schemas/message-role.enum.js +1 -0
  31. package/build/v1/message/schemas/stream-events.schema.d.ts +20 -0
  32. package/build/v1/message/schemas/stream-events.schema.js +14 -1
  33. package/package.json +1 -1
@@ -288,6 +288,9 @@ export declare const validationMessages: {
288
288
  readonly min: "Message text is required";
289
289
  readonly max: "Message text is too long";
290
290
  };
291
+ readonly plugins: {
292
+ readonly invalid: "Invalid plugin ID";
293
+ };
291
294
  };
292
295
  readonly RateMessageRequest: {
293
296
  readonly rating: {
@@ -668,6 +671,16 @@ export declare const validationMessages: {
668
671
  readonly invalid: "Invalid UTM campaign";
669
672
  };
670
673
  };
674
+ readonly PluginConfig: {
675
+ readonly id: {
676
+ readonly invalid: "Invalid plugin ID";
677
+ };
678
+ readonly price: {
679
+ readonly required: "Plugin price is required";
680
+ readonly invalid: "Plugin price must be an integer";
681
+ readonly min: "Plugin price must be non-negative";
682
+ };
683
+ };
671
684
  readonly PaginationQuery: {
672
685
  readonly page: {
673
686
  readonly invalid: "Page must be a positive integer";
@@ -963,6 +976,9 @@ export declare const validationMessages: {
963
976
  readonly min: "Введите сообщение";
964
977
  readonly max: "Сообщение слишком длинное";
965
978
  };
979
+ readonly plugins: {
980
+ readonly invalid: "Некорректный ID плагина";
981
+ };
966
982
  };
967
983
  readonly RateMessageRequest: {
968
984
  readonly rating: {
@@ -1343,6 +1359,16 @@ export declare const validationMessages: {
1343
1359
  readonly invalid: "Некорректный UTM campaign";
1344
1360
  };
1345
1361
  };
1362
+ readonly PluginConfig: {
1363
+ readonly id: {
1364
+ readonly invalid: "Некорректный ID плагина";
1365
+ };
1366
+ readonly price: {
1367
+ readonly required: "Укажите цену плагина";
1368
+ readonly invalid: "Цена плагина должна быть целым числом";
1369
+ readonly min: "Цена плагина должна быть неотрицательной";
1370
+ };
1371
+ };
1346
1372
  readonly PaginationQuery: {
1347
1373
  readonly page: {
1348
1374
  readonly invalid: "Страница должна быть положительным целым числом";
@@ -297,6 +297,9 @@ exports.validationMessages = {
297
297
  min: 'Message text is required',
298
298
  max: 'Message text is too long',
299
299
  },
300
+ plugins: {
301
+ invalid: 'Invalid plugin ID',
302
+ },
300
303
  },
301
304
  RateMessageRequest: {
302
305
  rating: {
@@ -685,6 +688,17 @@ exports.validationMessages = {
685
688
  invalid: 'Invalid UTM campaign',
686
689
  },
687
690
  },
691
+ // ==================== PLUGINS ====================
692
+ PluginConfig: {
693
+ id: {
694
+ invalid: 'Invalid plugin ID',
695
+ },
696
+ price: {
697
+ required: 'Plugin price is required',
698
+ invalid: 'Plugin price must be an integer',
699
+ min: 'Plugin price must be non-negative',
700
+ },
701
+ },
688
702
  // ==================== SHARED ====================
689
703
  PaginationQuery: {
690
704
  page: {
@@ -986,6 +1000,9 @@ exports.validationMessages = {
986
1000
  min: 'Введите сообщение',
987
1001
  max: 'Сообщение слишком длинное',
988
1002
  },
1003
+ plugins: {
1004
+ invalid: 'Некорректный ID плагина',
1005
+ },
989
1006
  },
990
1007
  RateMessageRequest: {
991
1008
  rating: {
@@ -1374,6 +1391,17 @@ exports.validationMessages = {
1374
1391
  invalid: 'Некорректный UTM campaign',
1375
1392
  },
1376
1393
  },
1394
+ // ==================== PLUGINS ====================
1395
+ PluginConfig: {
1396
+ id: {
1397
+ invalid: 'Некорректный ID плагина',
1398
+ },
1399
+ price: {
1400
+ required: 'Укажите цену плагина',
1401
+ invalid: 'Цена плагина должна быть целым числом',
1402
+ min: 'Цена плагина должна быть неотрицательной',
1403
+ },
1404
+ },
1377
1405
  // ==================== SHARED ====================
1378
1406
  PaginationQuery: {
1379
1407
  page: {
@@ -1 +1,2 @@
1
1
  export * from './ai.errors';
2
+ export * from './plugins.types';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ai.errors"), exports);
18
+ __exportStar(require("./plugins.types"), exports);
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Available plugin IDs
4
+ */
5
+ export declare enum PluginId {
6
+ WEB = "web"
7
+ }
8
+ /**
9
+ * Plugin ID Schema with i18n errors
10
+ */
11
+ export declare const PluginIdSchema: z.ZodEnum<typeof PluginId>;
12
+ /**
13
+ * Plugin config stored in DB (model's available plugins)
14
+ */
15
+ export declare const PluginConfigSchema: z.ZodObject<{
16
+ id: z.ZodEnum<typeof PluginId>;
17
+ price: z.ZodNumber;
18
+ }, z.core.$strip>;
19
+ export type PluginConfig = z.infer<typeof PluginConfigSchema>;
20
+ export declare const PluginsConfigArraySchema: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodEnum<typeof PluginId>;
22
+ price: z.ZodNumber;
23
+ }, z.core.$strip>>;
24
+ export type PluginsConfigArray = z.infer<typeof PluginsConfigArraySchema>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginsConfigArraySchema = exports.PluginConfigSchema = exports.PluginIdSchema = exports.PluginId = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Available plugin IDs
7
+ */
8
+ var PluginId;
9
+ (function (PluginId) {
10
+ PluginId["WEB"] = "web";
11
+ })(PluginId || (exports.PluginId = PluginId = {}));
12
+ /**
13
+ * Plugin ID Schema with i18n errors
14
+ */
15
+ exports.PluginIdSchema = zod_1.z.nativeEnum(PluginId, {
16
+ error: 'PluginConfig.id.invalid',
17
+ });
18
+ /**
19
+ * Plugin config stored in DB (model's available plugins)
20
+ */
21
+ exports.PluginConfigSchema = zod_1.z.object({
22
+ id: exports.PluginIdSchema,
23
+ price: zod_1.z
24
+ .number({ error: 'PluginConfig.price.required' })
25
+ .int({ message: 'PluginConfig.price.invalid' })
26
+ .min(0, { message: 'PluginConfig.price.min' }),
27
+ });
28
+ exports.PluginsConfigArraySchema = zod_1.z.array(exports.PluginConfigSchema);
@@ -21,6 +21,10 @@ export declare namespace AdminAiModelCreateCommand {
21
21
  modelType: z.ZodDefault<z.ZodEnum<typeof import("../../schemas").ModelType>>;
22
22
  systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
23
  isAvailableForUnreg: z.ZodDefault<z.ZodBoolean>;
24
+ plugins: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
26
+ price: z.ZodNumber;
27
+ }, z.core.$strip>>>;
24
28
  }, z.core.$strip>;
25
29
  const Response: z.ZodObject<{
26
30
  uuid: z.ZodString;
@@ -43,6 +47,10 @@ export declare namespace AdminAiModelCreateCommand {
43
47
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
44
48
  systemPrompt: z.ZodNullable<z.ZodString>;
45
49
  isAvailableForUnreg: z.ZodBoolean;
50
+ plugins: z.ZodArray<z.ZodObject<{
51
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
52
+ price: z.ZodNumber;
53
+ }, z.core.$strip>>;
46
54
  createdAt: z.ZodString;
47
55
  updatedAt: z.ZodString;
48
56
  }, z.core.$strip>;
@@ -21,6 +21,10 @@ export declare namespace AdminAiModelUpdateCommand {
21
21
  modelType: z.ZodOptional<z.ZodEnum<typeof import("../../schemas").ModelType>>;
22
22
  systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
23
  isAvailableForUnreg: z.ZodOptional<z.ZodBoolean>;
24
+ plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
26
+ price: z.ZodNumber;
27
+ }, z.core.$strip>>>;
24
28
  }, z.core.$strip>;
25
29
  const Response: z.ZodObject<{
26
30
  uuid: z.ZodString;
@@ -43,6 +47,10 @@ export declare namespace AdminAiModelUpdateCommand {
43
47
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
44
48
  systemPrompt: z.ZodNullable<z.ZodString>;
45
49
  isAvailableForUnreg: z.ZodBoolean;
50
+ plugins: z.ZodArray<z.ZodObject<{
51
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
52
+ price: z.ZodNumber;
53
+ }, z.core.$strip>>;
46
54
  createdAt: z.ZodString;
47
55
  updatedAt: z.ZodString;
48
56
  }, z.core.$strip>;
@@ -23,6 +23,10 @@ export declare namespace AdminAiModelGetModelQuery {
23
23
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
24
24
  systemPrompt: z.ZodNullable<z.ZodString>;
25
25
  isAvailableForUnreg: z.ZodBoolean;
26
+ plugins: z.ZodArray<z.ZodObject<{
27
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
28
+ price: z.ZodNumber;
29
+ }, z.core.$strip>>;
26
30
  createdAt: z.ZodString;
27
31
  updatedAt: z.ZodString;
28
32
  }, z.core.$strip>;
@@ -30,6 +30,10 @@ export declare namespace AdminAiModelGetModelsQuery {
30
30
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
31
31
  systemPrompt: z.ZodNullable<z.ZodString>;
32
32
  isAvailableForUnreg: z.ZodBoolean;
33
+ plugins: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
35
+ price: z.ZodNumber;
36
+ }, z.core.$strip>>;
33
37
  createdAt: z.ZodString;
34
38
  updatedAt: z.ZodString;
35
39
  }, z.core.$strip>>;
@@ -8,6 +8,7 @@ export declare enum AiModelErrorCode {
8
8
  INVALID_MODEL_TYPE = "INVALID_MODEL_TYPE",
9
9
  INVALID_API_PROVIDER = "INVALID_API_PROVIDER",
10
10
  INVALID_MODALITY = "INVALID_MODALITY",
11
- INVALID_SPEED = "INVALID_SPEED"
11
+ INVALID_SPEED = "INVALID_SPEED",
12
+ PLUGIN_NOT_AVAILABLE = "PLUGIN_NOT_AVAILABLE"
12
13
  }
13
14
  export declare const AI_MODEL_ERRORS: Record<AiModelErrorCode, ErrorMetadata>;
@@ -12,6 +12,7 @@ var AiModelErrorCode;
12
12
  AiModelErrorCode["INVALID_API_PROVIDER"] = "INVALID_API_PROVIDER";
13
13
  AiModelErrorCode["INVALID_MODALITY"] = "INVALID_MODALITY";
14
14
  AiModelErrorCode["INVALID_SPEED"] = "INVALID_SPEED";
15
+ AiModelErrorCode["PLUGIN_NOT_AVAILABLE"] = "PLUGIN_NOT_AVAILABLE";
15
16
  })(AiModelErrorCode || (exports.AiModelErrorCode = AiModelErrorCode = {}));
16
17
  exports.AI_MODEL_ERRORS = {
17
18
  [AiModelErrorCode.MODEL_NOT_FOUND]: {
@@ -50,4 +51,8 @@ exports.AI_MODEL_ERRORS = {
50
51
  code: AiModelErrorCode.INVALID_SPEED,
51
52
  statusCode: 400,
52
53
  },
54
+ [AiModelErrorCode.PLUGIN_NOT_AVAILABLE]: {
55
+ code: AiModelErrorCode.PLUGIN_NOT_AVAILABLE,
56
+ statusCode: 400,
57
+ },
53
58
  };
@@ -16,6 +16,10 @@ export declare namespace PublicAiModelGetActiveModelsQuery {
16
16
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
17
17
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
18
18
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
19
+ plugins: z.ZodArray<z.ZodObject<{
20
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
21
+ price: z.ZodNumber;
22
+ }, z.core.$strip>>;
19
23
  }, z.core.$strip>>;
20
24
  const URL: "/api/v1/ai-models/";
21
25
  const METHOD = HttpMethod.GET;
@@ -22,6 +22,10 @@ export declare namespace PublicAiModelGetModelsListQuery {
22
22
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
23
23
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
24
24
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
25
+ plugins: z.ZodArray<z.ZodObject<{
26
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
27
+ price: z.ZodNumber;
28
+ }, z.core.$strip>>;
25
29
  }, z.core.$strip>>;
26
30
  }, z.core.$strip>>;
27
31
  }, z.core.$strip>;
@@ -28,4 +28,8 @@ export declare const CreateModelRequestSchema: z.ZodObject<{
28
28
  modelType: z.ZodDefault<z.ZodEnum<typeof ModelType>>;
29
29
  systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
30
  isAvailableForUnreg: z.ZodDefault<z.ZodBoolean>;
31
+ plugins: z.ZodDefault<z.ZodArray<z.ZodObject<{
32
+ id: z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>;
33
+ price: z.ZodNumber;
34
+ }, z.core.$strip>>>;
31
35
  }, z.core.$strip>;
@@ -7,6 +7,7 @@ const model_mark_enum_1 = require("./model-mark.enum");
7
7
  const model_type_enum_1 = require("./model-type.enum");
8
8
  const api_provider_enum_1 = require("./api-provider.enum");
9
9
  const modality_enum_1 = require("./modality.enum");
10
+ const plugins_types_1 = require("../../ai/plugins.types");
10
11
  /**
11
12
  * Create Model Request Schema
12
13
  * Error messages: CreateModelRequest.{field}.{rule}
@@ -62,4 +63,5 @@ exports.CreateModelRequestSchema = zod_1.z.object({
62
63
  modelType: zod_1.z.nativeEnum(model_type_enum_1.ModelType).default(model_type_enum_1.ModelType.TEXT),
63
64
  systemPrompt: zod_1.z.string().nullable().optional(),
64
65
  isAvailableForUnreg: zod_1.z.boolean().default(false),
66
+ plugins: plugins_types_1.PluginsConfigArraySchema.default([]),
65
67
  });
@@ -28,6 +28,10 @@ export declare const ModelResponseSchema: z.ZodObject<{
28
28
  modelType: z.ZodEnum<typeof ModelType>;
29
29
  systemPrompt: z.ZodNullable<z.ZodString>;
30
30
  isAvailableForUnreg: z.ZodBoolean;
31
+ plugins: z.ZodArray<z.ZodObject<{
32
+ id: z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>;
33
+ price: z.ZodNumber;
34
+ }, z.core.$strip>>;
31
35
  createdAt: z.ZodString;
32
36
  updatedAt: z.ZodString;
33
37
  }, z.core.$strip>;
@@ -48,6 +52,10 @@ export declare const PublicModelResponseSchema: z.ZodObject<{
48
52
  inputModalities: z.ZodArray<z.ZodEnum<typeof Modality>>;
49
53
  outputModalities: z.ZodArray<z.ZodEnum<typeof Modality>>;
50
54
  modelType: z.ZodEnum<typeof ModelType>;
55
+ plugins: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>;
57
+ price: z.ZodNumber;
58
+ }, z.core.$strip>>;
51
59
  }, z.core.$strip>;
52
60
  /**
53
61
  * Unreg User AI Model Response Schema
@@ -67,5 +75,9 @@ export declare const UnregModelResponseSchema: z.ZodObject<{
67
75
  inputModalities: z.ZodArray<z.ZodEnum<typeof Modality>>;
68
76
  outputModalities: z.ZodArray<z.ZodEnum<typeof Modality>>;
69
77
  modelType: z.ZodEnum<typeof ModelType>;
78
+ plugins: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>;
80
+ price: z.ZodNumber;
81
+ }, z.core.$strip>>;
70
82
  access: z.ZodBoolean;
71
83
  }, z.core.$strip>;
@@ -8,6 +8,7 @@ const model_mark_enum_1 = require("./model-mark.enum");
8
8
  const model_type_enum_1 = require("./model-type.enum");
9
9
  const api_provider_enum_1 = require("./api-provider.enum");
10
10
  const modality_enum_1 = require("./modality.enum");
11
+ const plugins_types_1 = require("../../ai/plugins.types");
11
12
  /**
12
13
  * AI Model Response Schema (Admin - full data)
13
14
  */
@@ -32,6 +33,7 @@ exports.ModelResponseSchema = zod_1.z.object({
32
33
  modelType: zod_1.z.nativeEnum(model_type_enum_1.ModelType),
33
34
  systemPrompt: zod_1.z.string().nullable(),
34
35
  isAvailableForUnreg: zod_1.z.boolean(),
36
+ plugins: zod_1.z.array(plugins_types_1.PluginConfigSchema),
35
37
  createdAt: zod_1.z.string().regex(shared_1.DATETIME_REGEX),
36
38
  updatedAt: zod_1.z.string().regex(shared_1.DATETIME_REGEX),
37
39
  });
@@ -17,6 +17,10 @@ export declare const PublicModelInListSchema: z.ZodObject<{
17
17
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
18
18
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
19
19
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
20
+ plugins: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodEnum<typeof import("../..").PluginId>;
22
+ price: z.ZodNumber;
23
+ }, z.core.$strip>>;
20
24
  }, z.core.$strip>;
21
25
  /**
22
26
  * Public Provider with Models (picked from ProviderResponseSchema + models)
@@ -41,6 +45,10 @@ export declare const PublicProviderWithModelsSchema: z.ZodObject<{
41
45
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
42
46
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
43
47
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
48
+ plugins: z.ZodArray<z.ZodObject<{
49
+ id: z.ZodEnum<typeof import("../..").PluginId>;
50
+ price: z.ZodNumber;
51
+ }, z.core.$strip>>;
44
52
  }, z.core.$strip>>;
45
53
  }, z.core.$strip>;
46
54
  /**
@@ -66,6 +74,10 @@ export declare const ModelsListResponseSchema: z.ZodObject<{
66
74
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
67
75
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
68
76
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
77
+ plugins: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodEnum<typeof import("../..").PluginId>;
79
+ price: z.ZodNumber;
80
+ }, z.core.$strip>>;
69
81
  }, z.core.$strip>>;
70
82
  }, z.core.$strip>>;
71
83
  }, z.core.$strip>;
@@ -17,6 +17,10 @@ export declare const UnregModelInListSchema: z.ZodObject<{
17
17
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
18
18
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
19
19
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
20
+ plugins: z.ZodArray<z.ZodObject<{
21
+ id: z.ZodEnum<typeof import("../..").PluginId>;
22
+ price: z.ZodNumber;
23
+ }, z.core.$strip>>;
20
24
  access: z.ZodBoolean;
21
25
  }, z.core.$strip>;
22
26
  /**
@@ -41,6 +45,10 @@ export declare const UnregProviderWithModelsSchema: z.ZodObject<{
41
45
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
42
46
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
43
47
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
48
+ plugins: z.ZodArray<z.ZodObject<{
49
+ id: z.ZodEnum<typeof import("../..").PluginId>;
50
+ price: z.ZodNumber;
51
+ }, z.core.$strip>>;
44
52
  access: z.ZodBoolean;
45
53
  }, z.core.$strip>>;
46
54
  }, z.core.$strip>;
@@ -67,6 +75,10 @@ export declare const UnregModelsListResponseSchema: z.ZodObject<{
67
75
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
68
76
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("./modality.enum").Modality>>;
69
77
  modelType: z.ZodEnum<typeof import("./model-type.enum").ModelType>;
78
+ plugins: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodEnum<typeof import("../..").PluginId>;
80
+ price: z.ZodNumber;
81
+ }, z.core.$strip>>;
70
82
  access: z.ZodBoolean;
71
83
  }, z.core.$strip>>;
72
84
  }, z.core.$strip>>;
@@ -28,4 +28,8 @@ export declare const UpdateModelRequestSchema: z.ZodObject<{
28
28
  modelType: z.ZodOptional<z.ZodEnum<typeof ModelType>>;
29
29
  systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
30
  isAvailableForUnreg: z.ZodOptional<z.ZodBoolean>;
31
+ plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
32
+ id: z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>;
33
+ price: z.ZodNumber;
34
+ }, z.core.$strip>>>;
31
35
  }, z.core.$strip>;
@@ -7,6 +7,7 @@ const model_mark_enum_1 = require("./model-mark.enum");
7
7
  const model_type_enum_1 = require("./model-type.enum");
8
8
  const api_provider_enum_1 = require("./api-provider.enum");
9
9
  const modality_enum_1 = require("./modality.enum");
10
+ const plugins_types_1 = require("../../ai/plugins.types");
10
11
  /**
11
12
  * Update Model Request Schema
12
13
  * Error messages: UpdateModelRequest.{field}.{rule}
@@ -66,4 +67,5 @@ exports.UpdateModelRequestSchema = zod_1.z.object({
66
67
  modelType: zod_1.z.nativeEnum(model_type_enum_1.ModelType).optional(),
67
68
  systemPrompt: zod_1.z.string().nullable().optional(),
68
69
  isAvailableForUnreg: zod_1.z.boolean().optional(),
70
+ plugins: plugins_types_1.PluginsConfigArraySchema.optional(),
69
71
  });
@@ -22,6 +22,10 @@ export declare namespace UnregAiModelGetModelsListQuery {
22
22
  inputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
23
23
  outputModalities: z.ZodArray<z.ZodEnum<typeof import("../../schemas").Modality>>;
24
24
  modelType: z.ZodEnum<typeof import("../../schemas").ModelType>;
25
+ plugins: z.ZodArray<z.ZodObject<{
26
+ id: z.ZodEnum<typeof import("../../..").PluginId>;
27
+ price: z.ZodNumber;
28
+ }, z.core.$strip>>;
25
29
  access: z.ZodBoolean;
26
30
  }, z.core.$strip>>;
27
31
  }, z.core.$strip>>;
@@ -38,6 +38,7 @@ export declare namespace CreateMessageCommand {
38
38
  const Request: z.ZodObject<{
39
39
  aiModelId: z.ZodString;
40
40
  text: z.ZodString;
41
+ plugins: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof import("../..").PluginId>>>;
41
42
  }, z.core.$strip>;
42
43
  /** Discriminated union of all stream events */
43
44
  const StreamEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -89,6 +90,13 @@ export declare namespace CreateMessageCommand {
89
90
  chatId: z.ZodString;
90
91
  messageId: z.ZodString;
91
92
  type: z.ZodLiteral<import("../schemas").StreamEventType.IMAGE_GENERATION_START>;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ id: z.ZodNumber;
95
+ chatId: z.ZodString;
96
+ messageId: z.ZodString;
97
+ type: z.ZodLiteral<import("../schemas").StreamEventType.IMAGE_UPLOADED>;
98
+ imageUrl: z.ZodString;
99
+ imageIndex: z.ZodNumber;
92
100
  }, z.core.$strip>, z.ZodObject<{
93
101
  id: z.ZodNumber;
94
102
  chatId: z.ZodString;
@@ -12,6 +12,7 @@ export declare enum MessageErrorCode {
12
12
  AI_MODEL_NOT_FOUND = "AI_MODEL_NOT_FOUND",
13
13
  AI_MODEL_INACTIVE = "AI_MODEL_INACTIVE",
14
14
  AI_MODEL_NOT_AVAILABLE_FOR_UNREG = "AI_MODEL_NOT_AVAILABLE_FOR_UNREG",
15
- CANNOT_RATE_USER_MESSAGE = "CANNOT_RATE_USER_MESSAGE"
15
+ CANNOT_RATE_USER_MESSAGE = "CANNOT_RATE_USER_MESSAGE",
16
+ COMPACTION_FAILED = "COMPACTION_FAILED"
16
17
  }
17
18
  export declare const MESSAGE_ERRORS: Record<MessageErrorCode, ErrorMetadata>;
@@ -16,6 +16,7 @@ var MessageErrorCode;
16
16
  MessageErrorCode["AI_MODEL_INACTIVE"] = "AI_MODEL_INACTIVE";
17
17
  MessageErrorCode["AI_MODEL_NOT_AVAILABLE_FOR_UNREG"] = "AI_MODEL_NOT_AVAILABLE_FOR_UNREG";
18
18
  MessageErrorCode["CANNOT_RATE_USER_MESSAGE"] = "CANNOT_RATE_USER_MESSAGE";
19
+ MessageErrorCode["COMPACTION_FAILED"] = "COMPACTION_FAILED";
19
20
  })(MessageErrorCode || (exports.MessageErrorCode = MessageErrorCode = {}));
20
21
  exports.MESSAGE_ERRORS = {
21
22
  [MessageErrorCode.MESSAGE_NOT_FOUND]: {
@@ -70,4 +71,8 @@ exports.MESSAGE_ERRORS = {
70
71
  code: MessageErrorCode.CANNOT_RATE_USER_MESSAGE,
71
72
  statusCode: 400,
72
73
  },
74
+ [MessageErrorCode.COMPACTION_FAILED]: {
75
+ code: MessageErrorCode.COMPACTION_FAILED,
76
+ statusCode: 500,
77
+ },
73
78
  };
@@ -6,4 +6,5 @@ import { z } from 'zod';
6
6
  export declare const CreateMessageRequestSchema: z.ZodObject<{
7
7
  aiModelId: z.ZodString;
8
8
  text: z.ZodString;
9
+ plugins: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof import("../../ai/plugins.types").PluginId>>>;
9
10
  }, z.core.$strip>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateMessageRequestSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const shared_1 = require("../../../shared");
6
+ const plugins_types_1 = require("../../ai/plugins.types");
6
7
  /**
7
8
  * Create Message Request Schema
8
9
  * Error messages: CreateMessageRequest.{field}.{rule}
@@ -15,4 +16,5 @@ exports.CreateMessageRequestSchema = zod_1.z.object({
15
16
  .string({ error: 'CreateMessageRequest.text.required' })
16
17
  .min(1, { message: 'CreateMessageRequest.text.min' })
17
18
  .max(shared_1.MESSAGE_TEXT_MAX_LENGTH, { message: 'CreateMessageRequest.text.max' }),
19
+ plugins: zod_1.z.array(plugins_types_1.PluginIdSchema, { error: 'CreateMessageRequest.plugins.invalid' }).optional(),
18
20
  });
@@ -2,5 +2,6 @@ export declare enum MessageRole {
2
2
  SYSTEM = "system",
3
3
  AI = "ai",
4
4
  PROMO = "promo",
5
- USER = "user"
5
+ USER = "user",
6
+ COMPACT = "compact"
6
7
  }
@@ -7,4 +7,5 @@ var MessageRole;
7
7
  MessageRole["AI"] = "ai";
8
8
  MessageRole["PROMO"] = "promo";
9
9
  MessageRole["USER"] = "user";
10
+ MessageRole["COMPACT"] = "compact";
10
11
  })(MessageRole || (exports.MessageRole = MessageRole = {}));
@@ -16,6 +16,8 @@ export declare enum StreamEventType {
16
16
  STEP_DONE = "step_done",
17
17
  /** Image generation started */
18
18
  IMAGE_GENERATION_START = "image_generation_start",
19
+ /** Image uploaded to S3 */
20
+ IMAGE_UPLOADED = "image_uploaded",
19
21
  /** Stream completed successfully */
20
22
  DONE = "done",
21
23
  /** Error occurred during streaming */
@@ -114,6 +116,17 @@ export declare const StreamImageGenerationStartEventSchema: z.ZodObject<{
114
116
  messageId: z.ZodString;
115
117
  type: z.ZodLiteral<StreamEventType.IMAGE_GENERATION_START>;
116
118
  }, z.core.$strip>;
119
+ /**
120
+ * Image uploaded event - image has been uploaded to S3
121
+ */
122
+ export declare const StreamImageUploadedEventSchema: z.ZodObject<{
123
+ id: z.ZodNumber;
124
+ chatId: z.ZodString;
125
+ messageId: z.ZodString;
126
+ type: z.ZodLiteral<StreamEventType.IMAGE_UPLOADED>;
127
+ imageUrl: z.ZodString;
128
+ imageIndex: z.ZodNumber;
129
+ }, z.core.$strip>;
117
130
  /**
118
131
  * Discriminated union of all stream events
119
132
  * Use `type` field to narrow the type
@@ -167,6 +180,13 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
167
180
  chatId: z.ZodString;
168
181
  messageId: z.ZodString;
169
182
  type: z.ZodLiteral<StreamEventType.IMAGE_GENERATION_START>;
183
+ }, z.core.$strip>, z.ZodObject<{
184
+ id: z.ZodNumber;
185
+ chatId: z.ZodString;
186
+ messageId: z.ZodString;
187
+ type: z.ZodLiteral<StreamEventType.IMAGE_UPLOADED>;
188
+ imageUrl: z.ZodString;
189
+ imageIndex: z.ZodNumber;
170
190
  }, z.core.$strip>, z.ZodObject<{
171
191
  id: z.ZodNumber;
172
192
  chatId: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamEventSchema = exports.StreamImageGenerationStartEventSchema = exports.StreamStepDoneEventSchema = exports.StreamPromptGenerationEventSchema = exports.StreamImageEventSchema = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventType = void 0;
3
+ exports.StreamEventSchema = exports.StreamImageUploadedEventSchema = exports.StreamImageGenerationStartEventSchema = exports.StreamStepDoneEventSchema = exports.StreamPromptGenerationEventSchema = exports.StreamImageEventSchema = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const message_meta_schema_1 = require("./message-meta.schema");
6
6
  const generation_step_schema_1 = require("./generation-step.schema");
@@ -21,6 +21,8 @@ var StreamEventType;
21
21
  StreamEventType["STEP_DONE"] = "step_done";
22
22
  /** Image generation started */
23
23
  StreamEventType["IMAGE_GENERATION_START"] = "image_generation_start";
24
+ /** Image uploaded to S3 */
25
+ StreamEventType["IMAGE_UPLOADED"] = "image_uploaded";
24
26
  /** Stream completed successfully */
25
27
  StreamEventType["DONE"] = "done";
26
28
  /** Error occurred during streaming */
@@ -114,6 +116,16 @@ exports.StreamStepDoneEventSchema = BaseStreamEventSchema.extend({
114
116
  exports.StreamImageGenerationStartEventSchema = BaseStreamEventSchema.extend({
115
117
  type: zod_1.z.literal(StreamEventType.IMAGE_GENERATION_START),
116
118
  });
119
+ /**
120
+ * Image uploaded event - image has been uploaded to S3
121
+ */
122
+ exports.StreamImageUploadedEventSchema = BaseStreamEventSchema.extend({
123
+ type: zod_1.z.literal(StreamEventType.IMAGE_UPLOADED),
124
+ /** S3 URL of the uploaded image */
125
+ imageUrl: zod_1.z.string().url(),
126
+ /** Image index (for multiple images in one message) */
127
+ imageIndex: zod_1.z.number().int().nonnegative(),
128
+ });
117
129
  // ============================================================================
118
130
  // Union Schema
119
131
  // ============================================================================
@@ -128,6 +140,7 @@ exports.StreamEventSchema = zod_1.z.discriminatedUnion('type', [
128
140
  exports.StreamPromptGenerationEventSchema,
129
141
  exports.StreamStepDoneEventSchema,
130
142
  exports.StreamImageGenerationStartEventSchema,
143
+ exports.StreamImageUploadedEventSchema,
131
144
  exports.StreamDoneEventSchema,
132
145
  exports.StreamErrorEventSchema,
133
146
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veruna/api-contracts",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "API contracts for Veruna project - Zod schemas, types, and paths",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",