briyah 1.0.6 → 1.0.8

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 (93) hide show
  1. package/README.md +32 -22
  2. package/dist/server/src/ai/LLM/anthropic.service.js +19 -15
  3. package/dist/server/src/ai/LLM/base-ai.service.js +5 -4
  4. package/dist/server/src/ai/LLM/deepseek.service.js +11 -13
  5. package/dist/server/src/ai/LLM/fal.service.js +20 -24
  6. package/dist/server/src/ai/LLM/googleai.service.js +13 -15
  7. package/dist/server/src/ai/LLM/grok.service.js +12 -14
  8. package/dist/server/src/ai/LLM/mock.service.js +9 -11
  9. package/dist/server/src/ai/LLM/openai.service.js +18 -20
  10. package/dist/server/src/ai/LLM/together.service.js +14 -13
  11. package/dist/server/src/ai/LLM/vertexai.service.js +12 -14
  12. package/dist/server/src/ai/agent-store.service.js +12 -11
  13. package/dist/server/src/ai/artifact.service.js +7 -6
  14. package/dist/server/src/ai/attached-file.service.js +8 -7
  15. package/dist/server/src/ai/model_prices.d.ts +1 -2
  16. package/dist/server/src/ai/model_prices.js +15 -14
  17. package/dist/server/src/ai/published-agents.service.js +6 -5
  18. package/dist/server/src/app/balance.service.js +7 -6
  19. package/dist/server/src/app/stripe.controller.js +12 -11
  20. package/dist/server/src/app/stripe.service.js +20 -19
  21. package/dist/server/src/app/transaction.service.js +6 -5
  22. package/dist/server/src/app/user-service-manager.js +6 -5
  23. package/dist/server/src/app.controller.js +95 -94
  24. package/dist/server/src/app.service.js +31 -30
  25. package/dist/server/src/auth/auth.controller.js +21 -20
  26. package/dist/server/src/auth/jwt-auth.guard.js +4 -3
  27. package/dist/server/src/auth/rate-limit.service.d.ts +0 -1
  28. package/dist/server/src/auth/rate-limit.service.js +6 -7
  29. package/dist/server/src/auth/twilio.service.js +4 -3
  30. package/dist/server/src/auth/users.service.js +6 -5
  31. package/dist/server/src/common/logger.d.ts +21 -0
  32. package/dist/server/src/common/logger.js +83 -0
  33. package/dist/server/src/config/configuration.service.js +1 -1
  34. package/dist/server/src/room/artifact-store.service.d.ts +0 -1
  35. package/dist/server/src/room/artifact-store.service.js +16 -17
  36. package/dist/server/src/room/published-rooms.service.js +5 -3
  37. package/dist/server/src/room/room-store.service.js +17 -16
  38. package/dist/server/src/room/room.js +14 -13
  39. package/dist/server/src/sdk/briyah-config.d.ts +7 -0
  40. package/dist/server/src/sdk/briyah-config.js +2 -0
  41. package/dist/server/src/sdk/briyah.js +14 -5
  42. package/dist/server/src/sdk/index.d.ts +2 -1
  43. package/dist/server/src/story/story-progress.service.js +2 -1
  44. package/dist/server/src/story/story-store.service.js +28 -27
  45. package/dist/server/src/story/story.service.js +113 -112
  46. package/docs/.nojekyll +1 -0
  47. package/docs/assets/hierarchy.js +1 -0
  48. package/docs/assets/highlight.css +106 -0
  49. package/docs/assets/icons.js +18 -0
  50. package/docs/assets/icons.svg +1 -0
  51. package/docs/assets/main.js +60 -0
  52. package/docs/assets/navigation.js +1 -0
  53. package/docs/assets/search.js +1 -0
  54. package/docs/assets/style.css +1633 -0
  55. package/docs/classes/Agent.html +87 -0
  56. package/docs/classes/Briyah.html +64 -0
  57. package/docs/classes/BriyahConfigService.html +12 -0
  58. package/docs/classes/Room.html +119 -0
  59. package/docs/enums/MessageAction.html +13 -0
  60. package/docs/hierarchy.html +1 -0
  61. package/docs/index.html +136 -0
  62. package/docs/interfaces/AgentInfo.html +17 -0
  63. package/docs/interfaces/AgentMessagesResponse.html +5 -0
  64. package/docs/interfaces/AppService.html +680 -0
  65. package/docs/interfaces/ArtifactMetadata.html +8 -0
  66. package/docs/interfaces/AttachDocumentResponse.html +3 -0
  67. package/docs/interfaces/BriyahConfigOptions.html +16 -0
  68. package/docs/interfaces/ChapterInfo.html +3 -0
  69. package/docs/interfaces/Character.html +7 -0
  70. package/docs/interfaces/CreateAgentResponse.html +2 -0
  71. package/docs/interfaces/CreateRoomResponse.html +3 -0
  72. package/docs/interfaces/CreateStoryResponse.html +2 -0
  73. package/docs/interfaces/FileList.html +2 -0
  74. package/docs/interfaces/LoggingOptions.html +9 -0
  75. package/docs/interfaces/Message.html +6 -0
  76. package/docs/interfaces/ModelInfo.html +5 -0
  77. package/docs/interfaces/PreparedPromptResponse.html +3 -0
  78. package/docs/interfaces/ProcessTextResponse.html +7 -0
  79. package/docs/interfaces/PromptFile.html +3 -0
  80. package/docs/interfaces/PromptFileContent.html +3 -0
  81. package/docs/interfaces/PromptFilesResponse.html +2 -0
  82. package/docs/interfaces/PromptFolder.html +3 -0
  83. package/docs/interfaces/PromptFoldersResponse.html +2 -0
  84. package/docs/interfaces/RoomDetails.html +9 -0
  85. package/docs/interfaces/RoomInfo.html +5 -0
  86. package/docs/interfaces/RoomMessagesResponse.html +3 -0
  87. package/docs/interfaces/StoryIdea.html +5 -0
  88. package/docs/interfaces/StoryInfo.html +21 -0
  89. package/docs/interfaces/StoryState.html +9 -0
  90. package/docs/modules.html +1 -0
  91. package/docs/types/PromptScope.html +1 -0
  92. package/package.json +6 -3
  93. package/data/common/config/story_ideas.txt +0 -6
@@ -57,6 +57,7 @@ const published_agents_service_1 = require("./ai/published-agents.service");
57
57
  const published_rooms_service_1 = require("./room/published-rooms.service");
58
58
  const errors_1 = require("./common/errors");
59
59
  const path = __importStar(require("path"));
60
+ const logger_1 = require("./common/logger");
60
61
  let AppController = class AppController {
61
62
  userServiceManager;
62
63
  publishedAgentsService;
@@ -99,7 +100,7 @@ let AppController = class AppController {
99
100
  return await appService.listAiModels(aiServiceName);
100
101
  }
101
102
  catch (error) {
102
- console.error(`[${req.user?.sub}] Error listing models for ${aiServiceName}:`, error);
103
+ logger_1.logger.error(`[${req.user?.sub}] Error listing models for ${aiServiceName}:`, error);
103
104
  throw new common_1.HttpException('Failed to list models', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
104
105
  }
105
106
  }
@@ -109,7 +110,7 @@ let AppController = class AppController {
109
110
  return appService.listImageModels();
110
111
  }
111
112
  catch (error) {
112
- console.error('Error reading image models:', error);
113
+ logger_1.logger.error('Error reading image models:', error);
113
114
  throw new common_1.HttpException('Failed to list image models', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
114
115
  }
115
116
  }
@@ -119,7 +120,7 @@ let AppController = class AppController {
119
120
  return appService.listStoryModels();
120
121
  }
121
122
  catch (error) {
122
- console.error('Error reading story models:', error);
123
+ logger_1.logger.error('Error reading story models:', error);
123
124
  throw new common_1.HttpException('Failed to list story models', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
124
125
  }
125
126
  }
@@ -169,7 +170,7 @@ let AppController = class AppController {
169
170
  if (error instanceof common_1.ForbiddenException || error instanceof common_1.BadRequestException) {
170
171
  throw error;
171
172
  }
172
- console.error(`[${req.user?.sub}] Error processing text for agent ${agentId}:`, error);
173
+ logger_1.logger.error(`[${req.user?.sub}] Error processing text for agent ${agentId}:`, error);
173
174
  if (error instanceof errors_1.NotFoundError) {
174
175
  return {
175
176
  result: `Error: ${error.message}`,
@@ -205,7 +206,7 @@ let AppController = class AppController {
205
206
  };
206
207
  }
207
208
  catch (error) {
208
- console.error(`[${req.user?.sub}] Error attaching document to agent ${agentId}:`, error);
209
+ logger_1.logger.error(`[${req.user?.sub}] Error attaching document to agent ${agentId}:`, error);
209
210
  if (error instanceof errors_1.NotFoundError) {
210
211
  throw new common_1.NotFoundException(error.message);
211
212
  }
@@ -221,7 +222,7 @@ let AppController = class AppController {
221
222
  return appService.listAttachedFiles(agentId);
222
223
  }
223
224
  catch (error) {
224
- console.error(`[${req.user?.sub}] Error listing attached files for agent ${agentId}:`, error);
225
+ logger_1.logger.error(`[${req.user?.sub}] Error listing attached files for agent ${agentId}:`, error);
225
226
  return { files: [] };
226
227
  }
227
228
  }
@@ -231,7 +232,7 @@ let AppController = class AppController {
231
232
  return appService.listPromptFoldersWithScope(scope);
232
233
  }
233
234
  catch (error) {
234
- console.error(`[${req.user?.sub}] Error listing prompt folders:`, error);
235
+ logger_1.logger.error(`[${req.user?.sub}] Error listing prompt folders:`, error);
235
236
  return { folders: [] };
236
237
  }
237
238
  }
@@ -244,7 +245,7 @@ let AppController = class AppController {
244
245
  appService.createPromptFolder(body.name);
245
246
  }
246
247
  catch (error) {
247
- console.error(`[${req.user?.sub}] Error creating prompt folder ${body.name}:`, error);
248
+ logger_1.logger.error(`[${req.user?.sub}] Error creating prompt folder ${body.name}:`, error);
248
249
  if (error instanceof errors_1.OperationFailedError) {
249
250
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
250
251
  }
@@ -257,7 +258,7 @@ let AppController = class AppController {
257
258
  appService.deletePromptFolder(folderName);
258
259
  }
259
260
  catch (error) {
260
- console.error(`[${req.user?.sub}] Error deleting prompt folder ${folderName}:`, error);
261
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting prompt folder ${folderName}:`, error);
261
262
  if (error instanceof errors_1.NotFoundError) {
262
263
  throw new common_1.NotFoundException(error.message);
263
264
  }
@@ -273,7 +274,7 @@ let AppController = class AppController {
273
274
  return appService.listPromptFilesWithScope(folderName);
274
275
  }
275
276
  catch (error) {
276
- console.error(`[${req.user?.sub}] Error listing prompt files for folder ${folderName}:`, error);
277
+ logger_1.logger.error(`[${req.user?.sub}] Error listing prompt files for folder ${folderName}:`, error);
277
278
  return { files: [] };
278
279
  }
279
280
  }
@@ -283,7 +284,7 @@ let AppController = class AppController {
283
284
  return appService.getPromptFile(folderName, fileName);
284
285
  }
285
286
  catch (error) {
286
- console.error(`[${req.user?.sub}] Error getting prompt file ${folderName}/${fileName}:`, error);
287
+ logger_1.logger.error(`[${req.user?.sub}] Error getting prompt file ${folderName}/${fileName}:`, error);
287
288
  return { content: '' };
288
289
  }
289
290
  }
@@ -302,7 +303,7 @@ let AppController = class AppController {
302
303
  appService.savePromptFile(folderName, body.name, body.content, body.fileType);
303
304
  }
304
305
  catch (error) {
305
- console.error(`[${req.user?.sub}] Error creating prompt file ${folderName}/${body.name}:`, error);
306
+ logger_1.logger.error(`[${req.user?.sub}] Error creating prompt file ${folderName}/${body.name}:`, error);
306
307
  if (error instanceof errors_1.OperationFailedError) {
307
308
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
308
309
  }
@@ -321,7 +322,7 @@ let AppController = class AppController {
321
322
  appService.savePromptFile(folderName, fileName, body.content, body.fileType);
322
323
  }
323
324
  catch (error) {
324
- console.error(`[${req.user?.sub}] Error updating prompt file ${folderName}/${fileName}:`, error);
325
+ logger_1.logger.error(`[${req.user?.sub}] Error updating prompt file ${folderName}/${fileName}:`, error);
325
326
  if (error instanceof errors_1.OperationFailedError) {
326
327
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
327
328
  }
@@ -334,7 +335,7 @@ let AppController = class AppController {
334
335
  appService.deletePromptFile(folderName, fileName);
335
336
  }
336
337
  catch (error) {
337
- console.error(`[${req.user?.sub}] Error deleting prompt file ${folderName}/${fileName}:`, error);
338
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting prompt file ${folderName}/${fileName}:`, error);
338
339
  if (error instanceof errors_1.NotFoundError) {
339
340
  throw new common_1.NotFoundException(error.message);
340
341
  }
@@ -350,7 +351,7 @@ let AppController = class AppController {
350
351
  return appService.listPromptFolders();
351
352
  }
352
353
  catch (error) {
353
- console.error(`[${req.user?.sub}] Error listing prompt folders:`, error);
354
+ logger_1.logger.error(`[${req.user?.sub}] Error listing prompt folders:`, error);
354
355
  return [];
355
356
  }
356
357
  }
@@ -360,7 +361,7 @@ let AppController = class AppController {
360
361
  return appService.listPrompts(agentId);
361
362
  }
362
363
  catch (error) {
363
- console.error(`[${req.user?.sub}] Error listing prompts for agent ${agentId}:`, error);
364
+ logger_1.logger.error(`[${req.user?.sub}] Error listing prompts for agent ${agentId}:`, error);
364
365
  if (error instanceof errors_1.NotFoundError) {
365
366
  throw new common_1.NotFoundException(error.message);
366
367
  }
@@ -379,7 +380,7 @@ let AppController = class AppController {
379
380
  return await appService.runPreparedPrompt(agentId, promptName, body.variables);
380
381
  }
381
382
  catch (error) {
382
- console.error(`[${req.user?.sub}] Error running prepared prompt for agent ${agentId}:`, error);
383
+ logger_1.logger.error(`[${req.user?.sub}] Error running prepared prompt for agent ${agentId}:`, error);
383
384
  if (error instanceof errors_1.NotFoundError) {
384
385
  throw new common_1.NotFoundException(error.message);
385
386
  }
@@ -395,7 +396,7 @@ let AppController = class AppController {
395
396
  return await appService.listAgents();
396
397
  }
397
398
  catch (error) {
398
- console.error(`[${req.user?.sub}] Error listing agents:`, error);
399
+ logger_1.logger.error(`[${req.user?.sub}] Error listing agents:`, error);
399
400
  return [];
400
401
  }
401
402
  }
@@ -417,7 +418,7 @@ let AppController = class AppController {
417
418
  return await appService.createRoom(body.roomName, body.roomGoal, body.agentIds);
418
419
  }
419
420
  catch (error) {
420
- console.error(`[${req.user?.sub}] Error creating room ${body.roomName}:`, error);
421
+ logger_1.logger.error(`[${req.user?.sub}] Error creating room ${body.roomName}:`, error);
421
422
  throw new common_1.HttpException(error.message || 'Failed to create room', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
422
423
  }
423
424
  }
@@ -427,7 +428,7 @@ let AppController = class AppController {
427
428
  await appService.editRoom(roomId, body.roomName, body.roomGoal, body.baseRoomDir, body.agentIds);
428
429
  }
429
430
  catch (error) {
430
- console.error(`[${req.user?.sub}] Error editing room ${roomId}:`, error);
431
+ logger_1.logger.error(`[${req.user?.sub}] Error editing room ${roomId}:`, error);
431
432
  if (error instanceof errors_1.NotFoundError) {
432
433
  throw new common_1.NotFoundException(error.message);
433
434
  }
@@ -440,7 +441,7 @@ let AppController = class AppController {
440
441
  return appService.listRooms();
441
442
  }
442
443
  catch (error) {
443
- console.error(`[${req.user?.sub}] Error listing rooms:`, error);
444
+ logger_1.logger.error(`[${req.user?.sub}] Error listing rooms:`, error);
444
445
  return [];
445
446
  }
446
447
  }
@@ -454,7 +455,7 @@ let AppController = class AppController {
454
455
  return roomDetails;
455
456
  }
456
457
  catch (error) {
457
- console.error(`[${req.user?.sub}] Error getting room details for ${roomId}:`, error);
458
+ logger_1.logger.error(`[${req.user?.sub}] Error getting room details for ${roomId}:`, error);
458
459
  if (error instanceof common_1.NotFoundException) {
459
460
  throw error;
460
461
  }
@@ -474,7 +475,7 @@ let AppController = class AppController {
474
475
  return agentDetails;
475
476
  }
476
477
  catch (error) {
477
- console.error(`[${req.user?.sub}] Error getting agent details for ${agentId}:`, error);
478
+ logger_1.logger.error(`[${req.user?.sub}] Error getting agent details for ${agentId}:`, error);
478
479
  if (error instanceof common_1.NotFoundException || error instanceof common_1.ForbiddenException) {
479
480
  throw error;
480
481
  }
@@ -489,7 +490,7 @@ let AppController = class AppController {
489
490
  return appService.getRoomMessages(roomId, index, includeThoughts);
490
491
  }
491
492
  catch (error) {
492
- console.error(`[${req.user?.sub}] Error getting room messages for ${roomId}:`, error);
493
+ logger_1.logger.error(`[${req.user?.sub}] Error getting room messages for ${roomId}:`, error);
493
494
  return { messages: [], totalCost: 0 };
494
495
  }
495
496
  }
@@ -506,7 +507,7 @@ let AppController = class AppController {
506
507
  return await appService.getAgentMessages(agentId, index);
507
508
  }
508
509
  catch (error) {
509
- console.error(`[${req.user?.sub}] Error getting agent messages for ${agentId}:`, error);
510
+ logger_1.logger.error(`[${req.user?.sub}] Error getting agent messages for ${agentId}:`, error);
510
511
  if (error instanceof common_1.ForbiddenException) {
511
512
  throw error;
512
513
  }
@@ -525,7 +526,7 @@ let AppController = class AppController {
525
526
  return appService.getStoryMessages(storyId, index);
526
527
  }
527
528
  catch (error) {
528
- console.error(`[${req.user?.sub}] Error getting story messages for ${storyId}:`, error);
529
+ logger_1.logger.error(`[${req.user?.sub}] Error getting story messages for ${storyId}:`, error);
529
530
  return { messages: [], totalCost: 0 };
530
531
  }
531
532
  }
@@ -538,7 +539,7 @@ let AppController = class AppController {
538
539
  await appService.deleteAgent(agentId);
539
540
  }
540
541
  catch (error) {
541
- console.error(`[${req.user?.sub}] Error deleting agent ${agentId}:`, error);
542
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting agent ${agentId}:`, error);
542
543
  if (error instanceof errors_1.NotFoundError) {
543
544
  throw new common_1.NotFoundException(error.message);
544
545
  }
@@ -561,7 +562,7 @@ let AppController = class AppController {
561
562
  return result;
562
563
  }
563
564
  catch (error) {
564
- console.error(`[${req.user?.sub}] Error publishing agent instance for ${agentId}:`, error);
565
+ logger_1.logger.error(`[${req.user?.sub}] Error publishing agent instance for ${agentId}:`, error);
565
566
  if (error instanceof errors_1.NotFoundError) {
566
567
  throw new common_1.NotFoundException(error.message);
567
568
  }
@@ -577,7 +578,7 @@ let AppController = class AppController {
577
578
  return await appService.getPublishedInstances(agentId);
578
579
  }
579
580
  catch (error) {
580
- console.error(`[${req.user?.sub}] Error getting published instances for ${agentId}:`, error);
581
+ logger_1.logger.error(`[${req.user?.sub}] Error getting published instances for ${agentId}:`, error);
581
582
  throw new common_1.HttpException('Failed to get published instances', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
582
583
  }
583
584
  }
@@ -590,7 +591,7 @@ let AppController = class AppController {
590
591
  await appService.resetPublishedInstance(instanceId);
591
592
  }
592
593
  catch (error) {
593
- console.error(`[${req.user?.sub}] Error resetting published instance ${instanceId}:`, error);
594
+ logger_1.logger.error(`[${req.user?.sub}] Error resetting published instance ${instanceId}:`, error);
594
595
  if (error instanceof errors_1.NotFoundError) {
595
596
  throw new common_1.NotFoundException(error.message);
596
597
  }
@@ -609,7 +610,7 @@ let AppController = class AppController {
609
610
  await appService.deleteRoom(roomId);
610
611
  }
611
612
  catch (error) {
612
- console.error(`[${req.user?.sub}] Error deleting room ${roomId}:`, error);
613
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting room ${roomId}:`, error);
613
614
  if (error instanceof errors_1.NotFoundError) {
614
615
  throw new common_1.NotFoundException(error.message);
615
616
  }
@@ -631,7 +632,7 @@ let AppController = class AppController {
631
632
  await appService.sendRoomMessage(roomId, body.content, body.sender, body.action, body.targets, body.clearQueue || false);
632
633
  }
633
634
  catch (error) {
634
- console.error(`[${req.user?.sub}] Error sending room message to ${roomId}:`, error);
635
+ logger_1.logger.error(`[${req.user?.sub}] Error sending room message to ${roomId}:`, error);
635
636
  if (error instanceof errors_1.NotFoundError) {
636
637
  throw new common_1.NotFoundException(error.message);
637
638
  }
@@ -651,7 +652,7 @@ let AppController = class AppController {
651
652
  return { success: true };
652
653
  }
653
654
  catch (error) {
654
- console.error(`[${req.user?.sub}] Error pausing room ${roomId}:`, error);
655
+ logger_1.logger.error(`[${req.user?.sub}] Error pausing room ${roomId}:`, error);
655
656
  if (error instanceof errors_1.NotFoundError) {
656
657
  throw new common_1.NotFoundException(error.message);
657
658
  }
@@ -665,7 +666,7 @@ let AppController = class AppController {
665
666
  return { success: true };
666
667
  }
667
668
  catch (error) {
668
- console.error(`[${req.user?.sub}] Error resuming room ${roomId}:`, error);
669
+ logger_1.logger.error(`[${req.user?.sub}] Error resuming room ${roomId}:`, error);
669
670
  if (error instanceof errors_1.NotFoundError) {
670
671
  throw new common_1.NotFoundException(error.message);
671
672
  }
@@ -678,7 +679,7 @@ let AppController = class AppController {
678
679
  return appService.getUserPreferences();
679
680
  }
680
681
  catch (error) {
681
- console.error(`[${req.user?.sub}] Error getting user preferences:`, error);
682
+ logger_1.logger.error(`[${req.user?.sub}] Error getting user preferences:`, error);
682
683
  return {};
683
684
  }
684
685
  }
@@ -688,7 +689,7 @@ let AppController = class AppController {
688
689
  appService.saveUserPreferences(preferences);
689
690
  }
690
691
  catch (error) {
691
- console.error(`[${req.user?.sub}] Error saving user preferences:`, error);
692
+ logger_1.logger.error(`[${req.user?.sub}] Error saving user preferences:`, error);
692
693
  if (error instanceof errors_1.OperationFailedError) {
693
694
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
694
695
  }
@@ -701,7 +702,7 @@ let AppController = class AppController {
701
702
  return appService.listPromptFiles(folderName);
702
703
  }
703
704
  catch (error) {
704
- console.error(`[${req.user?.sub}] Error listing prompt files for folder ${folderName}:`, error);
705
+ logger_1.logger.error(`[${req.user?.sub}] Error listing prompt files for folder ${folderName}:`, error);
705
706
  return { files: [] };
706
707
  }
707
708
  }
@@ -711,7 +712,7 @@ let AppController = class AppController {
711
712
  return appService.getPromptFile(folderName, fileName);
712
713
  }
713
714
  catch (error) {
714
- console.error(`[${req.user?.sub}] Error getting prompt file ${folderName}/${fileName}:`, error);
715
+ logger_1.logger.error(`[${req.user?.sub}] Error getting prompt file ${folderName}/${fileName}:`, error);
715
716
  return { content: '' };
716
717
  }
717
718
  }
@@ -721,7 +722,7 @@ let AppController = class AppController {
721
722
  appService.savePromptFile(body.folderName, body.fileName, body.content, body.fileType);
722
723
  }
723
724
  catch (error) {
724
- console.error(`[${req.user?.sub}] Error saving prompt file ${body.folderName}/${body.fileName}:`, error);
725
+ logger_1.logger.error(`[${req.user?.sub}] Error saving prompt file ${body.folderName}/${body.fileName}:`, error);
725
726
  if (error instanceof errors_1.OperationFailedError) {
726
727
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
727
728
  }
@@ -734,7 +735,7 @@ let AppController = class AppController {
734
735
  appService.deletePromptFile(body.folderName, body.fileName);
735
736
  }
736
737
  catch (error) {
737
- console.error(`[${req.user?.sub}] Error deleting prompt file ${body.folderName}/${body.fileName}:`, error);
738
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting prompt file ${body.folderName}/${body.fileName}:`, error);
738
739
  if (error instanceof errors_1.NotFoundError) {
739
740
  throw new common_1.NotFoundException(error.message);
740
741
  }
@@ -750,7 +751,7 @@ let AppController = class AppController {
750
751
  appService.deletePromptFolder(body.folderName);
751
752
  }
752
753
  catch (error) {
753
- console.error(`[${req.user?.sub}] Error deleting prompt folder ${body.folderName}:`, error);
754
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting prompt folder ${body.folderName}:`, error);
754
755
  if (error instanceof errors_1.NotFoundError) {
755
756
  throw new common_1.NotFoundException(error.message);
756
757
  }
@@ -766,7 +767,7 @@ let AppController = class AppController {
766
767
  await appService.updateAgent(agentId, updateData);
767
768
  }
768
769
  catch (error) {
769
- console.error(`[${req.user?.sub}] Error updating agent ${agentId}:`, error);
770
+ logger_1.logger.error(`[${req.user?.sub}] Error updating agent ${agentId}:`, error);
770
771
  if (error instanceof errors_1.NotFoundError) {
771
772
  throw new common_1.NotFoundException(error.message);
772
773
  }
@@ -788,7 +789,7 @@ let AppController = class AppController {
788
789
  appService.deleteAttachedFileById(documentId);
789
790
  }
790
791
  catch (error) {
791
- console.error(`[${req.user?.sub}] Error deleting attached file ${documentId} from agent ${agentId}:`, error);
792
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting attached file ${documentId} from agent ${agentId}:`, error);
792
793
  if (error instanceof errors_1.NotFoundError) {
793
794
  throw new common_1.NotFoundException(error.message);
794
795
  }
@@ -813,7 +814,7 @@ let AppController = class AppController {
813
814
  await appService.reloadAgent(agentId);
814
815
  }
815
816
  catch (error) {
816
- console.error(`[${req.user?.sub}] Error reloading agent ${agentId}:`, error);
817
+ logger_1.logger.error(`[${req.user?.sub}] Error reloading agent ${agentId}:`, error);
817
818
  if (error instanceof errors_1.NotFoundError) {
818
819
  throw new common_1.NotFoundException(error.message);
819
820
  }
@@ -835,7 +836,7 @@ let AppController = class AppController {
835
836
  await appService.resetRoom(roomId);
836
837
  }
837
838
  catch (error) {
838
- console.error(`[${req.user?.sub}] Error resetting room ${roomId}:`, error);
839
+ logger_1.logger.error(`[${req.user?.sub}] Error resetting room ${roomId}:`, error);
839
840
  if (error instanceof errors_1.NotFoundError) {
840
841
  throw new common_1.NotFoundException(error.message);
841
842
  }
@@ -853,7 +854,7 @@ let AppController = class AppController {
853
854
  return { roomId: instanceId };
854
855
  }
855
856
  catch (error) {
856
- console.error(`[${req.user?.sub}] Error publishing room ${templateId}:`, error);
857
+ logger_1.logger.error(`[${req.user?.sub}] Error publishing room ${templateId}:`, error);
857
858
  if (error instanceof errors_1.NotFoundError) {
858
859
  throw new common_1.NotFoundException(error.message);
859
860
  }
@@ -866,7 +867,7 @@ let AppController = class AppController {
866
867
  return await appService.getPublishedRoomInstances(templateId);
867
868
  }
868
869
  catch (error) {
869
- console.error(`[${req.user?.sub}] Error getting published instances for room ${templateId}:`, error);
870
+ logger_1.logger.error(`[${req.user?.sub}] Error getting published instances for room ${templateId}:`, error);
870
871
  throw new common_1.HttpException('Failed to get published instances', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
871
872
  }
872
873
  }
@@ -876,7 +877,7 @@ let AppController = class AppController {
876
877
  await appService.resetPublishedRoomInstance(instanceId);
877
878
  }
878
879
  catch (error) {
879
- console.error(`[${req.user?.sub}] Error resetting room instance ${instanceId}:`, error);
880
+ logger_1.logger.error(`[${req.user?.sub}] Error resetting room instance ${instanceId}:`, error);
880
881
  if (error instanceof errors_1.NotFoundError || error instanceof errors_1.OperationFailedError) {
881
882
  throw new common_1.NotFoundException(error.message);
882
883
  }
@@ -892,7 +893,7 @@ let AppController = class AppController {
892
893
  await appService.resetStory(storyId);
893
894
  }
894
895
  catch (error) {
895
- console.error(`[${req.user?.sub}] Error resetting story ${storyId}:`, error);
896
+ logger_1.logger.error(`[${req.user?.sub}] Error resetting story ${storyId}:`, error);
896
897
  if (error instanceof errors_1.NotFoundError) {
897
898
  throw new common_1.NotFoundException(error.message);
898
899
  }
@@ -908,7 +909,7 @@ let AppController = class AppController {
908
909
  return appService.getRoomArtifacts(roomId);
909
910
  }
910
911
  catch (error) {
911
- console.error(`[${req.user?.sub}] Error getting room artifacts for ${roomId}:`, error);
912
+ logger_1.logger.error(`[${req.user?.sub}] Error getting room artifacts for ${roomId}:`, error);
912
913
  return { artifacts: [] };
913
914
  }
914
915
  }
@@ -918,7 +919,7 @@ let AppController = class AppController {
918
919
  appService.publishArtifact(roomId, body.name, body.creator, body.body, body.viewers);
919
920
  }
920
921
  catch (error) {
921
- console.error(`[${req.user?.sub}] Error publishing artifact to ${roomId}:`, error);
922
+ logger_1.logger.error(`[${req.user?.sub}] Error publishing artifact to ${roomId}:`, error);
922
923
  if (error instanceof errors_1.NotFoundError) {
923
924
  throw new common_1.NotFoundException(error.message);
924
925
  }
@@ -940,7 +941,7 @@ let AppController = class AppController {
940
941
  appService.createPromptFolder(body.folderName);
941
942
  }
942
943
  catch (error) {
943
- console.error(`[${req.user?.sub}] Error creating prompt folder ${body.folderName}:`, error);
944
+ logger_1.logger.error(`[${req.user?.sub}] Error creating prompt folder ${body.folderName}:`, error);
944
945
  if (error instanceof errors_1.OperationFailedError) {
945
946
  throw new common_1.HttpException(error.message, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
946
947
  }
@@ -953,7 +954,7 @@ let AppController = class AppController {
953
954
  return appService.listStories();
954
955
  }
955
956
  catch (error) {
956
- console.error(`[${req.user?.sub}] Error listing stories:`, error);
957
+ logger_1.logger.error(`[${req.user?.sub}] Error listing stories:`, error);
957
958
  return [];
958
959
  }
959
960
  }
@@ -963,7 +964,7 @@ let AppController = class AppController {
963
964
  return appService.listStoryGenres();
964
965
  }
965
966
  catch (error) {
966
- console.error(`[${req.user?.sub}] Error listing story genres:`, error);
967
+ logger_1.logger.error(`[${req.user?.sub}] Error listing story genres:`, error);
967
968
  return [];
968
969
  }
969
970
  }
@@ -973,7 +974,7 @@ let AppController = class AppController {
973
974
  return appService.getRandomStoryIdea();
974
975
  }
975
976
  catch (error) {
976
- console.error(`[${req.user?.sub}] Error getting random story idea:`, error);
977
+ logger_1.logger.error(`[${req.user?.sub}] Error getting random story idea:`, error);
977
978
  throw new common_1.HttpException('Failed to get random story idea', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
978
979
  }
979
980
  }
@@ -983,7 +984,7 @@ let AppController = class AppController {
983
984
  return appService.getRandomStoryIdeaByGenre(genreName);
984
985
  }
985
986
  catch (error) {
986
- console.error(`[${req.user?.sub}] Error getting story idea for genre ${genreName}:`, error);
987
+ logger_1.logger.error(`[${req.user?.sub}] Error getting story idea for genre ${genreName}:`, error);
987
988
  if (error instanceof errors_1.NotFoundError) {
988
989
  throw new common_1.NotFoundException(`Genre "${genreName}" not found`);
989
990
  }
@@ -999,7 +1000,7 @@ let AppController = class AppController {
999
1000
  return appService.createStory(body.name, body.idea, body.userCharacterDesc, body.otherCharactersDesc, body.storyModel, body.isImport, body.imageModelName);
1000
1001
  }
1001
1002
  catch (error) {
1002
- console.error(`[${req.user?.sub}] Error creating story ${body.name}:`, error);
1003
+ logger_1.logger.error(`[${req.user?.sub}] Error creating story ${body.name}:`, error);
1003
1004
  throw new common_1.HttpException(`Failed to create story: ${error}`, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
1004
1005
  }
1005
1006
  }
@@ -1015,11 +1016,11 @@ let AppController = class AppController {
1015
1016
  try {
1016
1017
  const appService = this.getAppService(req);
1017
1018
  const storyInfo = await appService.importStoryFromZip(file.buffer);
1018
- console.log(`[${req.user?.sub}] Successfully imported story: ${storyInfo.name} (${storyInfo.id})`);
1019
+ logger_1.logger.log(`[${req.user?.sub}] Successfully imported story: ${storyInfo.name} (${storyInfo.id})`);
1019
1020
  return storyInfo;
1020
1021
  }
1021
1022
  catch (error) {
1022
- console.error(`[${req.user?.sub}] Error importing story from zip:`, error);
1023
+ logger_1.logger.error(`[${req.user?.sub}] Error importing story from zip:`, error);
1023
1024
  if (error.message.includes('Invalid story structure')) {
1024
1025
  throw new common_1.BadRequestException(error.message);
1025
1026
  }
@@ -1044,7 +1045,7 @@ let AppController = class AppController {
1044
1045
  appService.deleteStory(storyId);
1045
1046
  }
1046
1047
  catch (error) {
1047
- console.error(`[${req.user?.sub}] Error deleting story ${storyId}:`, error);
1048
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting story ${storyId}:`, error);
1048
1049
  if (error instanceof errors_1.NotFoundError) {
1049
1050
  throw new common_1.NotFoundException(error.message);
1050
1051
  }
@@ -1063,7 +1064,7 @@ let AppController = class AppController {
1063
1064
  await appService.compactStory(storyId);
1064
1065
  }
1065
1066
  catch (error) {
1066
- console.error(`[${req.user?.sub}] Error compacting story ${storyId}:`, error);
1067
+ logger_1.logger.error(`[${req.user?.sub}] Error compacting story ${storyId}:`, error);
1067
1068
  if (error instanceof common_1.HttpException) {
1068
1069
  throw error;
1069
1070
  }
@@ -1079,7 +1080,7 @@ let AppController = class AppController {
1079
1080
  return appService.progressStory(storyId);
1080
1081
  }
1081
1082
  catch (error) {
1082
- console.error(`[${req.user?.sub}] Error progressing story ${storyId}:`, error);
1083
+ logger_1.logger.error(`[${req.user?.sub}] Error progressing story ${storyId}:`, error);
1083
1084
  if (error instanceof common_1.HttpException) {
1084
1085
  throw error;
1085
1086
  }
@@ -1092,7 +1093,7 @@ let AppController = class AppController {
1092
1093
  return appService.getStoryState(storyId);
1093
1094
  }
1094
1095
  catch (error) {
1095
- console.error(`[${req.user?.sub}] Error getting story state for ${storyId}:`, error);
1096
+ logger_1.logger.error(`[${req.user?.sub}] Error getting story state for ${storyId}:`, error);
1096
1097
  if (error instanceof errors_1.NotFoundError) {
1097
1098
  throw new common_1.NotFoundException(error.message);
1098
1099
  }
@@ -1110,7 +1111,7 @@ let AppController = class AppController {
1110
1111
  await appService.respondToStory(storyId, body.content);
1111
1112
  }
1112
1113
  catch (error) {
1113
- console.error(`[${req.user?.sub}] Error responding to story ${storyId}:`, error);
1114
+ logger_1.logger.error(`[${req.user?.sub}] Error responding to story ${storyId}:`, error);
1114
1115
  if (error instanceof common_1.HttpException) {
1115
1116
  throw error;
1116
1117
  }
@@ -1126,7 +1127,7 @@ let AppController = class AppController {
1126
1127
  await appService.introduceCharacterToStory(storyId, body.name, body.description || '', body.storyModel, body.fromNarratorSuggestion || false);
1127
1128
  }
1128
1129
  catch (error) {
1129
- console.error(`[${req.user?.sub}] Error introducing character ${body.name} to story ${storyId}:`, error);
1130
+ logger_1.logger.error(`[${req.user?.sub}] Error introducing character ${body.name} to story ${storyId}:`, error);
1130
1131
  if (error instanceof errors_1.NotFoundError) {
1131
1132
  throw new common_1.NotFoundException(error.message);
1132
1133
  }
@@ -1143,7 +1144,7 @@ let AppController = class AppController {
1143
1144
  return { success: true };
1144
1145
  }
1145
1146
  catch (error) {
1146
- console.error(`[${req.user?.sub}] Error declining character for story ${storyId}:`, error);
1147
+ logger_1.logger.error(`[${req.user?.sub}] Error declining character for story ${storyId}:`, error);
1147
1148
  throw new common_1.HttpException(error.message || 'Failed to decline character', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
1148
1149
  }
1149
1150
  }
@@ -1156,7 +1157,7 @@ let AppController = class AppController {
1156
1157
  await appService.deleteCharacterFromStory(storyId, characterName);
1157
1158
  }
1158
1159
  catch (error) {
1159
- console.error(`[${req.user?.sub}] Error deleting character ${characterName} from story ${storyId}:`, error);
1160
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting character ${characterName} from story ${storyId}:`, error);
1160
1161
  if (error instanceof errors_1.NotFoundError) {
1161
1162
  throw new common_1.NotFoundException(error.message);
1162
1163
  }
@@ -1172,7 +1173,7 @@ let AppController = class AppController {
1172
1173
  return appService.listChapters(storyId);
1173
1174
  }
1174
1175
  catch (error) {
1175
- console.error(`[${req.user?.sub}] Error listing chapters for story ${storyId}:`, error);
1176
+ logger_1.logger.error(`[${req.user?.sub}] Error listing chapters for story ${storyId}:`, error);
1176
1177
  return { chapters: [] };
1177
1178
  }
1178
1179
  }
@@ -1197,7 +1198,7 @@ let AppController = class AppController {
1197
1198
  appService.saveChapter(storyId, chapterIndexNum, body.content);
1198
1199
  }
1199
1200
  catch (error) {
1200
- console.error(`[${req.user?.sub}] Error saving chapter ${chapterIndex} for story ${storyId}:`, error);
1201
+ logger_1.logger.error(`[${req.user?.sub}] Error saving chapter ${chapterIndex} for story ${storyId}:`, error);
1201
1202
  if (error instanceof errors_1.NotFoundError) {
1202
1203
  throw new common_1.NotFoundException(error.message);
1203
1204
  }
@@ -1217,7 +1218,7 @@ let AppController = class AppController {
1217
1218
  appService.deleteChapter(storyId, chapterIndexNum);
1218
1219
  }
1219
1220
  catch (error) {
1220
- console.error(`[${req.user?.sub}] Error deleting chapter ${chapterIndex} for story ${storyId}:`, error);
1221
+ logger_1.logger.error(`[${req.user?.sub}] Error deleting chapter ${chapterIndex} for story ${storyId}:`, error);
1221
1222
  if (error instanceof errors_1.NotFoundError) {
1222
1223
  throw new common_1.NotFoundException(error.message);
1223
1224
  }
@@ -1241,7 +1242,7 @@ let AppController = class AppController {
1241
1242
  res.send(markdown);
1242
1243
  }
1243
1244
  catch (error) {
1244
- console.error(`[${req.user?.sub}] Failed to export story markdown:`, error);
1245
+ logger_1.logger.error(`[${req.user?.sub}] Failed to export story markdown:`, error);
1245
1246
  res.status(500).json({ error: 'Failed to export story markdown' });
1246
1247
  }
1247
1248
  }
@@ -1253,14 +1254,14 @@ let AppController = class AppController {
1253
1254
  res.setHeader('Content-Disposition', `attachment; filename="${filename}"`);
1254
1255
  stream.pipe(res);
1255
1256
  stream.on('error', (err) => {
1256
- console.error(`[${req.user?.sub}] Stream error during story zip export:`, err);
1257
+ logger_1.logger.error(`[${req.user?.sub}] Stream error during story zip export:`, err);
1257
1258
  if (!res.headersSent) {
1258
1259
  res.status(500).json({ error: 'Failed to export story zip' });
1259
1260
  }
1260
1261
  });
1261
1262
  }
1262
1263
  catch (error) {
1263
- console.error(`[${req.user?.sub}] Failed to export story zip:`, error);
1264
+ logger_1.logger.error(`[${req.user?.sub}] Failed to export story zip:`, error);
1264
1265
  if (!res.headersSent) {
1265
1266
  res.status(500).json({ error: 'Failed to export story zip' });
1266
1267
  }
@@ -1272,7 +1273,7 @@ let AppController = class AppController {
1272
1273
  return await appService.listCharacters(storyId);
1273
1274
  }
1274
1275
  catch (error) {
1275
- console.error(`[${req.user?.sub}] Error listing characters for story ${storyId}:`, error);
1276
+ logger_1.logger.error(`[${req.user?.sub}] Error listing characters for story ${storyId}:`, error);
1276
1277
  return [];
1277
1278
  }
1278
1279
  }
@@ -1282,7 +1283,7 @@ let AppController = class AppController {
1282
1283
  return await appService.getCharacter(storyId, characterName);
1283
1284
  }
1284
1285
  catch (error) {
1285
- console.error(`[${req.user?.sub}] Error getting character ${characterName} for story ${storyId}:`, error);
1286
+ logger_1.logger.error(`[${req.user?.sub}] Error getting character ${characterName} for story ${storyId}:`, error);
1286
1287
  return { content: '' };
1287
1288
  }
1288
1289
  }
@@ -1295,7 +1296,7 @@ let AppController = class AppController {
1295
1296
  appService.saveCharacter(storyId, characterName, body.content);
1296
1297
  }
1297
1298
  catch (error) {
1298
- console.error(`[${req.user?.sub}] Error saving character ${characterName} for story ${storyId}:`, error);
1299
+ logger_1.logger.error(`[${req.user?.sub}] Error saving character ${characterName} for story ${storyId}:`, error);
1299
1300
  if (error instanceof errors_1.NotFoundError) {
1300
1301
  throw new common_1.NotFoundException(error.message);
1301
1302
  }
@@ -1311,7 +1312,7 @@ let AppController = class AppController {
1311
1312
  return await appService.getPlotPlan(storyId);
1312
1313
  }
1313
1314
  catch (error) {
1314
- console.error(`[${req.user?.sub}] Error getting plot plan for story ${storyId}:`, error);
1315
+ logger_1.logger.error(`[${req.user?.sub}] Error getting plot plan for story ${storyId}:`, error);
1315
1316
  return { content: '' };
1316
1317
  }
1317
1318
  }
@@ -1321,7 +1322,7 @@ let AppController = class AppController {
1321
1322
  return await appService.getAgentHistory(storyId, agentId);
1322
1323
  }
1323
1324
  catch (error) {
1324
- console.error(`[${req.user?.sub}] Error getting agent history for ${agentId} in story ${storyId}:`, error);
1325
+ logger_1.logger.error(`[${req.user?.sub}] Error getting agent history for ${agentId} in story ${storyId}:`, error);
1325
1326
  return { content: '' };
1326
1327
  }
1327
1328
  }
@@ -1334,7 +1335,7 @@ let AppController = class AppController {
1334
1335
  appService.savePlotPlan(storyId, body.content);
1335
1336
  }
1336
1337
  catch (error) {
1337
- console.error(`[${req.user?.sub}] Error saving plot plan for story ${storyId}:`, error);
1338
+ logger_1.logger.error(`[${req.user?.sub}] Error saving plot plan for story ${storyId}:`, error);
1338
1339
  if (error instanceof errors_1.NotFoundError) {
1339
1340
  throw new common_1.NotFoundException(error.message);
1340
1341
  }
@@ -1350,7 +1351,7 @@ let AppController = class AppController {
1350
1351
  return { artifacts: appService.listStoryArtifacts(storyId) };
1351
1352
  }
1352
1353
  catch (error) {
1353
- console.error(`Error listing story artifacts for ${storyId}:`, error);
1354
+ logger_1.logger.error(`Error listing story artifacts for ${storyId}:`, error);
1354
1355
  return { artifacts: [] };
1355
1356
  }
1356
1357
  }
@@ -1372,7 +1373,7 @@ let AppController = class AppController {
1372
1373
  res.send(content);
1373
1374
  }
1374
1375
  catch (error) {
1375
- console.error(`Error getting story artifact ${artifactId} for story ${storyId}:`, error);
1376
+ logger_1.logger.error(`Error getting story artifact ${artifactId} for story ${storyId}:`, error);
1376
1377
  if (error instanceof common_1.NotFoundException) {
1377
1378
  throw error;
1378
1379
  }
@@ -1402,12 +1403,12 @@ let AppController = class AppController {
1402
1403
  const appService = this.getAppService(req);
1403
1404
  const storyInfo = appService.listStories().find((s) => s.id === storyId);
1404
1405
  if (!storyInfo) {
1405
- console.log(`[SSE] Story ${storyId} not found for user ${userId}`);
1406
+ logger_1.logger.log(`[SSE] Story ${storyId} not found for user ${userId}`);
1406
1407
  throw new common_1.NotFoundException(`Story ${storyId} not found`);
1407
1408
  }
1408
1409
  const emitter = appService.getStoryMessageEmitter(storyId);
1409
1410
  return new rxjs_1.Observable((subscriber) => {
1410
- console.log(`[SSE] Observable subscribed for story ${storyId}`);
1411
+ logger_1.logger.log(`[SSE] Observable subscribed for story ${storyId}`);
1411
1412
  subscriber.next({
1412
1413
  data: { type: 'connected', storyId },
1413
1414
  });
@@ -1416,13 +1417,13 @@ let AppController = class AppController {
1416
1417
  };
1417
1418
  emitter.on('update', updateHandler);
1418
1419
  return () => {
1419
- console.log(`[SSE] Cleanup for story ${storyId}`);
1420
+ logger_1.logger.log(`[SSE] Cleanup for story ${storyId}`);
1420
1421
  emitter.off('update', updateHandler);
1421
1422
  };
1422
1423
  });
1423
1424
  }
1424
1425
  catch (error) {
1425
- console.error(`[SSE] Error setting up SSE for story ${storyId}:`, error);
1426
+ logger_1.logger.error(`[SSE] Error setting up SSE for story ${storyId}:`, error);
1426
1427
  throw error;
1427
1428
  }
1428
1429
  }
@@ -1492,7 +1493,7 @@ let AppController = class AppController {
1492
1493
  return { artifacts: appService.listUserArtifacts() };
1493
1494
  }
1494
1495
  catch (error) {
1495
- console.error(`Error listing artifacts:`, error);
1496
+ logger_1.logger.error(`Error listing artifacts:`, error);
1496
1497
  return { artifacts: [] };
1497
1498
  }
1498
1499
  }
@@ -1506,7 +1507,7 @@ let AppController = class AppController {
1506
1507
  return { content };
1507
1508
  }
1508
1509
  catch (error) {
1509
- console.error(`Error getting artifact ${artifactId}:`, error);
1510
+ logger_1.logger.error(`Error getting artifact ${artifactId}:`, error);
1510
1511
  if (error instanceof common_1.NotFoundException) {
1511
1512
  throw error;
1512
1513
  }
@@ -1542,7 +1543,7 @@ let AppController = class AppController {
1542
1543
  return { artifactId };
1543
1544
  }
1544
1545
  catch (error) {
1545
- console.error(`Error creating artifact:`, error);
1546
+ logger_1.logger.error(`Error creating artifact:`, error);
1546
1547
  if (error.message?.includes('conversion')) {
1547
1548
  throw new common_1.HttpException(`Failed to convert PDF: ${error.message}`, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
1548
1549
  }
@@ -1561,7 +1562,7 @@ let AppController = class AppController {
1561
1562
  }
1562
1563
  }
1563
1564
  catch (error) {
1564
- console.error(`Error updating artifact ${artifactId}:`, error);
1565
+ logger_1.logger.error(`Error updating artifact ${artifactId}:`, error);
1565
1566
  if (error instanceof common_1.NotFoundException) {
1566
1567
  throw error;
1567
1568
  }
@@ -1583,7 +1584,7 @@ let AppController = class AppController {
1583
1584
  }
1584
1585
  }
1585
1586
  catch (error) {
1586
- console.error(`Error renaming artifact ${artifactId}:`, error);
1587
+ logger_1.logger.error(`Error renaming artifact ${artifactId}:`, error);
1587
1588
  if (error instanceof common_1.NotFoundException) {
1588
1589
  throw error;
1589
1590
  }
@@ -1599,7 +1600,7 @@ let AppController = class AppController {
1599
1600
  }
1600
1601
  }
1601
1602
  catch (error) {
1602
- console.error(`Error deleting artifact ${artifactId}:`, error);
1603
+ logger_1.logger.error(`Error deleting artifact ${artifactId}:`, error);
1603
1604
  if (error instanceof common_1.NotFoundException) {
1604
1605
  throw error;
1605
1606
  }
@@ -1612,7 +1613,7 @@ let AppController = class AppController {
1612
1613
  return { artifacts: await appService.listAgentArtifacts(agentId) };
1613
1614
  }
1614
1615
  catch (error) {
1615
- console.error(`Error listing artifacts for agent ${agentId}:`, error);
1616
+ logger_1.logger.error(`Error listing artifacts for agent ${agentId}:`, error);
1616
1617
  return { artifacts: [] };
1617
1618
  }
1618
1619
  }
@@ -1625,7 +1626,7 @@ let AppController = class AppController {
1625
1626
  await appService.attachArtifactToAgent(agentId, body.artifactId);
1626
1627
  }
1627
1628
  catch (error) {
1628
- console.error(`Error attaching artifact to agent ${agentId}:`, error);
1629
+ logger_1.logger.error(`Error attaching artifact to agent ${agentId}:`, error);
1629
1630
  if (error instanceof errors_1.NotFoundError) {
1630
1631
  throw new common_1.NotFoundException(error.message);
1631
1632
  }
@@ -1638,7 +1639,7 @@ let AppController = class AppController {
1638
1639
  appService.detachArtifactFromAgent(agentId, artifactId);
1639
1640
  }
1640
1641
  catch (error) {
1641
- console.error(`Error detaching artifact from agent ${agentId}:`, error);
1642
+ logger_1.logger.error(`Error detaching artifact from agent ${agentId}:`, error);
1642
1643
  if (error instanceof errors_1.NotFoundError) {
1643
1644
  throw new common_1.NotFoundException(error.message);
1644
1645
  }