@purpleschool/gptbot 0.20.18-stage-2 → 0.20.20-stage-2

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 (34) hide show
  1. package/build/api/controllers/http/chat-private.d.ts +1 -0
  2. package/build/api/controllers/http/chat-private.js +1 -0
  3. package/build/api/controllers/http/index.d.ts +1 -0
  4. package/build/api/controllers/http/index.js +1 -0
  5. package/build/api/controllers/http/user-memory.d.ts +9 -0
  6. package/build/api/controllers/http/user-memory.js +12 -0
  7. package/build/api/routes.d.ts +12 -0
  8. package/build/api/routes.js +12 -0
  9. package/build/commands/chat/calculate-chat-price.command.d.ts +1 -0
  10. package/build/commands/chat/calculate-chat-price.command.js +1 -0
  11. package/build/commands/chat/create-chat.command.d.ts +1 -0
  12. package/build/commands/chat/find-chat-by-uuid.command.d.ts +1 -0
  13. package/build/commands/chat/find-chats.command.d.ts +2 -0
  14. package/build/commands/chat/get-last-active-chat-command.d.ts +1 -0
  15. package/build/commands/chat/update-chat-favorite.command.d.ts +1 -0
  16. package/build/commands/chat/update-chat.command.d.ts +2 -0
  17. package/build/commands/chat/update-chat.command.js +1 -0
  18. package/build/commands/folder/find-folder-by-uuid-with-chats.command.d.ts +1 -0
  19. package/build/commands/index.d.ts +1 -0
  20. package/build/commands/index.js +1 -0
  21. package/build/commands/ui-notification/find-active-ui-notifications-by-page-and-user.command.d.ts +5 -0
  22. package/build/commands/ui-notification/find-ui-notifications.command.d.ts +5 -0
  23. package/build/commands/user-memory/index.d.ts +128 -0
  24. package/build/commands/user-memory/index.js +54 -0
  25. package/build/models/chat-with-messages.schema.d.ts +1 -0
  26. package/build/models/chat.schema.d.ts +1 -0
  27. package/build/models/chat.schema.js +1 -0
  28. package/build/models/index.d.ts +1 -0
  29. package/build/models/index.js +1 -0
  30. package/build/models/ui-notification.schema.d.ts +15 -0
  31. package/build/models/ui-notification.schema.js +10 -1
  32. package/build/models/user-memory.schema.d.ts +135 -0
  33. package/build/models/user-memory.schema.js +66 -0
  34. package/package.json +3 -3
@@ -9,6 +9,7 @@ export declare const CHAT_PRIVATE_ROUTES: {
9
9
  readonly FIND_BY_UUID: (uuid: string) => string;
10
10
  readonly PRICE: 'price';
11
11
  readonly COMPACT: (uuid: string) => string;
12
+ readonly MEMORY_ACTIVITY: (uuid: string) => string;
12
13
  readonly SEND_TEXT_MESSAGE: (uuid: string) => string;
13
14
  readonly STOP_STREAM: (uuid: string, messageId: string) => string;
14
15
  readonly ARCHIVE: 'archive';
@@ -12,6 +12,7 @@ exports.CHAT_PRIVATE_ROUTES = {
12
12
  FIND_BY_UUID: (uuid) => `${uuid}`,
13
13
  PRICE: 'price',
14
14
  COMPACT: (uuid) => `${uuid}/compact`,
15
+ MEMORY_ACTIVITY: (uuid) => `${uuid}/memory-activity`,
15
16
  SEND_TEXT_MESSAGE: (uuid) => `${uuid}/messages/text`,
16
17
  STOP_STREAM: (uuid, messageId) => `${uuid}/messages/${messageId}/stop`,
17
18
  ARCHIVE: 'archive',
@@ -95,3 +95,4 @@ export * from './push-campaign';
95
95
  export * from './greetings';
96
96
  export * from './motion-control';
97
97
  export * from './onboarding';
98
+ export * from './user-memory';
@@ -111,3 +111,4 @@ __exportStar(require("./push-campaign"), exports);
111
111
  __exportStar(require("./greetings"), exports);
112
112
  __exportStar(require("./motion-control"), exports);
113
113
  __exportStar(require("./onboarding"), exports);
114
+ __exportStar(require("./user-memory"), exports);
@@ -0,0 +1,9 @@
1
+ export declare const USER_MEMORY_CONTROLLER: 'memory';
2
+ export declare const USER_MEMORY_ROUTES: {
3
+ readonly SETTINGS: 'settings';
4
+ readonly COMPRESS: 'compress';
5
+ readonly ACCEPT: (id: string) => string;
6
+ readonly VIEW: (id: string) => string;
7
+ readonly DECLINE: (id: string) => string;
8
+ readonly UNDO: (id: string) => string;
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_MEMORY_ROUTES = exports.USER_MEMORY_CONTROLLER = void 0;
4
+ exports.USER_MEMORY_CONTROLLER = 'memory';
5
+ exports.USER_MEMORY_ROUTES = {
6
+ SETTINGS: 'settings',
7
+ COMPRESS: 'compress',
8
+ ACCEPT: (id) => `suggestions/${id}/accept`,
9
+ VIEW: (id) => `suggestions/${id}/view`,
10
+ DECLINE: (id) => `suggestions/${id}/decline`,
11
+ UNDO: (id) => `events/${id}/undo`,
12
+ };
@@ -1,5 +1,16 @@
1
1
  export declare const ROOT: '/api';
2
2
  export declare const REST_API: {
3
+ readonly MEMORY: {
4
+ readonly GET: "/api/memory";
5
+ readonly SAVE: "/api/memory";
6
+ readonly CLEAR: "/api/memory";
7
+ readonly SETTINGS: "/api/memory/settings";
8
+ readonly COMPRESS: "/api/memory/compress";
9
+ readonly ACCEPT: (id: string) => string;
10
+ readonly VIEW: (id: string) => string;
11
+ readonly DECLINE: (id: string) => string;
12
+ readonly UNDO: (id: string) => string;
13
+ };
3
14
  readonly PUSH_CAMPAIGN_ADMIN: {
4
15
  readonly PREVIEW_SEGMENT: "/api/push/campaigns/preview-audience";
5
16
  readonly STATISTICS: (uuid: string) => string;
@@ -245,6 +256,7 @@ export declare const REST_API: {
245
256
  readonly INSTRUCTION: (templateId: string, id: string) => string;
246
257
  };
247
258
  readonly CHAT_PRIVATE: {
259
+ readonly MEMORY_ACTIVITY: (uuid: string) => string;
248
260
  readonly CHECK_LIMIT: "/api/private/chats/limits";
249
261
  readonly GET_LAST_ACTIVE_CHAT: "/api/private/chats/last-active-chat";
250
262
  readonly CONFIG: "/api/private/chats/config";
@@ -39,6 +39,17 @@ const CONTROLLERS = __importStar(require("./controllers"));
39
39
  const partner_code_routes_1 = require("./partner-code-routes");
40
40
  exports.ROOT = '/api';
41
41
  exports.REST_API = {
42
+ MEMORY: {
43
+ GET: `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}`,
44
+ SAVE: `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}`,
45
+ CLEAR: `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}`,
46
+ SETTINGS: `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.SETTINGS}`,
47
+ COMPRESS: `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.COMPRESS}`,
48
+ ACCEPT: (id) => `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.ACCEPT(id)}`,
49
+ VIEW: (id) => `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.VIEW(id)}`,
50
+ DECLINE: (id) => `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.DECLINE(id)}`,
51
+ UNDO: (id) => `${exports.ROOT}/${CONTROLLERS.USER_MEMORY_CONTROLLER}/${CONTROLLERS.USER_MEMORY_ROUTES.UNDO(id)}`,
52
+ },
42
53
  PUSH_CAMPAIGN_ADMIN: {
43
54
  PREVIEW_SEGMENT: `${exports.ROOT}/${CONTROLLERS.PUSH_CAMPAIGN_ADMIN_CONTROLLER}/${CONTROLLERS.PUSH_CAMPAIGN_ROUTES.PREVIEW_SEGMENT}`,
44
55
  STATISTICS: (uuid) => `${exports.ROOT}/${CONTROLLERS.PUSH_CAMPAIGN_ADMIN_CONTROLLER}/${CONTROLLERS.PUSH_CAMPAIGN_ROUTES.STATISTICS(uuid)}`,
@@ -284,6 +295,7 @@ exports.REST_API = {
284
295
  INSTRUCTION: (templateId, id) => `${exports.ROOT}/${CONTROLLERS.AGENT_TEMPLATE_CONTROLLER_PRIVATE}/${CONTROLLERS.AGENT_TEMPLATE_ROUTES.INSTRUCTION(templateId, id)}`,
285
296
  },
286
297
  CHAT_PRIVATE: {
298
+ MEMORY_ACTIVITY: (uuid) => `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.MEMORY_ACTIVITY(uuid)}`,
287
299
  CHECK_LIMIT: `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.CHECK_LIMIT}`,
288
300
  GET_LAST_ACTIVE_CHAT: `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.GET_LAST_ACTIVE_CHAT}`,
289
301
  CONFIG: `${exports.ROOT}/${CONTROLLERS.CHAT_PRIVATE_CONTROLLER}/${CONTROLLERS.CHAT_PRIVATE_ROUTES.CONFIG}`,
@@ -4,6 +4,7 @@ export declare namespace CalculateChatPriceCommand {
4
4
  const RequestSchema: z.ZodObject<{
5
5
  inputLength: z.ZodNumber;
6
6
  chatId: z.ZodOptional<z.ZodUUID>;
7
+ memoryEnabled: z.ZodOptional<z.ZodBoolean>;
7
8
  aiModelId: z.ZodUUID;
8
9
  files: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUUID>>>;
9
10
  features: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AI_MODEL_FEATURE>>>>;
@@ -8,6 +8,7 @@ var CalculateChatPriceCommand;
8
8
  CalculateChatPriceCommand.RequestSchema = zod_1.z.object({
9
9
  inputLength: zod_1.z.number().int().nonnegative(),
10
10
  chatId: zod_1.z.uuid().optional(),
11
+ memoryEnabled: zod_1.z.boolean().optional(),
11
12
  aiModelId: zod_1.z.uuid(),
12
13
  files: zod_1.z.array(zod_1.z.uuid()).optional().default([]),
13
14
  features: zod_1.z.array(zod_1.z.enum(constants_1.AI_MODEL_FEATURE)).optional().default([]),
@@ -20,6 +20,7 @@ export declare namespace CreateChatCommand {
20
20
  }>;
21
21
  folderId: z.ZodNullable<z.ZodString>;
22
22
  isFavorite: z.ZodBoolean;
23
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
23
24
  createdAt: z.ZodDate;
24
25
  updatedAt: z.ZodDate;
25
26
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -19,6 +19,7 @@ export declare namespace FindChatByUUIDCommand {
19
19
  }>;
20
20
  folderId: z.ZodNullable<z.ZodString>;
21
21
  isFavorite: z.ZodBoolean;
22
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
22
23
  createdAt: z.ZodDate;
23
24
  updatedAt: z.ZodDate;
24
25
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -34,6 +34,7 @@ export declare namespace FindChatsCommand {
34
34
  }>;
35
35
  folderId: z.ZodNullable<z.ZodString>;
36
36
  isFavorite: z.ZodBoolean;
37
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
37
38
  createdAt: z.ZodDate;
38
39
  updatedAt: z.ZodDate;
39
40
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -57,6 +58,7 @@ export declare namespace FindChatsCommand {
57
58
  }>;
58
59
  folderId: z.ZodNullable<z.ZodString>;
59
60
  isFavorite: z.ZodBoolean;
61
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
60
62
  createdAt: z.ZodDate;
61
63
  updatedAt: z.ZodDate;
62
64
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -18,6 +18,7 @@ export declare namespace GetLastActiveChatCommand {
18
18
  }>;
19
19
  folderId: z.ZodNullable<z.ZodString>;
20
20
  isFavorite: z.ZodBoolean;
21
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
21
22
  createdAt: z.ZodDate;
22
23
  updatedAt: z.ZodDate;
23
24
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -23,6 +23,7 @@ export declare namespace UpdateChatFavoriteCommand {
23
23
  }>;
24
24
  folderId: z.ZodNullable<z.ZodString>;
25
25
  isFavorite: z.ZodBoolean;
26
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
26
27
  createdAt: z.ZodDate;
27
28
  updatedAt: z.ZodDate;
28
29
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -7,6 +7,7 @@ export declare namespace UpdateChatCommand {
7
7
  const RequestSchema: z.ZodObject<{
8
8
  title: z.ZodOptional<z.ZodString>;
9
9
  folderId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
10
+ memoryEnabled: z.ZodOptional<z.ZodBoolean>;
10
11
  }, z.core.$strip>;
11
12
  type RequestBody = z.infer<typeof RequestSchema>;
12
13
  const ResponseSchema: z.ZodObject<{
@@ -24,6 +25,7 @@ export declare namespace UpdateChatCommand {
24
25
  }>;
25
26
  folderId: z.ZodNullable<z.ZodString>;
26
27
  isFavorite: z.ZodBoolean;
28
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
27
29
  createdAt: z.ZodDate;
28
30
  updatedAt: z.ZodDate;
29
31
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -11,6 +11,7 @@ var UpdateChatCommand;
11
11
  UpdateChatCommand.RequestSchema = zod_1.z.object({
12
12
  title: zod_1.z.string().max(65).optional(),
13
13
  folderId: zod_1.z.uuid().nullable().optional(),
14
+ memoryEnabled: zod_1.z.boolean().optional(),
14
15
  });
15
16
  UpdateChatCommand.ResponseSchema = zod_1.z.object({
16
17
  data: models_1.ChatSchema,
@@ -35,6 +35,7 @@ export declare namespace FindFolderByUuidWithChatsCommand {
35
35
  }>;
36
36
  folderId: z.ZodNullable<z.ZodString>;
37
37
  isFavorite: z.ZodBoolean;
38
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
38
39
  createdAt: z.ZodDate;
39
40
  updatedAt: z.ZodDate;
40
41
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -64,3 +64,4 @@ export * from './app-login';
64
64
  export * from './push';
65
65
  export * from './partner-codes';
66
66
  export * from './onboarding';
67
+ export * from './user-memory';
@@ -80,3 +80,4 @@ __exportStar(require("./app-login"), exports);
80
80
  __exportStar(require("./push"), exports);
81
81
  __exportStar(require("./partner-codes"), exports);
82
82
  __exportStar(require("./onboarding"), exports);
83
+ __exportStar(require("./user-memory"), exports);
@@ -96,6 +96,11 @@ export declare namespace FindActiveUiNotificationsByPageAndUserCommand {
96
96
  serverTime: z.ZodOptional<z.ZodDate>;
97
97
  type: z.ZodLiteral<import("../..").UI_NOTIFICATION_TYPE.GENERIC>;
98
98
  dynamicUiContent: z.ZodObject<{
99
+ renewalReminder: z.ZodOptional<z.ZodObject<{
100
+ currency: z.ZodOptional<z.ZodString>;
101
+ renewalDate: z.ZodISODateTime;
102
+ price: z.ZodNumber;
103
+ }, z.core.$strip>>;
99
104
  title: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
100
105
  message: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
101
106
  }, z.core.$strip>;
@@ -97,6 +97,11 @@ export declare namespace FindUiNotificationsCommand {
97
97
  serverTime: z.ZodOptional<z.ZodDate>;
98
98
  type: z.ZodLiteral<import("../..").UI_NOTIFICATION_TYPE.GENERIC>;
99
99
  dynamicUiContent: z.ZodObject<{
100
+ renewalReminder: z.ZodOptional<z.ZodObject<{
101
+ currency: z.ZodOptional<z.ZodString>;
102
+ renewalDate: z.ZodISODateTime;
103
+ price: z.ZodNumber;
104
+ }, z.core.$strip>>;
100
105
  title: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
101
106
  message: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
102
107
  }, z.core.$strip>;
@@ -0,0 +1,128 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetUserMemoryCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ data: z.ZodObject<{
5
+ content: z.ZodString;
6
+ canClear: z.ZodOptional<z.ZodBoolean>;
7
+ version: z.ZodNumber;
8
+ limit: z.ZodLiteral<2000>;
9
+ enabled: z.ZodBoolean;
10
+ suggestEnabled: z.ZodBoolean;
11
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
12
+ }, z.core.$strip>;
13
+ }, z.core.$strip>;
14
+ type Response = z.infer<typeof ResponseSchema>;
15
+ }
16
+ export declare namespace SaveUserMemoryCommand {
17
+ const RequestSchema: z.ZodObject<{
18
+ content: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
19
+ version: z.ZodNumber;
20
+ }, z.core.$strict>;
21
+ const ResponseSchema: z.ZodObject<{
22
+ data: z.ZodObject<{
23
+ content: z.ZodString;
24
+ canClear: z.ZodOptional<z.ZodBoolean>;
25
+ version: z.ZodNumber;
26
+ limit: z.ZodLiteral<2000>;
27
+ enabled: z.ZodBoolean;
28
+ suggestEnabled: z.ZodBoolean;
29
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
30
+ }, z.core.$strip>;
31
+ }, z.core.$strip>;
32
+ type RequestBody = z.infer<typeof RequestSchema>;
33
+ type Response = z.infer<typeof ResponseSchema>;
34
+ }
35
+ export declare namespace UpdateUserMemorySettingsCommand {
36
+ const RequestSchema: z.ZodObject<{
37
+ enabled: z.ZodOptional<z.ZodBoolean>;
38
+ suggestEnabled: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strict>;
40
+ const ResponseSchema: z.ZodObject<{
41
+ data: z.ZodObject<{
42
+ content: z.ZodString;
43
+ canClear: z.ZodOptional<z.ZodBoolean>;
44
+ version: z.ZodNumber;
45
+ limit: z.ZodLiteral<2000>;
46
+ enabled: z.ZodBoolean;
47
+ suggestEnabled: z.ZodBoolean;
48
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
49
+ }, z.core.$strip>;
50
+ }, z.core.$strip>;
51
+ type RequestBody = z.infer<typeof RequestSchema>;
52
+ type Response = z.infer<typeof ResponseSchema>;
53
+ }
54
+ export declare namespace MemoryVersionCommand {
55
+ const RequestSchema: z.ZodObject<{
56
+ version: z.ZodNumber;
57
+ }, z.core.$strict>;
58
+ type RequestBody = z.infer<typeof RequestSchema>;
59
+ }
60
+ export declare namespace GetMemoryActivityCommand {
61
+ const ResponseSchema: z.ZodObject<{
62
+ data: z.ZodObject<{
63
+ jobs: z.ZodArray<z.ZodObject<{
64
+ id: z.ZodUUID;
65
+ messageId: z.ZodUUID;
66
+ responseMessageId: z.ZodUUID;
67
+ status: z.ZodEnum<{
68
+ blocked: "blocked";
69
+ failed: "failed";
70
+ none: "none";
71
+ pending: "pending";
72
+ running: "running";
73
+ saved: "saved";
74
+ stale: "stale";
75
+ suggested: "suggested";
76
+ }>;
77
+ createdAt: z.ZodCoercedDate<unknown>;
78
+ }, z.core.$strip>>;
79
+ events: z.ZodArray<z.ZodObject<{
80
+ id: z.ZodUUID;
81
+ messageId: z.ZodNullable<z.ZodUUID>;
82
+ responseMessageId: z.ZodNullable<z.ZodUUID>;
83
+ status: z.ZodEnum<{
84
+ accepted: "accepted";
85
+ blocked: "blocked";
86
+ declined: "declined";
87
+ pending: "pending";
88
+ stale: "stale";
89
+ undone: "undone";
90
+ }>;
91
+ operations: z.ZodArray<z.ZodObject<{
92
+ action: z.ZodEnum<{
93
+ add: "add";
94
+ replace: "replace";
95
+ }>;
96
+ text: z.ZodString;
97
+ replaces: z.ZodString;
98
+ explicit: z.ZodBoolean;
99
+ section: z.ZodString;
100
+ }, z.core.$strict>>;
101
+ reason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
102
+ invalid: "invalid";
103
+ limit: "limit";
104
+ }>>>;
105
+ versionBefore: z.ZodNumber;
106
+ versionAfter: z.ZodNullable<z.ZodNumber>;
107
+ canUndo: z.ZodBoolean;
108
+ createdAt: z.ZodCoercedDate<unknown>;
109
+ }, z.core.$strip>>;
110
+ hasActiveJobs: z.ZodBoolean;
111
+ }, z.core.$strip>;
112
+ }, z.core.$strip>;
113
+ type Response = z.infer<typeof ResponseSchema>;
114
+ }
115
+ export declare namespace CompressUserMemoryCommand {
116
+ const RequestSchema: z.ZodObject<{
117
+ content: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
118
+ version: z.ZodNumber;
119
+ }, z.core.$strict>;
120
+ const ResponseSchema: z.ZodObject<{
121
+ data: z.ZodObject<{
122
+ content: z.ZodString;
123
+ version: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ }, z.core.$strip>;
126
+ type RequestBody = z.infer<typeof RequestSchema>;
127
+ type Response = z.infer<typeof ResponseSchema>;
128
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompressUserMemoryCommand = exports.GetMemoryActivityCommand = exports.MemoryVersionCommand = exports.UpdateUserMemorySettingsCommand = exports.SaveUserMemoryCommand = exports.GetUserMemoryCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const user_memory_schema_1 = require("../../models/user-memory.schema");
6
+ var GetUserMemoryCommand;
7
+ (function (GetUserMemoryCommand) {
8
+ GetUserMemoryCommand.ResponseSchema = zod_1.z.object({ data: user_memory_schema_1.UserMemorySchema });
9
+ })(GetUserMemoryCommand || (exports.GetUserMemoryCommand = GetUserMemoryCommand = {}));
10
+ var SaveUserMemoryCommand;
11
+ (function (SaveUserMemoryCommand) {
12
+ SaveUserMemoryCommand.RequestSchema = zod_1.z
13
+ .object({
14
+ content: zod_1.z
15
+ .string()
16
+ .max(user_memory_schema_1.USER_MEMORY_DRAFT_LIMIT * 2)
17
+ .transform(user_memory_schema_1.normalizeMemoryContent)
18
+ .refine((text) => (0, user_memory_schema_1.memoryContentLength)(text) <= user_memory_schema_1.USER_MEMORY_LIMIT),
19
+ version: zod_1.z.number().int().nonnegative(),
20
+ })
21
+ .strict();
22
+ SaveUserMemoryCommand.ResponseSchema = GetUserMemoryCommand.ResponseSchema;
23
+ })(SaveUserMemoryCommand || (exports.SaveUserMemoryCommand = SaveUserMemoryCommand = {}));
24
+ var UpdateUserMemorySettingsCommand;
25
+ (function (UpdateUserMemorySettingsCommand) {
26
+ UpdateUserMemorySettingsCommand.RequestSchema = zod_1.z
27
+ .object({ enabled: zod_1.z.boolean().optional(), suggestEnabled: zod_1.z.boolean().optional() })
28
+ .strict();
29
+ UpdateUserMemorySettingsCommand.ResponseSchema = GetUserMemoryCommand.ResponseSchema;
30
+ })(UpdateUserMemorySettingsCommand || (exports.UpdateUserMemorySettingsCommand = UpdateUserMemorySettingsCommand = {}));
31
+ var MemoryVersionCommand;
32
+ (function (MemoryVersionCommand) {
33
+ MemoryVersionCommand.RequestSchema = zod_1.z.object({ version: zod_1.z.number().int().nonnegative() }).strict();
34
+ })(MemoryVersionCommand || (exports.MemoryVersionCommand = MemoryVersionCommand = {}));
35
+ var GetMemoryActivityCommand;
36
+ (function (GetMemoryActivityCommand) {
37
+ GetMemoryActivityCommand.ResponseSchema = zod_1.z.object({ data: user_memory_schema_1.MemoryActivitySchema });
38
+ })(GetMemoryActivityCommand || (exports.GetMemoryActivityCommand = GetMemoryActivityCommand = {}));
39
+ var CompressUserMemoryCommand;
40
+ (function (CompressUserMemoryCommand) {
41
+ CompressUserMemoryCommand.RequestSchema = zod_1.z
42
+ .object({
43
+ content: zod_1.z
44
+ .string()
45
+ .max(user_memory_schema_1.USER_MEMORY_DRAFT_LIMIT * 2)
46
+ .transform(user_memory_schema_1.normalizeMemoryContent)
47
+ .refine((text) => (0, user_memory_schema_1.memoryContentLength)(text) <= user_memory_schema_1.USER_MEMORY_DRAFT_LIMIT),
48
+ version: zod_1.z.number().int().nonnegative(),
49
+ })
50
+ .strict();
51
+ CompressUserMemoryCommand.ResponseSchema = zod_1.z.object({
52
+ data: zod_1.z.object({ content: zod_1.z.string(), version: zod_1.z.number().int() }),
53
+ });
54
+ })(CompressUserMemoryCommand || (exports.CompressUserMemoryCommand = CompressUserMemoryCommand = {}));
@@ -13,6 +13,7 @@ export declare const ChatWithMessagesSchema: z.ZodObject<{
13
13
  }>;
14
14
  folderId: z.ZodNullable<z.ZodString>;
15
15
  isFavorite: z.ZodBoolean;
16
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
16
17
  createdAt: z.ZodDate;
17
18
  updatedAt: z.ZodDate;
18
19
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -13,6 +13,7 @@ export declare const ChatSchema: z.ZodObject<{
13
13
  }>;
14
14
  folderId: z.ZodNullable<z.ZodString>;
15
15
  isFavorite: z.ZodBoolean;
16
+ memoryEnabled: z.ZodDefault<z.ZodBoolean>;
16
17
  createdAt: z.ZodDate;
17
18
  updatedAt: z.ZodDate;
18
19
  deletedAt: z.ZodNullable<z.ZodDate>;
@@ -13,6 +13,7 @@ exports.ChatSchema = zod_1.z.object({
13
13
  chatStatus: zod_1.z.enum(Object.values(constants_1.CHAT_STATUS_ENUM)),
14
14
  folderId: zod_1.z.string().nullable(),
15
15
  isFavorite: zod_1.z.boolean(),
16
+ memoryEnabled: zod_1.z.boolean().default(true),
16
17
  createdAt: zod_1.z.date(),
17
18
  updatedAt: zod_1.z.date(),
18
19
  deletedAt: zod_1.z.nullable(zod_1.z.date()),
@@ -88,3 +88,4 @@ export * from './canvas-template.schema';
88
88
  export * from './user-loyalty-status.schema';
89
89
  export * from './push';
90
90
  export * from './onboarding.schema';
91
+ export * from './user-memory.schema';
@@ -104,3 +104,4 @@ __exportStar(require("./canvas-template.schema"), exports);
104
104
  __exportStar(require("./user-loyalty-status.schema"), exports);
105
105
  __exportStar(require("./push"), exports);
106
106
  __exportStar(require("./onboarding.schema"), exports);
107
+ __exportStar(require("./user-memory.schema"), exports);
@@ -38,7 +38,17 @@ export declare const PromocodeOfferUiContentSchema: z.ZodObject<{
38
38
  validTill: z.ZodNullable<z.ZodISODateTime>;
39
39
  }, z.core.$strip>;
40
40
  export type PromocodeOfferUiContent = z.infer<typeof PromocodeOfferUiContentSchema>;
41
+ export declare const SubscriptionRenewalReminderUiContentSchema: z.ZodObject<{
42
+ currency: z.ZodOptional<z.ZodString>;
43
+ renewalDate: z.ZodISODateTime;
44
+ price: z.ZodNumber;
45
+ }, z.core.$strip>;
41
46
  export declare const GenericUiContentSchema: z.ZodObject<{
47
+ renewalReminder: z.ZodOptional<z.ZodObject<{
48
+ currency: z.ZodOptional<z.ZodString>;
49
+ renewalDate: z.ZodISODateTime;
50
+ price: z.ZodNumber;
51
+ }, z.core.$strip>>;
42
52
  title: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
43
53
  message: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
44
54
  }, z.core.$strip>;
@@ -155,6 +165,11 @@ export declare const UiNotificationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
155
165
  serverTime: z.ZodOptional<z.ZodDate>;
156
166
  type: z.ZodLiteral<UI_NOTIFICATION_TYPE.GENERIC>;
157
167
  dynamicUiContent: z.ZodObject<{
168
+ renewalReminder: z.ZodOptional<z.ZodObject<{
169
+ currency: z.ZodOptional<z.ZodString>;
170
+ renewalDate: z.ZodISODateTime;
171
+ price: z.ZodNumber;
172
+ }, z.core.$strip>>;
158
173
  title: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
159
174
  message: z.ZodObject<Record<import("@purpleschool/rugpt-lib-common").LOCALE, z.ZodString>, z.core.$strip>;
160
175
  }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UiNotificationSchema = exports.LoyaltyLevelUpUiContentSchema = exports.BlogUpdateUiContentSchema = exports.EmailNotVerifiedUiContentSchema = exports.GenericUiContentSchema = exports.PromocodeOfferUiContentSchema = exports.FraudDetectedUiContentSchema = exports.SubscriptionPastDueUiContentSchema = exports.ConnectTelegramBonusUiContentSchema = exports.LocalizedUiNotificationTextSchema = exports.UiNotificationBaseSchema = void 0;
3
+ exports.UiNotificationSchema = exports.LoyaltyLevelUpUiContentSchema = exports.BlogUpdateUiContentSchema = exports.EmailNotVerifiedUiContentSchema = exports.GenericUiContentSchema = exports.SubscriptionRenewalReminderUiContentSchema = exports.PromocodeOfferUiContentSchema = exports.FraudDetectedUiContentSchema = exports.SubscriptionPastDueUiContentSchema = exports.ConnectTelegramBonusUiContentSchema = exports.LocalizedUiNotificationTextSchema = exports.UiNotificationBaseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const localized_text_schema_1 = require("../helpers/localized-text.schema");
6
6
  const constants_1 = require("../constants");
@@ -36,7 +36,16 @@ exports.PromocodeOfferUiContentSchema = zod_1.z.object({
36
36
  bonusPercent: zod_1.z.number(),
37
37
  validTill: zod_1.z.iso.datetime().nullable(),
38
38
  });
39
+ exports.SubscriptionRenewalReminderUiContentSchema = zod_1.z.object({
40
+ currency: zod_1.z
41
+ .string()
42
+ .regex(/^[A-Z]{3}$/)
43
+ .optional(),
44
+ renewalDate: zod_1.z.iso.datetime(),
45
+ price: zod_1.z.number().finite().nonnegative(),
46
+ });
39
47
  exports.GenericUiContentSchema = zod_1.z.object({
48
+ renewalReminder: exports.SubscriptionRenewalReminderUiContentSchema.optional(),
40
49
  title: exports.LocalizedUiNotificationTextSchema,
41
50
  message: exports.LocalizedUiNotificationTextSchema,
42
51
  });
@@ -0,0 +1,135 @@
1
+ import { z } from 'zod';
2
+ export declare const USER_MEMORY_LIMIT = 2000;
3
+ export declare const USER_MEMORY_DRAFT_LIMIT = 12000;
4
+ export declare function normalizeMemoryContent(value: string): string;
5
+ export declare function memoryContentLength(value: string): number;
6
+ export declare const MemoryOperationSchema: z.ZodObject<{
7
+ action: z.ZodEnum<{
8
+ add: "add";
9
+ replace: "replace";
10
+ }>;
11
+ text: z.ZodString;
12
+ replaces: z.ZodString;
13
+ explicit: z.ZodBoolean;
14
+ section: z.ZodString;
15
+ }, z.core.$strict>;
16
+ export declare const MemoryOperationsSchema: z.ZodArray<z.ZodObject<{
17
+ action: z.ZodEnum<{
18
+ add: "add";
19
+ replace: "replace";
20
+ }>;
21
+ text: z.ZodString;
22
+ replaces: z.ZodString;
23
+ explicit: z.ZodBoolean;
24
+ section: z.ZodString;
25
+ }, z.core.$strict>>;
26
+ export declare const UserMemorySchema: z.ZodObject<{
27
+ content: z.ZodString;
28
+ canClear: z.ZodOptional<z.ZodBoolean>;
29
+ version: z.ZodNumber;
30
+ limit: z.ZodLiteral<2000>;
31
+ enabled: z.ZodBoolean;
32
+ suggestEnabled: z.ZodBoolean;
33
+ updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
34
+ }, z.core.$strip>;
35
+ export declare const MemoryEventSchema: z.ZodObject<{
36
+ id: z.ZodUUID;
37
+ messageId: z.ZodNullable<z.ZodUUID>;
38
+ responseMessageId: z.ZodNullable<z.ZodUUID>;
39
+ status: z.ZodEnum<{
40
+ accepted: "accepted";
41
+ blocked: "blocked";
42
+ declined: "declined";
43
+ pending: "pending";
44
+ stale: "stale";
45
+ undone: "undone";
46
+ }>;
47
+ operations: z.ZodArray<z.ZodObject<{
48
+ action: z.ZodEnum<{
49
+ add: "add";
50
+ replace: "replace";
51
+ }>;
52
+ text: z.ZodString;
53
+ replaces: z.ZodString;
54
+ explicit: z.ZodBoolean;
55
+ section: z.ZodString;
56
+ }, z.core.$strict>>;
57
+ reason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
58
+ invalid: "invalid";
59
+ limit: "limit";
60
+ }>>>;
61
+ versionBefore: z.ZodNumber;
62
+ versionAfter: z.ZodNullable<z.ZodNumber>;
63
+ canUndo: z.ZodBoolean;
64
+ createdAt: z.ZodCoercedDate<unknown>;
65
+ }, z.core.$strip>;
66
+ export declare const MemoryJobSchema: z.ZodObject<{
67
+ id: z.ZodUUID;
68
+ messageId: z.ZodUUID;
69
+ responseMessageId: z.ZodUUID;
70
+ status: z.ZodEnum<{
71
+ blocked: "blocked";
72
+ failed: "failed";
73
+ none: "none";
74
+ pending: "pending";
75
+ running: "running";
76
+ saved: "saved";
77
+ stale: "stale";
78
+ suggested: "suggested";
79
+ }>;
80
+ createdAt: z.ZodCoercedDate<unknown>;
81
+ }, z.core.$strip>;
82
+ export declare const MemoryActivitySchema: z.ZodObject<{
83
+ jobs: z.ZodArray<z.ZodObject<{
84
+ id: z.ZodUUID;
85
+ messageId: z.ZodUUID;
86
+ responseMessageId: z.ZodUUID;
87
+ status: z.ZodEnum<{
88
+ blocked: "blocked";
89
+ failed: "failed";
90
+ none: "none";
91
+ pending: "pending";
92
+ running: "running";
93
+ saved: "saved";
94
+ stale: "stale";
95
+ suggested: "suggested";
96
+ }>;
97
+ createdAt: z.ZodCoercedDate<unknown>;
98
+ }, z.core.$strip>>;
99
+ events: z.ZodArray<z.ZodObject<{
100
+ id: z.ZodUUID;
101
+ messageId: z.ZodNullable<z.ZodUUID>;
102
+ responseMessageId: z.ZodNullable<z.ZodUUID>;
103
+ status: z.ZodEnum<{
104
+ accepted: "accepted";
105
+ blocked: "blocked";
106
+ declined: "declined";
107
+ pending: "pending";
108
+ stale: "stale";
109
+ undone: "undone";
110
+ }>;
111
+ operations: z.ZodArray<z.ZodObject<{
112
+ action: z.ZodEnum<{
113
+ add: "add";
114
+ replace: "replace";
115
+ }>;
116
+ text: z.ZodString;
117
+ replaces: z.ZodString;
118
+ explicit: z.ZodBoolean;
119
+ section: z.ZodString;
120
+ }, z.core.$strict>>;
121
+ reason: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
122
+ invalid: "invalid";
123
+ limit: "limit";
124
+ }>>>;
125
+ versionBefore: z.ZodNumber;
126
+ versionAfter: z.ZodNullable<z.ZodNumber>;
127
+ canUndo: z.ZodBoolean;
128
+ createdAt: z.ZodCoercedDate<unknown>;
129
+ }, z.core.$strip>>;
130
+ hasActiveJobs: z.ZodBoolean;
131
+ }, z.core.$strip>;
132
+ export type UserMemory = z.infer<typeof UserMemorySchema>;
133
+ export type MemoryOperation = z.infer<typeof MemoryOperationSchema>;
134
+ export type MemoryEvent = z.infer<typeof MemoryEventSchema>;
135
+ export type MemoryActivity = z.infer<typeof MemoryActivitySchema>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemoryActivitySchema = exports.MemoryJobSchema = exports.MemoryEventSchema = exports.UserMemorySchema = exports.MemoryOperationsSchema = exports.MemoryOperationSchema = exports.USER_MEMORY_DRAFT_LIMIT = exports.USER_MEMORY_LIMIT = void 0;
4
+ exports.normalizeMemoryContent = normalizeMemoryContent;
5
+ exports.memoryContentLength = memoryContentLength;
6
+ const zod_1 = require("zod");
7
+ exports.USER_MEMORY_LIMIT = 2000;
8
+ exports.USER_MEMORY_DRAFT_LIMIT = 12000;
9
+ function normalizeMemoryContent(value) {
10
+ return value.replace(/\r\n?/g, '\n');
11
+ }
12
+ function memoryContentLength(value) {
13
+ return Array.from(normalizeMemoryContent(value)).length;
14
+ }
15
+ exports.MemoryOperationSchema = zod_1.z
16
+ .object({
17
+ action: zod_1.z.enum(['add', 'replace']),
18
+ text: zod_1.z.string().min(1).max(1000),
19
+ replaces: zod_1.z.string().max(exports.USER_MEMORY_LIMIT * 2),
20
+ explicit: zod_1.z.boolean(),
21
+ section: zod_1.z.string().max(80),
22
+ })
23
+ .strict();
24
+ exports.MemoryOperationsSchema = zod_1.z.array(exports.MemoryOperationSchema).max(8);
25
+ exports.UserMemorySchema = zod_1.z.object({
26
+ content: zod_1.z.string(),
27
+ canClear: zod_1.z.boolean().optional(),
28
+ version: zod_1.z.number().int().nonnegative(),
29
+ limit: zod_1.z.literal(exports.USER_MEMORY_LIMIT),
30
+ enabled: zod_1.z.boolean(),
31
+ suggestEnabled: zod_1.z.boolean(),
32
+ updatedAt: zod_1.z.coerce.date().nullable(),
33
+ });
34
+ exports.MemoryEventSchema = zod_1.z.object({
35
+ id: zod_1.z.uuid(),
36
+ messageId: zod_1.z.uuid().nullable(),
37
+ responseMessageId: zod_1.z.uuid().nullable(),
38
+ status: zod_1.z.enum(['pending', 'accepted', 'declined', 'stale', 'blocked', 'undone']),
39
+ operations: exports.MemoryOperationsSchema,
40
+ reason: zod_1.z.enum(['limit', 'invalid']).nullable().default(null),
41
+ versionBefore: zod_1.z.number().int(),
42
+ versionAfter: zod_1.z.number().int().nullable(),
43
+ canUndo: zod_1.z.boolean(),
44
+ createdAt: zod_1.z.coerce.date(),
45
+ });
46
+ exports.MemoryJobSchema = zod_1.z.object({
47
+ id: zod_1.z.uuid(),
48
+ messageId: zod_1.z.uuid(),
49
+ responseMessageId: zod_1.z.uuid(),
50
+ status: zod_1.z.enum([
51
+ 'pending',
52
+ 'running',
53
+ 'none',
54
+ 'suggested',
55
+ 'saved',
56
+ 'blocked',
57
+ 'failed',
58
+ 'stale',
59
+ ]),
60
+ createdAt: zod_1.z.coerce.date(),
61
+ });
62
+ exports.MemoryActivitySchema = zod_1.z.object({
63
+ jobs: zod_1.z.array(exports.MemoryJobSchema),
64
+ events: zod_1.z.array(exports.MemoryEventSchema),
65
+ hasActiveJobs: zod_1.z.boolean(),
66
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.20.18-stage-2",
3
+ "version": "0.20.20-stage-2",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -15,8 +15,8 @@
15
15
  "author": "",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@purpleschool/gptbot-tools": "0.4.38-stage-2",
19
- "@purpleschool/rugpt-lib-common": "0.0.120",
18
+ "@purpleschool/gptbot-tools": "0.4.40-stage-2",
19
+ "@purpleschool/rugpt-lib-common": "^0.0.123",
20
20
  "zod": "4.6.5"
21
21
  }
22
22
  }