@messenger-box/platform-server 10.0.3-alpha.7 → 10.0.3-alpha.74

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 (202) hide show
  1. package/lib/config/env-config.d.ts +7 -0
  2. package/lib/config/env-config.js +20 -0
  3. package/lib/config/env-config.js.map +1 -1
  4. package/lib/containers/containers.js +9 -1
  5. package/lib/containers/containers.js.map +1 -1
  6. package/lib/containers/context-services-from-container.d.ts +1 -1
  7. package/lib/containers/context-services-from-container.js +4 -2
  8. package/lib/containers/context-services-from-container.js.map +1 -1
  9. package/lib/graphql/resolvers/ai-fragment.d.ts +3 -0
  10. package/lib/graphql/resolvers/ai-fragment.js +276 -0
  11. package/lib/graphql/resolvers/ai-fragment.js.map +1 -0
  12. package/lib/graphql/resolvers/channel-member.d.ts +3 -2
  13. package/lib/graphql/resolvers/channel-member.js +30 -5
  14. package/lib/graphql/resolvers/channel-member.js.map +1 -1
  15. package/lib/graphql/resolvers/channel.d.ts +3 -2
  16. package/lib/graphql/resolvers/channel.js +308 -53
  17. package/lib/graphql/resolvers/channel.js.map +1 -1
  18. package/lib/graphql/resolvers/extended-token-account.d.ts +3 -2
  19. package/lib/graphql/resolvers/extended-token-account.js +90 -23
  20. package/lib/graphql/resolvers/extended-token-account.js.map +1 -1
  21. package/lib/graphql/resolvers/index.d.ts +1 -1
  22. package/lib/graphql/resolvers/index.js +1 -1
  23. package/lib/graphql/resolvers/index.js.map +1 -1
  24. package/lib/graphql/resolvers/post-thread.d.ts +1 -1
  25. package/lib/graphql/resolvers/post-thread.js +294 -132
  26. package/lib/graphql/resolvers/post-thread.js.map +1 -1
  27. package/lib/graphql/resolvers/post.d.ts +2 -3
  28. package/lib/graphql/resolvers/post.js +874 -239
  29. package/lib/graphql/resolvers/post.js.map +1 -1
  30. package/lib/graphql/resolvers/reaction.d.ts +3 -2
  31. package/lib/graphql/resolvers/reaction.js +96 -14
  32. package/lib/graphql/resolvers/reaction.js.map +1 -1
  33. package/lib/graphql/schema/ai-fragment.graphql +311 -0
  34. package/lib/graphql/schema/ai-fragment.graphql.js +1 -0
  35. package/lib/graphql/schema/ai-fragment.graphql.js.map +1 -0
  36. package/lib/graphql/schema/channel-member.graphql +110 -21
  37. package/lib/graphql/schema/channel-member.graphql.js +1 -1
  38. package/lib/graphql/schema/channel.graphql +356 -38
  39. package/lib/graphql/schema/channel.graphql.js +1 -1
  40. package/lib/graphql/schema/index.js +2 -2
  41. package/lib/graphql/schema/index.js.map +1 -1
  42. package/lib/graphql/schema/post-thread.graphql +167 -21
  43. package/lib/graphql/schema/post-thread.graphql.js +1 -1
  44. package/lib/graphql/schema/post.graphql +360 -40
  45. package/lib/graphql/schema/post.graphql.js +1 -1
  46. package/lib/graphql/schema/reaction.graphql +71 -13
  47. package/lib/graphql/schema/reaction.graphql.js +1 -1
  48. package/lib/graphql/schema/services.graphql +21 -0
  49. package/lib/graphql/schema/users.graphql +76 -13
  50. package/lib/graphql/schema/users.graphql.js +1 -1
  51. package/lib/index.js +1 -1
  52. package/lib/index.js.map +1 -1
  53. package/lib/inngest/factory.d.ts +20 -0
  54. package/lib/inngest/factory.js +4 -0
  55. package/lib/inngest/factory.js.map +1 -0
  56. package/lib/inngest/functions.d.ts +235 -0
  57. package/lib/inngest/functions.js +1385 -0
  58. package/lib/inngest/functions.js.map +1 -0
  59. package/lib/inngest/index.d.ts +3 -0
  60. package/lib/inngest/prompt.d.ts +6 -0
  61. package/lib/inngest/prompt.js +871 -0
  62. package/lib/inngest/prompt.js.map +1 -0
  63. package/lib/inngest/utils.d.ts +5 -0
  64. package/lib/inngest/utils.js +32 -0
  65. package/lib/inngest/utils.js.map +1 -0
  66. package/lib/interfaces/index.d.ts +0 -1
  67. package/lib/interfaces/services.d.ts +1 -1
  68. package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.d.ts +17 -0
  69. package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js +44 -0
  70. package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js.map +1 -0
  71. package/lib/migrations/dbMigrations/index.d.ts +1 -0
  72. package/lib/migrations/index.d.ts +1 -0
  73. package/lib/migrations/mail-template-migration.js +1 -1
  74. package/lib/migrations/message-notification-template-migration.d.ts +1 -1
  75. package/lib/migrations/message-notification-template-migration.js +1 -1
  76. package/lib/module.js +10 -3
  77. package/lib/module.js.map +1 -1
  78. package/lib/plugins/ai-fragment-moleculer-service.d.ts +29 -0
  79. package/lib/plugins/ai-fragment-moleculer-service.js +516 -0
  80. package/lib/plugins/ai-fragment-moleculer-service.js.map +1 -0
  81. package/lib/plugins/channel-moleculer-service.d.ts +21 -1
  82. package/lib/plugins/channel-moleculer-service.js +426 -115
  83. package/lib/plugins/channel-moleculer-service.js.map +1 -1
  84. package/lib/plugins/extended-token-account-moleculer-service.d.ts +25 -1
  85. package/lib/plugins/extended-token-account-moleculer-service.js +348 -22
  86. package/lib/plugins/extended-token-account-moleculer-service.js.map +1 -1
  87. package/lib/plugins/index.d.ts +1 -0
  88. package/lib/plugins/messenger-notification-moleculer-service.d.ts +27 -3
  89. package/lib/plugins/messenger-notification-moleculer-service.js +404 -58
  90. package/lib/plugins/messenger-notification-moleculer-service.js.map +1 -1
  91. package/lib/plugins/post-moleculer-service.d.ts +85 -21
  92. package/lib/plugins/post-moleculer-service.js +1102 -256
  93. package/lib/plugins/post-moleculer-service.js.map +1 -1
  94. package/lib/plugins/post-thread-moleculer-service.d.ts +33 -1
  95. package/lib/plugins/post-thread-moleculer-service.js +326 -8
  96. package/lib/plugins/post-thread-moleculer-service.js.map +1 -1
  97. package/lib/plugins/reaction-moleculer-service.js +1 -1
  98. package/lib/plugins/reaction-moleculer-service.js.map +1 -1
  99. package/lib/preferences/settings/post-settings.d.ts +2 -0
  100. package/lib/preferences/settings/post-settings.js +47 -9
  101. package/lib/preferences/settings/post-settings.js.map +1 -1
  102. package/lib/services/ai-fragment-service.d.ts +195 -0
  103. package/lib/services/ai-fragment-service.js +631 -0
  104. package/lib/services/ai-fragment-service.js.map +1 -0
  105. package/lib/services/channel-service.d.ts +181 -33
  106. package/lib/services/channel-service.js +842 -273
  107. package/lib/services/channel-service.js.map +1 -1
  108. package/lib/services/extended-token-account-service.d.ts +130 -14
  109. package/lib/services/extended-token-account-service.js +462 -52
  110. package/lib/services/extended-token-account-service.js.map +1 -1
  111. package/lib/services/index.d.ts +3 -0
  112. package/lib/services/messenger-notification-service.d.ts +106 -13
  113. package/lib/services/messenger-notification-service.js +824 -442
  114. package/lib/services/messenger-notification-service.js.map +1 -1
  115. package/lib/services/post-service.d.ts +189 -16
  116. package/lib/services/post-service.js +949 -113
  117. package/lib/services/post-service.js.map +1 -1
  118. package/lib/services/post-thread-service.d.ts +114 -5
  119. package/lib/services/post-thread-service.js +400 -13
  120. package/lib/services/post-thread-service.js.map +1 -1
  121. package/lib/services/proxy-services/ai-fragment-microservice.d.ts +23 -0
  122. package/lib/services/proxy-services/ai-fragment-microservice.js +78 -0
  123. package/lib/services/proxy-services/ai-fragment-microservice.js.map +1 -0
  124. package/lib/services/proxy-services/channel-microservice.d.ts +6 -3
  125. package/lib/services/proxy-services/channel-microservice.js +25 -10
  126. package/lib/services/proxy-services/channel-microservice.js.map +1 -1
  127. package/lib/services/proxy-services/index.d.ts +1 -0
  128. package/lib/services/proxy-services/messenger-notification-microservice.d.ts +128 -8
  129. package/lib/services/proxy-services/messenger-notification-microservice.js +324 -29
  130. package/lib/services/proxy-services/messenger-notification-microservice.js.map +1 -1
  131. package/lib/services/proxy-services/post-microservice.d.ts +207 -12
  132. package/lib/services/proxy-services/post-microservice.js +623 -54
  133. package/lib/services/proxy-services/post-microservice.js.map +1 -1
  134. package/lib/services/proxy-services/post-thread-microservice.d.ts +134 -3
  135. package/lib/services/proxy-services/post-thread-microservice.js +388 -6
  136. package/lib/services/proxy-services/post-thread-microservice.js.map +1 -1
  137. package/lib/services/proxy-services/reaction-microservice.d.ts +161 -3
  138. package/lib/services/proxy-services/reaction-microservice.js +474 -2
  139. package/lib/services/proxy-services/reaction-microservice.js.map +1 -1
  140. package/lib/services/reaction-service.d.ts +124 -4
  141. package/lib/services/reaction-service.js +415 -3
  142. package/lib/services/reaction-service.js.map +1 -1
  143. package/lib/services/redis-cache-manager.d.ts +18 -0
  144. package/lib/services/redis-cache-manager.js +83 -0
  145. package/lib/services/redis-cache-manager.js.map +1 -0
  146. package/lib/services/sandbox-error-service.d.ts +23 -0
  147. package/lib/services/sandbox-error-service.js +422 -0
  148. package/lib/services/sandbox-error-service.js.map +1 -0
  149. package/lib/store/models/account-token-store.d.ts +1 -1
  150. package/lib/store/models/account-token-store.js.map +1 -1
  151. package/lib/store/models/ai-fragment.d.ts +4 -0
  152. package/lib/store/models/ai-fragment.js +125 -0
  153. package/lib/store/models/ai-fragment.js.map +1 -0
  154. package/lib/store/models/channel.d.ts +2 -3
  155. package/lib/store/models/channel.js +185 -71
  156. package/lib/store/models/channel.js.map +1 -1
  157. package/lib/store/models/index.d.ts +1 -0
  158. package/lib/store/models/post-thread.d.ts +3 -3
  159. package/lib/store/models/post-thread.js +96 -14
  160. package/lib/store/models/post-thread.js.map +1 -1
  161. package/lib/store/models/post.d.ts +2 -3
  162. package/lib/store/models/post.js +143 -23
  163. package/lib/store/models/post.js.map +1 -1
  164. package/lib/store/models/reaction.d.ts +2 -3
  165. package/lib/store/models/reaction.js +67 -8
  166. package/lib/store/models/reaction.js.map +1 -1
  167. package/lib/store/repositories/__tests__/__fixtures__/team-repository.d.ts +3 -3
  168. package/lib/store/repositories/ai-fragment-repository.d.ts +15 -0
  169. package/lib/store/repositories/ai-fragment-repository.js +69 -0
  170. package/lib/store/repositories/ai-fragment-repository.js.map +1 -0
  171. package/lib/store/repositories/channel-repository.d.ts +6 -6
  172. package/lib/store/repositories/channel-repository.js +5 -2
  173. package/lib/store/repositories/channel-repository.js.map +1 -1
  174. package/lib/store/repositories/index.d.ts +1 -0
  175. package/lib/store/repositories/post-repository.d.ts +6 -6
  176. package/lib/store/repositories/post-repository.js +5 -2
  177. package/lib/store/repositories/post-repository.js.map +1 -1
  178. package/lib/store/repositories/post-thread-repository.d.ts +6 -6
  179. package/lib/store/repositories/post-thread-repository.js +5 -2
  180. package/lib/store/repositories/post-thread-repository.js.map +1 -1
  181. package/lib/store/repositories/reaction-repository.d.ts +6 -6
  182. package/lib/store/repositories/reaction-repository.js +5 -2
  183. package/lib/store/repositories/reaction-repository.js.map +1 -1
  184. package/lib/templates/constants/SERVER_TYPES.ts.template +4 -4
  185. package/lib/templates/repositories/AiFragmentRepository.ts.template +4 -0
  186. package/lib/templates/repositories/ChannelRepository.ts.template +3 -3
  187. package/lib/templates/repositories/PostRepository.ts.template +3 -3
  188. package/lib/templates/repositories/PostThreadRepository.ts.template +3 -3
  189. package/lib/templates/repositories/ReactionRepository.ts.template +3 -4
  190. package/lib/templates/services/AiFragmentService.ts.template +123 -0
  191. package/lib/templates/services/ChannelService.ts.template +290 -39
  192. package/lib/templates/services/ExtendedTokenAccountService.ts.template +104 -9
  193. package/lib/templates/services/MessengerNotificationService.ts.template +94 -19
  194. package/lib/templates/services/PostService.ts.template +265 -20
  195. package/lib/templates/services/PostThreadService.ts.template +151 -6
  196. package/lib/templates/services/ReactionService.ts.template +129 -3
  197. package/lib/templates/services/RedisCacheManager.ts.template +22 -0
  198. package/lib/templates/services/SandboxErrorService.ts.template +125 -0
  199. package/package.json +14 -7
  200. package/lib/interfaces/context.d.ts +0 -14
  201. package/lib/store/models/common-options.js +0 -20
  202. package/lib/store/models/common-options.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis-cache-manager.js","sources":["../../src/services/redis-cache-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";AAYa,IAAA,iBAAiB,GAAvB,mBAAA,GAAA,MAAM,iBAAiB,CAAA;AAIH,EAAA,WAAA;AAHb,EAAA,MAAA;aAGa,CAAA,WAAA,EAAkB,MAEZ,EAAA;QAFN,CAAW,WAAA,GAAA;AAI9B,IAAA,IAAA,CAA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,GAAA,KAAA,CAAA,KAAA,CAAA;UAC3B,GAAA,SAAS,CAAA,GAAG,QAAQ,EAAE,KAAK,CAAA,WAAY,CAAC,IAAE,EAAS;WAClD;;AAGH,EAAA,mBAAwC,CAAE,KAAA,EAAA,GAA8B,EAAE;UACxE,QAAM,GAAA,OAAA,KAAA,KAAA,QAAsB,GAAA,KAAA,GAAA,KAAA,CAAA,KAAA,CAAA;aACzB,SAAA,CAAA,GAAA,QAAA,EAAA,KAAA,CAAA,WAAA,CAAA,IAAA,EAAA;;cAEC;AACN,MAAA;AACH,KAAA,GAAA,GAAE;AACH,IAAA,MAAA,SAAgB,CAAA,EAAA,WAAS,CAAI,CAAA,EAAA,QAAM,CAAA,CAAA,GAAA,EAAA,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA,EAAA,MAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA;IACvC,OAAC,CAAA,EAAA,MAAA,CAAA,QAAA,CAAA,EAAA,MAAA,CAAA,EAAA,EAAA,SAAA,CAAA,EAAA,CAAA;;AA9FQ,EAAiB,WAAA,CAAA,KAAA,EAAA,SAAA,EAAA,GAAA,EAAA;AAD7B,IAAA,MAAA,GAAA,GAAY,qBAAA,CAAA;AAIJ,MAAA,KAAA;AAEA,MAAA,SAAA;;AALI,MAAA,GAAA;;;;;"}
@@ -0,0 +1,23 @@
1
+ import { PubSubEngine } from 'graphql-subscriptions';
2
+ import { CdmLogger } from '@cdm-logger/core';
3
+ import { ISandboxErrorService } from 'common/server';
4
+ export declare class SandboxErrorService implements ISandboxErrorService {
5
+ private readonly pubsub;
6
+ private errorMonitors;
7
+ private reportedErrors;
8
+ private logger;
9
+ constructor(pubsub: PubSubEngine, logger?: CdmLogger.ILogger);
10
+ startErrorMonitoring(projectId: string, sandboxId: string, url: string, id?: string): Promise<void>;
11
+ stopErrorMonitoring(sandboxId: string): Promise<void>;
12
+ private checkForErrors;
13
+ private checkNextJsLogs;
14
+ private parseCompilationErrors;
15
+ private checkPackageJsonErrors;
16
+ private checkServerStatus;
17
+ private checkRuntimeErrors;
18
+ private publishError;
19
+ private createErrorHash;
20
+ reportError(projectId: string, sandboxId: string, errorType: string, message: string, stack?: string, url?: string, id?: string): Promise<void>;
21
+ triggerTestError(projectId: string, id?: string): Promise<void>;
22
+ private isErrorFixable;
23
+ }
@@ -0,0 +1,422 @@
1
+ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {PubSubEngine}from'graphql-subscriptions';import {v4}from'uuid';import'@cdm-logger/core';import {getSandbox}from'../inngest/utils.js';var SandboxErrorService_1;
2
+ let SandboxErrorService = SandboxErrorService_1 = class SandboxErrorService {
3
+ pubsub;
4
+ errorMonitors = new Map();
5
+ reportedErrors = new Map(); // sandboxId -> Set of error hashes
6
+ logger;
7
+ constructor(pubsub, logger) {
8
+ this.pubsub = pubsub;
9
+ this.logger = logger?.child({
10
+ className: SandboxErrorService_1.name
11
+ });
12
+ }
13
+ async startErrorMonitoring(projectId, sandboxId, url, id) {
14
+ // Stop existing monitoring for this sandbox
15
+ await this.stopErrorMonitoring(sandboxId);
16
+ this.logger?.debug('Starting intensive error monitoring for sandbox', {
17
+ sandboxId,
18
+ projectId
19
+ });
20
+ let checkCount = 0;
21
+ // Aggressive monitoring schedule:
22
+ // First 30 seconds: every 2 seconds (15 checks)
23
+ // Next 60 seconds: every 5 seconds (12 checks)
24
+ // After that: every 10 seconds (until stopped)
25
+ const monitor = setInterval(async () => {
26
+ try {
27
+ checkCount++;
28
+ // Determine check interval based on how long we've been monitoring
29
+ let shouldCheck = false;
30
+ if (checkCount <= 15) {
31
+ // First 30 seconds: check every time (every 2 seconds)
32
+ shouldCheck = true;
33
+ } else if (checkCount <= 27) {
34
+ // Next 60 seconds: check every 2.5 iterations (approximately every 5 seconds)
35
+ shouldCheck = checkCount % 2 === 0;
36
+ } else {
37
+ // After 90 seconds: check every 5 iterations (approximately every 10 seconds)
38
+ shouldCheck = checkCount % 5 === 0;
39
+ }
40
+ if (shouldCheck) {
41
+ await this.checkForErrors(projectId, sandboxId, url, id);
42
+ }
43
+ } catch (error) {
44
+ this.logger?.error(`Error monitoring sandbox ${sandboxId}:`, error);
45
+ }
46
+ }, 2000); // Base interval: 2 seconds
47
+ this.errorMonitors.set(sandboxId, monitor);
48
+ }
49
+ async stopErrorMonitoring(sandboxId) {
50
+ const monitor = this.errorMonitors.get(sandboxId);
51
+ if (monitor) {
52
+ clearInterval(monitor);
53
+ this.errorMonitors.delete(sandboxId);
54
+ this.reportedErrors.delete(sandboxId); // Clear error history for this sandbox
55
+ this.logger?.debug('Stopped error monitoring for sandbox', {
56
+ sandboxId
57
+ });
58
+ }
59
+ }
60
+ async checkForErrors(projectId, sandboxId, url, id) {
61
+ try {
62
+ const sandbox = await getSandbox(sandboxId);
63
+ // Check multiple sources for errors sequentially (faster than parallel)
64
+ // Check compilation errors first as they're most common
65
+ await this.checkNextJsLogs(sandbox, projectId, sandboxId, url, id);
66
+ await this.checkServerStatus(sandbox, projectId, sandboxId, url, id);
67
+ await this.checkPackageJsonErrors(sandbox, projectId, sandboxId, url, id);
68
+ } catch (error) {
69
+ this.logger?.error(`Failed to check for errors in sandbox ${sandboxId}:`, error);
70
+ // If it's a connection error, the sandbox might be dead - stop monitoring
71
+ if (error.message.includes('fetch failed') || error.message.includes('connect') || error.message.includes('ECONNREFUSED')) {
72
+ this.logger?.warn('Sandbox appears to be disconnected, stopping monitoring', {
73
+ sandboxId
74
+ });
75
+ await this.stopErrorMonitoring(sandboxId);
76
+ // Report sandbox disconnection as an error only once
77
+ const connectionError = {
78
+ id: id || v4(),
79
+ projectId,
80
+ sandboxId,
81
+ errorType: 'SANDBOX_DISCONNECTED',
82
+ message: `Sandbox connection lost. This usually happens when there are compilation errors that prevent the server from starting, or the sandbox has been terminated.`,
83
+ timestamp: new Date().toISOString(),
84
+ url,
85
+ fixable: true // User can retry with fixed code
86
+ };
87
+ await this.publishError(connectionError);
88
+ return;
89
+ }
90
+ // For other monitoring errors, just log them and continue
91
+ this.logger?.debug(`Monitoring error for sandbox ${sandboxId}: ${error.message}`);
92
+ }
93
+ }
94
+ async checkNextJsLogs(sandbox, projectId, sandboxId, url, id) {
95
+ try {
96
+ // First, check for immediate compilation errors by looking at current Next.js process output
97
+ const immediateErrorCheck = await sandbox.commands.run('timeout 3 sh -c "cd /home/user && npm run dev 2>&1 | head -10" || echo "TIMEOUT_OR_ERROR"');
98
+ if (!immediateErrorCheck.stdout.includes('TIMEOUT_OR_ERROR')) {
99
+ const immediateErrors = this.parseCompilationErrors(immediateErrorCheck.stdout);
100
+ if (immediateErrors.length > 0) {
101
+ const error = {
102
+ id: id || v4(),
103
+ projectId,
104
+ sandboxId,
105
+ errorType: 'COMPILATION_ERROR',
106
+ message: `Immediate compilation error detected:\n${immediateErrors.join('\n')}`,
107
+ stack: immediateErrorCheck.stderr || '',
108
+ timestamp: new Date().toISOString(),
109
+ url,
110
+ fixable: true
111
+ };
112
+ this.logger?.error('Immediate compilation error found in sandbox', {
113
+ sandboxId,
114
+ message: error.message.substring(0, 200)
115
+ });
116
+ await this.publishError(error);
117
+ return;
118
+ }
119
+ }
120
+ // Check the enhanced error monitoring logs
121
+ const errorLogResult = await sandbox.commands.run('cat /home/user/logs/errors.log 2>/dev/null | tail -5 || echo "NO_ERROR_LOG"');
122
+ if (!errorLogResult.stdout.includes('NO_ERROR_LOG')) {
123
+ try {
124
+ const errorLines = errorLogResult.stdout.trim().split('\n').filter(line => line.length > 0);
125
+ for (const line of errorLines) {
126
+ const errorData = JSON.parse(line);
127
+ // Check if this is a recent error (within last 60 seconds for immediate detection)
128
+ const errorTime = new Date(errorData.timestamp);
129
+ const now = new Date();
130
+ const diffSeconds = (now.getTime() - errorTime.getTime()) / 1000;
131
+ if (diffSeconds <= 60 && ['COMPILATION_ERROR', 'UNCAUGHT_EXCEPTION', 'UNHANDLED_REJECTION'].includes(errorData.type)) {
132
+ const error = {
133
+ id: v4(),
134
+ projectId,
135
+ sandboxId,
136
+ errorType: errorData.type,
137
+ message: errorData.message,
138
+ stack: errorData.stack,
139
+ timestamp: new Date().toISOString(),
140
+ url,
141
+ fixable: true
142
+ };
143
+ console.log(`🚨 Structured error found in sandbox ${sandboxId}:`, error.message.substring(0, 200));
144
+ await this.publishError(error);
145
+ return; // Exit after first error found
146
+ }
147
+ }
148
+ } catch (parseError) {
149
+ this.logger?.debug(`Failed to parse error log for sandbox ${sandboxId}: ${parseError.message}`);
150
+ }
151
+ }
152
+ // Check console logs with more comprehensive patterns
153
+ const consoleLogResult = await sandbox.commands.run('cat /home/user/logs/nextjs-console.log 2>/dev/null | tail -30 || echo "NO_CONSOLE_LOG"');
154
+ if (!consoleLogResult.stdout.includes('NO_CONSOLE_LOG')) {
155
+ const compilationErrors = this.parseCompilationErrors(consoleLogResult.stdout);
156
+ if (compilationErrors.length > 0) {
157
+ const error = {
158
+ id: v4(),
159
+ projectId,
160
+ sandboxId,
161
+ errorType: 'COMPILATION_ERROR',
162
+ message: `Compilation errors detected:\n${compilationErrors.join('\n\n')}`,
163
+ timestamp: new Date().toISOString(),
164
+ url,
165
+ fixable: true
166
+ };
167
+ this.logger?.error('Console compilation error found in sandbox', {
168
+ sandboxId,
169
+ message: error.message.substring(0, 200)
170
+ });
171
+ await this.publishError(error);
172
+ return;
173
+ }
174
+ }
175
+ // Check build logs
176
+ const buildLogResult = await sandbox.commands.run('cat /home/user/logs/build.log 2>/dev/null | tail -10 || echo "NO_BUILD_LOG"');
177
+ if (!buildLogResult.stdout.includes('NO_BUILD_LOG')) {
178
+ try {
179
+ const buildLines = buildLogResult.stdout.trim().split('\n').filter(line => line.length > 0);
180
+ for (const line of buildLines) {
181
+ const buildData = JSON.parse(line);
182
+ if (buildData.level === 'error') {
183
+ const error = {
184
+ id: v4(),
185
+ projectId,
186
+ sandboxId,
187
+ errorType: 'BUILD_ERROR',
188
+ message: buildData.message,
189
+ timestamp: new Date().toISOString(),
190
+ url,
191
+ fixable: true
192
+ };
193
+ this.logger?.error('Build error found in sandbox', {
194
+ sandboxId,
195
+ message: error.message.substring(0, 200)
196
+ });
197
+ await this.publishError(error);
198
+ return;
199
+ }
200
+ }
201
+ } catch (parseError) {
202
+ this.logger?.debug(`Failed to parse build log for sandbox ${sandboxId}: ${parseError.message}`);
203
+ }
204
+ }
205
+ } catch (error) {
206
+ this.logger?.debug(`Next.js log check failed for sandbox ${sandboxId}: ${error.message}`);
207
+ }
208
+ }
209
+ parseCompilationErrors(output) {
210
+ const errors = [];
211
+ const lines = output.split('\n');
212
+ const errorPatterns = [/Error:/gi, /Failed to compile/gi, /Module not found/gi, /Syntax error/gi, /Cannot resolve/gi, /TypeError:/gi, /ReferenceError:/gi, /Parsing ecmascript source code failed/gi, /Expected.*but got/gi, /Unexpected token/gi];
213
+ let currentError = '';
214
+ let inError = false;
215
+ for (let i = 0; i < lines.length; i++) {
216
+ const line = lines[i];
217
+ // Check if this line indicates the start of an error
218
+ const isErrorLine = errorPatterns.some(pattern => pattern.test(line));
219
+ if (isErrorLine) {
220
+ // If we were already in an error, save the previous one
221
+ if (inError && currentError.trim()) {
222
+ errors.push(currentError.trim());
223
+ }
224
+ // Start a new error
225
+ currentError = line;
226
+ inError = true;
227
+ } else if (inError) {
228
+ // If we're in an error and this line has relevant context, add it
229
+ if (line.trim() && (line.includes('at ') || line.includes('->') || line.includes('|') || line.includes('^'))) {
230
+ currentError += `\n${line}`;
231
+ } else if (line.trim() === '') {
232
+ // Empty line might indicate end of error context
233
+ continue;
234
+ } else {
235
+ // Non-empty line that doesn't look like error context - end this error
236
+ if (currentError.trim()) {
237
+ errors.push(currentError.trim());
238
+ }
239
+ currentError = '';
240
+ inError = false;
241
+ }
242
+ }
243
+ }
244
+ // Don't forget the last error if we ended while in one
245
+ if (inError && currentError.trim()) {
246
+ errors.push(currentError.trim());
247
+ }
248
+ return errors.filter(error => error.length > 10); // Filter out very short/meaningless errors
249
+ }
250
+ async checkPackageJsonErrors(sandbox, projectId, sandboxId, url, id) {
251
+ try {
252
+ const result = await sandbox.commands.run('npm ls --depth=0 2>&1 || echo "NPM_CHECK_DONE"');
253
+ if (result.stdout.includes('ERESOLVE') || result.stdout.includes('missing:') || result.stdout.includes('invalid:')) {
254
+ const error = {
255
+ id: id || v4(),
256
+ projectId,
257
+ sandboxId,
258
+ errorType: 'DEPENDENCY_ERROR',
259
+ message: `Package dependency issues detected:\n${result.stdout.substring(0, 800)}`,
260
+ timestamp: new Date().toISOString(),
261
+ url,
262
+ fixable: true
263
+ };
264
+ await this.publishError(error);
265
+ }
266
+ } catch (error) {
267
+ this.logger?.debug(`Package.json check failed for sandbox ${sandboxId}: ${error.message}`);
268
+ }
269
+ }
270
+ async checkServerStatus(sandbox, projectId, sandboxId, url, id) {
271
+ try {
272
+ // Check if the server is responding with errors
273
+ const result = await sandbox.commands.run('curl -s -I http://localhost:3000 2>&1 || echo "CURL_FAILED"');
274
+ if (result.stdout.includes('CURL_FAILED') || result.stdout.includes('Connection refused')) {
275
+ // Server is down, check if it's a startup error
276
+ const processCheck = await sandbox.commands.run('ps aux | grep -i next || echo "NO_NEXT_PROCESS"');
277
+ if (processCheck.stdout.includes('NO_NEXT_PROCESS')) {
278
+ const error = {
279
+ id: id || v4(),
280
+ projectId,
281
+ sandboxId,
282
+ errorType: 'SERVER_START_ERROR',
283
+ message: 'Next.js development server failed to start. This usually indicates compilation errors.',
284
+ timestamp: new Date().toISOString(),
285
+ url,
286
+ fixable: true
287
+ };
288
+ await this.publishError(error);
289
+ }
290
+ }
291
+ } catch (error) {
292
+ this.logger?.debug(`Server status check failed for sandbox ${sandboxId}: ${error.message}`);
293
+ }
294
+ }
295
+ async checkRuntimeErrors(projectId, sandboxId, url) {
296
+ try {
297
+ const sandbox = await getSandbox(sandboxId);
298
+ // Check for React error boundaries or console errors
299
+ // This is a simplified approach - in practice you might want to inject a monitoring script
300
+ const checkScript = `
301
+ const puppeteer = require('puppeteer');
302
+ (async () => {
303
+ try {
304
+ const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
305
+ const page = await browser.newPage();
306
+
307
+ const errors = [];
308
+ page.on('pageerror', error => {
309
+ errors.push(error.message);
310
+ });
311
+
312
+ page.on('console', msg => {
313
+ if (msg.type() === 'error') {
314
+ errors.push(msg.text());
315
+ }
316
+ });
317
+
318
+ await page.goto('http://localhost:3000', { waitUntil: 'networkidle0', timeout: 10000 });
319
+ await browser.close();
320
+
321
+ if (errors.length > 0) {
322
+ console.log('RUNTIME_ERRORS:', JSON.stringify(errors));
323
+ }
324
+ } catch (e) {
325
+ console.log('PUPPETEER_ERROR:', e.message);
326
+ }
327
+ })();
328
+ `;
329
+ const result = await sandbox.commands.run(`node -e "${checkScript.replace(/"/g, '\\"')}"`);
330
+ if (result.stdout.includes('RUNTIME_ERRORS:')) {
331
+ const errorsMatch = result.stdout.match(/RUNTIME_ERRORS: (.+)/);
332
+ if (errorsMatch) {
333
+ const errors = JSON.parse(errorsMatch[1]);
334
+ const error = {
335
+ id: v4(),
336
+ projectId,
337
+ sandboxId,
338
+ errorType: 'RUNTIME_ERROR',
339
+ message: errors.join('\n'),
340
+ timestamp: new Date().toISOString(),
341
+ url,
342
+ fixable: true
343
+ };
344
+ await this.publishError(error);
345
+ }
346
+ }
347
+ } catch (error) {
348
+ // Silently handle puppeteer check failures as they're not critical
349
+ this.logger?.debug(`Runtime error check failed for sandbox ${sandboxId}: ${error.message}`);
350
+ }
351
+ }
352
+ async publishError(error) {
353
+ try {
354
+ // Create a hash of the error message to prevent duplicates
355
+ const errorHash = this.createErrorHash(error.message, error.errorType);
356
+ // Check if we've already reported this error for this sandbox
357
+ const reportedForSandbox = this.reportedErrors.get(error.sandboxId) || new Set();
358
+ if (reportedForSandbox.has(errorHash)) {
359
+ this.logger?.debug('Skipping duplicate error for sandbox', {
360
+ sandboxId: error.sandboxId,
361
+ message: `${error.message.substring(0, 100)}...`
362
+ });
363
+ return;
364
+ }
365
+ // Mark this error as reported
366
+ reportedForSandbox.add(errorHash);
367
+ this.reportedErrors.set(error.sandboxId, reportedForSandbox);
368
+ await this.pubsub.publish('SANDBOX_ERROR', {
369
+ sandboxError: {
370
+ projectId: error.projectId,
371
+ sandboxId: error.sandboxId,
372
+ error
373
+ }
374
+ });
375
+ this.logger?.debug('Published new sandbox error for project', {
376
+ projectId: error.projectId,
377
+ message: `${error.message.substring(0, 100)}...`
378
+ });
379
+ } catch (publishError) {
380
+ this.logger?.error('Failed to publish sandbox error: %o', publishError);
381
+ }
382
+ }
383
+ createErrorHash(message, errorType) {
384
+ // Create a simple hash from error message and type to identify duplicates
385
+ // Remove ANSI color codes and normalize whitespace for consistent hashing
386
+ const cleanMessage = message.replace(/\u001b\[[0-9;]*m/g, '') // Remove ANSI color codes
387
+ .replace(/\s+/g, ' ') // Normalize whitespace
388
+ .trim().substring(0, 200); // Use first 200 chars for hash
389
+ return `${errorType}:${cleanMessage}`;
390
+ }
391
+ // Method to manually report an error (can be called from sandbox monitoring tools)
392
+ async reportError(projectId, sandboxId, errorType, message, stack, url, id) {
393
+ const error = {
394
+ id: id || v4(),
395
+ projectId,
396
+ sandboxId,
397
+ errorType,
398
+ message,
399
+ stack,
400
+ timestamp: new Date().toISOString(),
401
+ url,
402
+ fixable: this.isErrorFixable(errorType, message)
403
+ };
404
+ this.logger?.debug('Publishing sandbox error for project', {
405
+ projectId,
406
+ errorType,
407
+ message: `${message.substring(0, 100)}...`,
408
+ fixable: error.fixable
409
+ });
410
+ await this.publishError(error);
411
+ }
412
+ // Method to trigger a test error for debugging
413
+ async triggerTestError(projectId, id) {
414
+ await this.reportError(projectId, `test-sandbox-${Date.now()}`, 'TEST_ERROR', 'This is a test error to verify the sandbox error monitoring system is working correctly.', 'Test stack trace', 'https://test-sandbox.com', id);
415
+ }
416
+ isErrorFixable(errorType, message) {
417
+ // Determine if the error is likely fixable by an LLM
418
+ const fixablePatterns = [/syntax error/i, /module not found/i, /cannot find module/i, /typescript error/i, /type error/i, /compilation error/i, /reference error/i, /undefined variable/i, /missing import/i, /property.*does not exist/i];
419
+ return fixablePatterns.some(pattern => pattern.test(message) || pattern.test(errorType));
420
+ }
421
+ };
422
+ SandboxErrorService = SandboxErrorService_1 = __decorate([injectable(), __param(0, inject('PubSub')), __param(1, inject('Logger')), __metadata("design:paramtypes", [PubSubEngine, Object])], SandboxErrorService);export{SandboxErrorService};//# sourceMappingURL=sandbox-error-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-error-service.js","sources":["../../src/services/sandbox-error-service.ts"],"sourcesContent":[null],"names":["uuidv4"],"mappings":";AAQa,IAAA,mBAAmB,GAAzB,qBAAA,GAAA,MAAM,mBAAmB,CAAA;AAOmB,EAAA,MAAA;AANvC,EAAA,aAAA,GAAgB,IAAA,GAAO,EAAA;AAEvB,EAAA,cAAA,OAAqB,GAAA,EAAG,CAAuB;AAE/C,EAAA,MAAA;aAEuC,CAAA,MAAA,EAAoB,MAA8C,EAAA;QAAlE,CAAM,MAAA,GAAA;AACjD,IAAA,IAAA,CAAA,MAAK,GAAA,MAAS,EAAA,KAAa,CAAA;MAC9B,SAAA,EAAA,qBAAA,CAAA;KAEI,CAAA;;AAED,EAAA,MAAA,oBAAW,CAAA,SAAmB,EAAC,SAAU,EAAC,GAAA,EAAA,EAAA,EAAA;AAE1C;UAEI,IAAA,CAAA,mBAAe,CAAA,SAAA,CAAA;QAEnB,CAAkC,MAAA,EAAA,KAAA,CAAA,iDAAA,EAAA;eACc;;;AAGhD,IAAA,IAAA,aAAa,CAAG;AACZ;AACI;;;AAIA,IAAA,MAAA,OAAA,GAAI,WAAU,CAAA,YAAS;;oBAEnB;;AACG,QAAA,IAAA,WAAA,GAAc,KAAA;sBAC6D,IAAA,EAAA,EAAA;AAC9E;qBACH,GAAA,IAAA;6BAAO,IAAA,EAAA,EAAA;;AAEJ,UAAA,WAAA,GAAA,UAAc,GAAU,CAAA,KAAA,CAAA;;;AAIxB,UAAA,WAAA,GAAA,UAAyB,GAAA,CAAA,KAAA,CAAA;;YAEjC,WAAC,EAAA;gBAAQ,IAAA,CAAA,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AA,CAAA,IAAA,CAAA,SAAA,CAAA,CAAA;;;AAI1C,mBAAM,GACF,qBACiB,GACA,sBAEjB,EACA,EAAA,OACW,CAAA,CAAA,EAAA,MAAA,CAAA,QAAA,CAAA,CAAA,EAAA,OAAA,CAAA,CAAA,EAAA,MAAA,CAAA,QAAA,CAAA,CAAA,EAAA,UAAA,CAAA,mBAAA,EAAA,CAAA,YAAA,EAAA,MAAA,CAAA,CAAA,CAAA,EAAA,mBAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import { IUserAccount } from '@pubngo-stack/account-api-core';
1
+ import { IUserAccount } from 'common';
2
2
  import { Document } from 'mongoose';
3
3
  export type IAccountModel<T = unknown> = Document & IUserAccount & T;
4
4
  export declare const extendedAccountTokenSchema: any;
@@ -1 +1 @@
1
- {"version":3,"file":"account-token-store.js","sources":["../../../src/store/models/account-token-store.ts"],"sourcesContent":[null],"names":[],"mappings":"+BAK+C;aAChC,EAAA;IACb,IAAA,EAAA,MAAA,CAAA,KAAA,CAAA;;"}
1
+ {"version":3,"file":"account-token-store.js","sources":["../../../src/store/models/account-token-store.ts"],"sourcesContent":[null],"names":[],"mappings":"+BAM+C;aAChC,EAAA;IACb,IAAA,EAAA,MAAA,CAAA,KAAA,CAAA;;"}
@@ -0,0 +1,4 @@
1
+ import { Connection, Model } from 'mongoose';
2
+ import { IAiFragmentModel } from 'common/server';
3
+ export type AiFragmentModelType = Model<IAiFragmentModel>;
4
+ export declare const AiFragmentModelFunc: (db: Connection) => AiFragmentModelType;
@@ -0,0 +1,125 @@
1
+ import {Schema}from'mongoose';import {AiFragmentSyncStatus,AiFragmentTemplate}from'common/server';const aiFragmentModelSchema = new Schema({
2
+ messageId: {
3
+ type: Schema.Types.String,
4
+ required: true,
5
+ unique: true,
6
+ trim: true,
7
+ index: true
8
+ },
9
+ sandboxUrl: {
10
+ type: Schema.Types.String,
11
+ required: true,
12
+ trim: true
13
+ },
14
+ title: {
15
+ type: Schema.Types.String,
16
+ required: true,
17
+ trim: true
18
+ },
19
+ files: {
20
+ type: Schema.Types.Mixed,
21
+ required: true,
22
+ default: {}
23
+ },
24
+ template: {
25
+ type: Schema.Types.String,
26
+ enum: Object.values(AiFragmentTemplate),
27
+ default: AiFragmentTemplate.Nextjs
28
+ },
29
+ canvasLayers: {
30
+ type: Schema.Types.Mixed,
31
+ default: null
32
+ },
33
+ fileVersions: {
34
+ type: Schema.Types.Mixed,
35
+ default: {}
36
+ },
37
+ lastSyncAt: {
38
+ type: Schema.Types.Date,
39
+ index: true
40
+ },
41
+ syncStatus: {
42
+ type: Schema.Types.String,
43
+ enum: Object.values(AiFragmentSyncStatus),
44
+ default: AiFragmentSyncStatus.Synced,
45
+ index: true
46
+ },
47
+ owner: {
48
+ type: Schema.Types.String,
49
+ required: true,
50
+ trim: true,
51
+ index: true
52
+ },
53
+ orgName: {
54
+ type: Schema.Types.String,
55
+ required: true,
56
+ trim: true,
57
+ index: true
58
+ },
59
+ createdAt: {
60
+ type: Schema.Types.Date,
61
+ default: Date.now,
62
+ index: true
63
+ },
64
+ updatedAt: {
65
+ type: Schema.Types.Date,
66
+ default: Date.now
67
+ },
68
+ deletedAt: {
69
+ type: Schema.Types.Date,
70
+ index: true
71
+ }
72
+ }, {
73
+ timestamps: true,
74
+ collection: 'ai_fragments',
75
+ toJSON: {
76
+ virtuals: true
77
+ },
78
+ toObject: {
79
+ virtuals: true
80
+ }
81
+ });
82
+ // Virtual fields
83
+ aiFragmentModelSchema.virtual('id').get(function () {
84
+ return this._id.toHexString();
85
+ });
86
+ // Add compound indexes for better query performance
87
+ aiFragmentModelSchema.index({
88
+ owner: 1,
89
+ createdAt: -1
90
+ });
91
+ aiFragmentModelSchema.index({
92
+ orgName: 1,
93
+ createdAt: -1
94
+ });
95
+ aiFragmentModelSchema.index({
96
+ messageId: 1,
97
+ orgName: 1
98
+ });
99
+ aiFragmentModelSchema.index({
100
+ syncStatus: 1,
101
+ lastSyncAt: -1
102
+ });
103
+ aiFragmentModelSchema.index({
104
+ template: 1,
105
+ createdAt: -1
106
+ });
107
+ aiFragmentModelSchema.index({
108
+ createdAt: -1
109
+ });
110
+ aiFragmentModelSchema.index({
111
+ deletedAt: 1
112
+ });
113
+ // Pre-save middleware to update timestamps
114
+ aiFragmentModelSchema.pre('save', function (next) {
115
+ this.updatedAt = new Date();
116
+ next();
117
+ });
118
+ // Pre-update middleware
119
+ aiFragmentModelSchema.pre(['updateOne', 'findOneAndUpdate'], function (next) {
120
+ this.set({
121
+ updatedAt: new Date()
122
+ });
123
+ next();
124
+ });
125
+ const AiFragmentModelFunc = db => db.model('ai_fragments', aiFragmentModelSchema);export{AiFragmentModelFunc};//# sourceMappingURL=ai-fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-fragment.js","sources":["../../../src/store/models/ai-fragment.ts"],"sourcesContent":[null],"names":[],"mappings":"kGAGA,MAAM,qBAAqB,GAAG,IAAI,MAAM,CACpC;AACI,EAAA,SAAA,EAAS;AACL,IAAA,IAAA,EAAA,MAAM,CAAA,KAAO,CAAA,MAAY;AACzB,IAAA,QAAA,EAAA,IAAU;AACV,IAAA,MAAA,EAAA,IAAQ;AACR,IAAA,IAAA,EAAA,IAAM;AACN,IAAA,KAAA,EAAA;AACH,GAAA;AACD,EAAA,UAAA,EAAU;AACN,IAAA,IAAA,EAAA,MAAM,CAAA,KAAO,CAAA,MAAY;AACzB,IAAA,QAAA,EAAA,IAAU;AACV,IAAA,IAAA,EAAA;AACH,GAAA;AACD,EAAA,KAAA,EAAK;AACD,IAAA,IAAA,EAAA,MAAM,CAAA,KAAO,CAAA,MAAY;AACzB,IAAA,QAAA,EAAA,IAAU;AACV,IAAA,IAAA,EAAA;AACH,GAAA;AACD,EAAA,KAAA,EAAK;AACD,IAAA,IAAA,EAAA,MAAM,CAAA,KAAO,CAAA,KAAW;AACxB,IAAA,QAAA,EAAA,IAAU;AACV,IAAA,OAAA,EAAA;AACH,GAAA;AACD,EAAA,QAAA,EAAQ;AACJ,IAAA,IA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,GAAA;AACD,EAAA,SAAA,EAAS;AACL,IAAA,IAAA,EAAA,MAAM,CAAA,KAAO,CAAA,IAAM;AACnB,IAAA,KAAA,EAAA;AACH;CACJ,EACD;AACI,EAAA,UAAA,EAAU,IAAM;AAChB,EAAA,UAAA,EAAU,cAAgB;AAC1B,EAAA,MAAA,EAAM;AACN,IAAA,QAAQ,EAAE;AACb,GACH;AAEF,EAAiB,QAAA,EAAA;AACjB,IAAA,QAAA,EAAA;AACI;AACJ,CAAC,CAAC;AAEF;AACA,qBAAqB,CAAC,OAAM,CAAE,KAAK,CAAE,GAAG,CAAA,YAAY;AACpD,EAAA,OAAA,IAAA,CAAA,GAAA,CAAA,WAA4B;AAC5B,CAAA,CAAA;AACA;AACA,qBAAqB,CAAC,KAAK,CAAC;AAC5B,EAAqB,KAAA,EAAA,CAAA;AACrB,EAAqB,SAAA,EAAA;AAErB,CAA2C,CAAA;AAC3C,qBAAqB,CAAC,KAAU,CAAA;AAC3B,EAAA,OAAa,EAAS,CAAA;AACvB,EAAA,SAAO,EAAA;AACX,CAAC,CAAC;AAEF,qBAAwB,CAAA,KAAA,CAAA;AACxB,EAAqB,SAAA,EAAA,CAAA;SACZ,EAAG;AACR,CAAA,CAAA;AACJ,qBAAG,CAAA,KAAA,CAAA;AAGH,EAAA,UAAa,EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,4 @@
1
- import { Connection, Document, Model } from 'mongoose';
2
- import { IChannel } from 'common';
3
- export type IChannelModel = Document<IChannel>;
1
+ import { Connection, Model } from 'mongoose';
2
+ import { IChannelModel } from 'common/server';
4
3
  export type ChannelModelType = Model<IChannelModel>;
5
4
  export declare const ChannelModelFunc: (db: Connection) => ChannelModelType;