@yrpri/api 9.0.103 → 9.0.104

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 (422) hide show
  1. package/package.json +1 -1
  2. package/dist/active-citizen/controllers/activities.cjs +0 -174
  3. package/dist/active-citizen/controllers/news_feeds.cjs +0 -96
  4. package/dist/active-citizen/controllers/notifications.cjs +0 -243
  5. package/dist/active-citizen/controllers/recommendations.cjs +0 -280
  6. package/dist/active-citizen/engine/allOurIdeas/aiHelper.js +0 -204
  7. package/dist/active-citizen/engine/allOurIdeas/explainAnswersAssistant.js +0 -66
  8. package/dist/active-citizen/engine/allOurIdeas/iconGenerator.js +0 -38
  9. package/dist/active-citizen/engine/analytics/export_anon_community_activities.js +0 -334
  10. package/dist/active-citizen/engine/analytics/importer.js +0 -308
  11. package/dist/active-citizen/engine/analytics/manager.cjs +0 -377
  12. package/dist/active-citizen/engine/analytics/plausible/manager.cjs +0 -500
  13. package/dist/active-citizen/engine/analytics/statsCalc.cjs +0 -194
  14. package/dist/active-citizen/engine/analytics/utils.cjs +0 -369
  15. package/dist/active-citizen/engine/marketing/campaign.cjs +0 -90
  16. package/dist/active-citizen/engine/moderation/fraud/CreateFraudAuditReport.cjs +0 -313
  17. package/dist/active-citizen/engine/moderation/fraud/FraudBase.cjs +0 -239
  18. package/dist/active-citizen/engine/moderation/fraud/FraudDeleteBase.cjs +0 -211
  19. package/dist/active-citizen/engine/moderation/fraud/FraudDeleteEndorsements.cjs +0 -120
  20. package/dist/active-citizen/engine/moderation/fraud/FraudDeletePointQualities.cjs +0 -114
  21. package/dist/active-citizen/engine/moderation/fraud/FraudDeletePoints.cjs +0 -101
  22. package/dist/active-citizen/engine/moderation/fraud/FraudDeletePosts.cjs +0 -84
  23. package/dist/active-citizen/engine/moderation/fraud/FraudDeleteRatings.cjs +0 -15
  24. package/dist/active-citizen/engine/moderation/fraud/FraudGetBase.cjs +0 -133
  25. package/dist/active-citizen/engine/moderation/fraud/FraudGetEndorsements.cjs +0 -185
  26. package/dist/active-citizen/engine/moderation/fraud/FraudGetPointQualities.cjs +0 -184
  27. package/dist/active-citizen/engine/moderation/fraud/FraudGetPoints.cjs +0 -170
  28. package/dist/active-citizen/engine/moderation/fraud/FraudGetPosts.cjs +0 -109
  29. package/dist/active-citizen/engine/moderation/fraud/FraudGetRatings.cjs +0 -140
  30. package/dist/active-citizen/engine/moderation/fraud/FraudScannerNotifier.cjs +0 -279
  31. package/dist/active-citizen/engine/moderation/get_moderation_items.cjs +0 -386
  32. package/dist/active-citizen/engine/moderation/image_labeling/CommunityLabeling.cjs +0 -49
  33. package/dist/active-citizen/engine/moderation/image_labeling/GroupLabeling.cjs +0 -68
  34. package/dist/active-citizen/engine/moderation/image_labeling/ImageLabelingBase.cjs +0 -288
  35. package/dist/active-citizen/engine/moderation/image_labeling/PointLabeling.cjs +0 -33
  36. package/dist/active-citizen/engine/moderation/image_labeling/PostLabeling.cjs +0 -56
  37. package/dist/active-citizen/engine/moderation/perspective_api_client.cjs +0 -106
  38. package/dist/active-citizen/engine/moderation/process_moderation_items.cjs +0 -344
  39. package/dist/active-citizen/engine/moderation/toxicity_analysis.cjs +0 -810
  40. package/dist/active-citizen/engine/news_feeds/activity_and_item_index_definitions.cjs +0 -15
  41. package/dist/active-citizen/engine/news_feeds/generate_dynamically.cjs +0 -362
  42. package/dist/active-citizen/engine/news_feeds/generate_from_notifications.cjs +0 -268
  43. package/dist/active-citizen/engine/news_feeds/news_feeds_utils.cjs +0 -439
  44. package/dist/active-citizen/engine/notifications/emails_utils.cjs +0 -569
  45. package/dist/active-citizen/engine/notifications/generate_point_notifications.cjs +0 -233
  46. package/dist/active-citizen/engine/notifications/generate_post_notifications.cjs +0 -118
  47. package/dist/active-citizen/engine/notifications/generate_post_status_change_notifications.cjs +0 -41
  48. package/dist/active-citizen/engine/notifications/notifications_utils.cjs +0 -148
  49. package/dist/active-citizen/engine/notifications/point_delivery.cjs +0 -54
  50. package/dist/active-citizen/engine/notifications/post_delivery.cjs +0 -31
  51. package/dist/active-citizen/engine/notifications/process_delayed_notifications.cjs +0 -471
  52. package/dist/active-citizen/engine/notifications/process_general_notifications.cjs +0 -212
  53. package/dist/active-citizen/engine/old/exporters/categories_dataset.js +0 -153
  54. package/dist/active-citizen/engine/old/exporters/dataset_tools.js +0 -80
  55. package/dist/active-citizen/engine/old/exporters/sentiment_dataset.js +0 -157
  56. package/dist/active-citizen/engine/recommendations/events_importer.cjs +0 -139
  57. package/dist/active-citizen/engine/recommendations/events_manager.cjs +0 -212
  58. package/dist/active-citizen/engine/reports/add_points_to_sheet.cjs +0 -83
  59. package/dist/active-citizen/engine/reports/commonUtils.js +0 -75
  60. package/dist/active-citizen/engine/reports/common_utils.cjs +0 -740
  61. package/dist/active-citizen/engine/reports/docx_group_report.cjs +0 -596
  62. package/dist/active-citizen/engine/reports/xlsAllOurIdeasExport.js +0 -232
  63. package/dist/active-citizen/engine/reports/xls_community_users_report.cjs +0 -277
  64. package/dist/active-citizen/engine/reports/xls_group_report.cjs +0 -718
  65. package/dist/active-citizen/llms/baseChatBot.js +0 -183
  66. package/dist/active-citizen/llms/imageGeneration/chatGptImageGenerator.js +0 -56
  67. package/dist/active-citizen/llms/imageGeneration/collectionImageGenerator.js +0 -109
  68. package/dist/active-citizen/llms/imageGeneration/dalleImageGenerator.js +0 -84
  69. package/dist/active-citizen/llms/imageGeneration/fluxImageGenerator.js +0 -49
  70. package/dist/active-citizen/llms/imageGeneration/iImageGenerator.js +0 -1
  71. package/dist/active-citizen/llms/imageGeneration/imageProcessorService.js +0 -64
  72. package/dist/active-citizen/llms/imageGeneration/imagenImageGenerator.js +0 -107
  73. package/dist/active-citizen/llms/imageGeneration/s3Service.js +0 -110
  74. package/dist/active-citizen/llms/llmTranslation.js +0 -472
  75. package/dist/active-citizen/models/ac_activity.cjs +0 -216
  76. package/dist/active-citizen/models/ac_background_job.cjs +0 -109
  77. package/dist/active-citizen/models/ac_campaign.cjs +0 -97
  78. package/dist/active-citizen/models/ac_client_activity.cjs +0 -23
  79. package/dist/active-citizen/models/ac_delayed_notification.cjs +0 -43
  80. package/dist/active-citizen/models/ac_following.cjs +0 -43
  81. package/dist/active-citizen/models/ac_list.cjs +0 -68
  82. package/dist/active-citizen/models/ac_list_users.cjs +0 -19
  83. package/dist/active-citizen/models/ac_mute.cjs +0 -27
  84. package/dist/active-citizen/models/ac_news_feed_item.cjs +0 -57
  85. package/dist/active-citizen/models/ac_news_feed_processed_range.cjs +0 -59
  86. package/dist/active-citizen/models/ac_notification.cjs +0 -292
  87. package/dist/active-citizen/models/ac_translation_cache.cjs +0 -750
  88. package/dist/active-citizen/models/ac_watching.cjs +0 -31
  89. package/dist/active-citizen/scripts/analytics/setup_all_plausible_goals.cjs +0 -13
  90. package/dist/active-citizen/scripts/fix_old_delayed_notifications.js +0 -63
  91. package/dist/active-citizen/scripts/kue_status.js +0 -31
  92. package/dist/active-citizen/scripts/kue_watch_stuck_jobs.js +0 -24
  93. package/dist/active-citizen/scripts/translation_clear_language.js +0 -117
  94. package/dist/active-citizen/scripts/translation_delete.js +0 -27
  95. package/dist/active-citizen/scripts/translation_replace_text_from_url.js +0 -180
  96. package/dist/active-citizen/scripts/translation_update.js +0 -28
  97. package/dist/active-citizen/scripts/translations_list.js +0 -27
  98. package/dist/active-citizen/utils/airbrake.cjs +0 -17
  99. package/dist/active-citizen/utils/get_anonymous_system_user.cjs +0 -21
  100. package/dist/active-citizen/utils/i18n.cjs +0 -3
  101. package/dist/active-citizen/utils/logger.cjs +0 -25
  102. package/dist/active-citizen/utils/redisConnection.cjs +0 -29
  103. package/dist/active-citizen/utils/to_json.cjs +0 -9
  104. package/dist/active-citizen/utils/translation_cloning.cjs +0 -171
  105. package/dist/active-citizen/utils/translation_helpers.cjs +0 -534
  106. package/dist/active-citizen/utils/truncate_text.cjs +0 -21
  107. package/dist/active-citizen/utils/updateAllLocalesFromEn.js +0 -253
  108. package/dist/active-citizen/utils/updateLocaleFolders.js +0 -34
  109. package/dist/active-citizen/workers/activity.cjs +0 -189
  110. package/dist/active-citizen/workers/anonymizations.cjs +0 -734
  111. package/dist/active-citizen/workers/bulk_status_update.cjs +0 -458
  112. package/dist/active-citizen/workers/delayed_jobs.cjs +0 -244
  113. package/dist/active-citizen/workers/deletions.cjs +0 -1911
  114. package/dist/active-citizen/workers/email.cjs +0 -9
  115. package/dist/active-citizen/workers/fraud_management.cjs +0 -109
  116. package/dist/active-citizen/workers/generativeAi.js +0 -56
  117. package/dist/active-citizen/workers/main.cjs +0 -89
  118. package/dist/active-citizen/workers/marketing.cjs +0 -25
  119. package/dist/active-citizen/workers/moderation.cjs +0 -73
  120. package/dist/active-citizen/workers/notification_delivery.cjs +0 -368
  121. package/dist/active-citizen/workers/notification_news_feed.cjs +0 -142
  122. package/dist/active-citizen/workers/queue.cjs +0 -99
  123. package/dist/active-citizen/workers/recount.cjs +0 -74
  124. package/dist/active-citizen/workers/reports.cjs +0 -42
  125. package/dist/active-citizen/workers/similarities.cjs +0 -21
  126. package/dist/active-citizen/workers/speech_to_text.cjs +0 -482
  127. package/dist/agents/assistants/agentAssistant.js +0 -88
  128. package/dist/agents/assistants/baseAssistant.js +0 -888
  129. package/dist/agents/assistants/baseAssistantWithVoice.js +0 -150
  130. package/dist/agents/assistants/modes/agentDirectConnection.js +0 -84
  131. package/dist/agents/assistants/modes/agentSelectionMode.js +0 -44
  132. package/dist/agents/assistants/modes/baseAssistantMode.js +0 -54
  133. package/dist/agents/assistants/modes/tools/agentTools.js +0 -447
  134. package/dist/agents/assistants/modes/tools/baseTools.js +0 -58
  135. package/dist/agents/assistants/modes/tools/loginTools.js +0 -156
  136. package/dist/agents/assistants/modes/tools/models/agents.js +0 -146
  137. package/dist/agents/assistants/modes/tools/models/subscriptions.js +0 -332
  138. package/dist/agents/assistants/modes/tools/models/users.js +0 -11
  139. package/dist/agents/assistants/modes/tools/navigationTools.js +0 -166
  140. package/dist/agents/assistants/modes/tools/subscriptionTools.js +0 -323
  141. package/dist/agents/assistants/modes/tools/workflowConverstationTools.js +0 -112
  142. package/dist/agents/assistants/voiceAssistant.js +0 -619
  143. package/dist/agents/controllers/agentProductController.js +0 -103
  144. package/dist/agents/controllers/agentSubscriptionController.js +0 -261
  145. package/dist/agents/controllers/assistantsController.js +0 -511
  146. package/dist/agents/controllers/policySynthAgents.js +0 -395
  147. package/dist/agents/managers/agentProductManager.js +0 -91
  148. package/dist/agents/managers/emailInvitesManager.js +0 -55
  149. package/dist/agents/managers/emailTemplateRenderer.js +0 -362
  150. package/dist/agents/managers/newAiModelSetup.js +0 -650
  151. package/dist/agents/managers/notificationAgentQueueManager.js +0 -510
  152. package/dist/agents/managers/subscriptionManager.js +0 -535
  153. package/dist/agents/managers/workflowConversationManager.js +0 -79
  154. package/dist/agents/models/agentProduct.js +0 -116
  155. package/dist/agents/models/agentProductBoosterPurchase.js +0 -58
  156. package/dist/agents/models/agentProductBundle.js +0 -68
  157. package/dist/agents/models/agentProductRun.js +0 -52
  158. package/dist/agents/models/discount.js +0 -88
  159. package/dist/agents/models/subscription.js +0 -79
  160. package/dist/agents/models/subscriptionPlan.js +0 -46
  161. package/dist/agents/models/subscriptionUser.js +0 -27
  162. package/dist/agents/models/testData/createEvolyAgentProduct.js +0 -477
  163. package/dist/agents/models/testData/old/updateAgentWorkflowConfiguration.js +0 -230
  164. package/dist/agents/models/testData/setupEvolyAgentProductConfig.js +0 -233
  165. package/dist/agents/models/testData/updateAgentWorkflowConfiguration.js +0 -230
  166. package/dist/agents/models/workflowConversation.js +0 -53
  167. package/dist/agents/tools/setTemplateWorkflowCommunityId.js +0 -46
  168. package/dist/app.js +0 -943
  169. package/dist/authorization.cjs +0 -1860
  170. package/dist/bot_control.js +0 -1930
  171. package/dist/config/config.cjs +0 -14
  172. package/dist/config/config.js +0 -14
  173. package/dist/controllers/allOurIdeas.js +0 -696
  174. package/dist/controllers/audios.cjs +0 -100
  175. package/dist/controllers/bulkStatusUpdates.cjs +0 -202
  176. package/dist/controllers/categories.cjs +0 -199
  177. package/dist/controllers/communities.cjs +0 -2996
  178. package/dist/controllers/domains.cjs +0 -1341
  179. package/dist/controllers/externalIds.cjs +0 -223
  180. package/dist/controllers/groups.cjs +0 -4309
  181. package/dist/controllers/images.cjs +0 -499
  182. package/dist/controllers/index.cjs +0 -449
  183. package/dist/controllers/legacyPages.cjs +0 -35
  184. package/dist/controllers/legacyPosts.cjs +0 -56
  185. package/dist/controllers/legacyUsers.cjs +0 -36
  186. package/dist/controllers/nonSpa.cjs +0 -574
  187. package/dist/controllers/organizations.cjs +0 -250
  188. package/dist/controllers/points.cjs +0 -1137
  189. package/dist/controllers/posts.cjs +0 -2036
  190. package/dist/controllers/ratings.cjs +0 -234
  191. package/dist/controllers/users.cjs +0 -2255
  192. package/dist/controllers/videos.cjs +0 -226
  193. package/dist/deleteUnwantedDeclerations.cjs +0 -55
  194. package/dist/migrations/agentAuditLogs.cjs +0 -46
  195. package/dist/migrations/agentClasses.cjs +0 -60
  196. package/dist/migrations/agentConnectorClasses.cjs +0 -61
  197. package/dist/migrations/agentConnectors.cjs +0 -50
  198. package/dist/migrations/agentEvals.cjs +0 -45
  199. package/dist/migrations/agentRegistries.cjs +0 -40
  200. package/dist/migrations/agents.cjs +0 -54
  201. package/dist/migrations/aiModels.cjs +0 -49
  202. package/dist/migrations/apiUsage.cjs +0 -47
  203. package/dist/migrations/apis.cjs +0 -49
  204. package/dist/migrations/groupPrivateData.cjs +0 -30
  205. package/dist/migrations/modelUsage.cjs +0 -60
  206. package/dist/migrations/oldMigrations/2019/20181030020612-AddActivitiesIndex.js +0 -23
  207. package/dist/migrations/oldMigrations/2019/20181102210612-AddFirstVideoFeatures.js +0 -360
  208. package/dist/migrations/oldMigrations/2019/20181212210612-ModerationFeatures.js +0 -29
  209. package/dist/migrations/oldMigrations/2019/2019010610612-CommunityFolders.js +0 -43
  210. package/dist/migrations/oldMigrations/2019/20190117020612-AddMissingIndexes.js +0 -24
  211. package/dist/migrations/oldMigrations/2019/20190117020612-RemoveUnusedIndexes.js +0 -29
  212. package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartThree.js +0 -22
  213. package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartTwo.js +0 -23
  214. package/dist/migrations/oldMigrations/2019/20190223020612-AddPrivateProfileDataToUsers.js +0 -18
  215. package/dist/migrations/oldMigrations/2019/20190706210612-AddCustomRatings.js +0 -43
  216. package/dist/migrations/oldMigrations/2019/20190829210612-AddGeneralStore.js +0 -36
  217. package/dist/migrations/oldMigrations/2019/20192811210612-AddAcClientActivities.js +0 -41
  218. package/dist/migrations/oldMigrations/2020/20190527020612-WorkOnIndexes.js +0 -88
  219. package/dist/migrations/oldMigrations/2020/20200409020612-AddBackgroundJob.js +0 -33
  220. package/dist/migrations/oldMigrations/2020/20200716210612-AddDataToCollections.js +0 -38
  221. package/dist/migrations/oldMigrations/2022/20220215100612-AddDataToEndorsements.js +0 -19
  222. package/dist/migrations/oldMigrations/2022/20220220100612-AddDataForFraudDetection.js +0 -19
  223. package/dist/migrations/oldMigrations/2022/20220903100612-AddPromotionFeatures.js +0 -127
  224. package/dist/migrations/oldMigrations/2022/onHold/20200527020612-AddCampaigns.js +0 -68
  225. package/dist/migrations/oldMigrations/2024/20241304175112-AddMediaSupportForHtmlGroups.cjs +0 -63
  226. package/dist/migrations/oldMigrations/older/20160511172514-AddNotificationFeatures.js +0 -14
  227. package/dist/migrations/oldMigrations/older/20161030020612-AddBulkStatusUpdate.js +0 -71
  228. package/dist/migrations/oldMigrations/older/20170514035258-add-metadata-to-invites.js +0 -12
  229. package/dist/migrations/oldMigrations/older/20180216020612-AddTranslationCaches.js +0 -46
  230. package/dist/migrations/oldMigrations/older/20180218210612-AddTranslationAndLanguages.js +0 -46
  231. package/dist/migrations/privateAccessStore.cjs +0 -55
  232. package/dist/migrations/zzz_associations.cjs +0 -154
  233. package/dist/migrations/zzzz_createUsersAndAdminsForClasses.cjs +0 -100
  234. package/dist/migrations/zzzzz_create_agent_runs.cjs +0 -606
  235. package/dist/migrations/zzzzzz_create_agent_runs_fix.cjs +0 -11
  236. package/dist/migrations/zzzzzzz_create_trees.cjs +0 -81
  237. package/dist/models/audio.cjs +0 -430
  238. package/dist/models/bulk_status_update.cjs +0 -58
  239. package/dist/models/campaign.cjs +0 -78
  240. package/dist/models/category.cjs +0 -94
  241. package/dist/models/community.cjs +0 -337
  242. package/dist/models/domain.cjs +0 -486
  243. package/dist/models/endorsement.cjs +0 -39
  244. package/dist/models/general_data_store.cjs +0 -20
  245. package/dist/models/group.cjs +0 -728
  246. package/dist/models/image.cjs +0 -579
  247. package/dist/models/index.cjs +0 -186
  248. package/dist/models/invite.cjs +0 -48
  249. package/dist/models/iso_country.cjs +0 -16
  250. package/dist/models/organization.cjs +0 -122
  251. package/dist/models/page.cjs +0 -273
  252. package/dist/models/point.cjs +0 -622
  253. package/dist/models/point_quality.cjs +0 -39
  254. package/dist/models/point_revision.cjs +0 -47
  255. package/dist/models/post.cjs +0 -680
  256. package/dist/models/post_revision.cjs +0 -38
  257. package/dist/models/post_status_change.cjs +0 -35
  258. package/dist/models/promotion.cjs +0 -34
  259. package/dist/models/rating.cjs +0 -51
  260. package/dist/models/relationship.cjs +0 -19
  261. package/dist/models/request_to_join.cjs +0 -20
  262. package/dist/models/user.cjs +0 -604
  263. package/dist/models/user_legacy_password.cjs +0 -13
  264. package/dist/models/video.cjs +0 -1137
  265. package/dist/publish.js +0 -40
  266. package/dist/repack.js +0 -53
  267. package/dist/scripts/addRatingUsersToGroup.js +0 -51
  268. package/dist/scripts/addUserToOrganization.js +0 -71
  269. package/dist/scripts/analyseRatingsForCommunity.js +0 -150
  270. package/dist/scripts/analyzeAndFixBrokenPointUsers.js +0 -28
  271. package/dist/scripts/analyzeEndorsementsByCountry.js +0 -70
  272. package/dist/scripts/analyzePostsForCommunity.js +0 -185
  273. package/dist/scripts/bulkStatusUpdates/listUpdates.js +0 -14
  274. package/dist/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +0 -110
  275. package/dist/scripts/bulkStatusUpdates/performUpdate.js +0 -116
  276. package/dist/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +0 -124
  277. package/dist/scripts/bulkStatusUpdates/performUpdateForStatus.js +0 -141
  278. package/dist/scripts/change/changeVideoAspectTo.js +0 -34
  279. package/dist/scripts/change/setUseNewVersion.cjs +0 -22
  280. package/dist/scripts/changeCommunityGroupcount.js +0 -30
  281. package/dist/scripts/changeCommunityPostCount.js +0 -30
  282. package/dist/scripts/changeGroupPostCount.js +0 -30
  283. package/dist/scripts/changeLanguage.js +0 -50
  284. package/dist/scripts/changeOfficalStatus.js +0 -30
  285. package/dist/scripts/cleanups/deleteAnonNotifications.cjs +0 -91
  286. package/dist/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +0 -62
  287. package/dist/scripts/cleanups/deleteYearOldNotifications.cjs +0 -72
  288. package/dist/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +0 -43
  289. package/dist/scripts/clearAllEndorsementInGroup.js +0 -50
  290. package/dist/scripts/cloning/clearUsersForCommunitiesFromUrl.js +0 -129
  291. package/dist/scripts/cloning/cloneFromUrlScript.js +0 -65
  292. package/dist/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +0 -140
  293. package/dist/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +0 -140
  294. package/dist/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +0 -131
  295. package/dist/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +0 -173
  296. package/dist/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +0 -18
  297. package/dist/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +0 -17
  298. package/dist/scripts/cloning/copyCommunityToDomainWithEverything.js +0 -17
  299. package/dist/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +0 -26
  300. package/dist/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +0 -205
  301. package/dist/scripts/cloning/copyPostToGroupOld.js +0 -397
  302. package/dist/scripts/cloning/copyPostVideosFromURL.js +0 -236
  303. package/dist/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +0 -17
  304. package/dist/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +0 -131
  305. package/dist/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +0 -139
  306. package/dist/scripts/cloning/setAdminsFromURL.js +0 -161
  307. package/dist/scripts/cloning/setExternalIdsFromURL.js +0 -129
  308. package/dist/scripts/countCommunity.js +0 -291
  309. package/dist/scripts/countCommunityUsers.js +0 -152
  310. package/dist/scripts/countDelayedNotifications.js +0 -18
  311. package/dist/scripts/countGroup.js +0 -246
  312. package/dist/scripts/countStuff.js +0 -67
  313. package/dist/scripts/countUniqueVotersInAGroup.js +0 -48
  314. package/dist/scripts/createInvitesAndShow.js +0 -75
  315. package/dist/scripts/database/sync_database.js +0 -14
  316. package/dist/scripts/database/sync_dev_database.js +0 -17
  317. package/dist/scripts/debugNotifications.js +0 -58
  318. package/dist/scripts/deleteAllNewsFeeds.js +0 -10
  319. package/dist/scripts/deleteCategory.js +0 -13
  320. package/dist/scripts/deleteOldAppActivities.js +0 -40
  321. package/dist/scripts/deletePostContactDataForCommunity.js +0 -53
  322. package/dist/scripts/destroy/destroy_all_but_one_domain.js +0 -1026
  323. package/dist/scripts/displayAuthorForPost.js +0 -16
  324. package/dist/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +0 -183
  325. package/dist/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +0 -208
  326. package/dist/scripts/exportAllStatusChanges.js +0 -36
  327. package/dist/scripts/exportClientAcitivity.js +0 -36
  328. package/dist/scripts/exportEndorsementsForCommunity.js +0 -79
  329. package/dist/scripts/exportPointQualitiesForCommunity.js +0 -84
  330. package/dist/scripts/exportPostsAndPointsForCommunity.js +0 -147
  331. package/dist/scripts/exportPostsDataSetForDomain.js +0 -244
  332. package/dist/scripts/exportPostsForGroup.js +0 -173
  333. package/dist/scripts/exportRatingsForPost.js +0 -15
  334. package/dist/scripts/exportUserEndorsementsWithUserAnalysis.js +0 -123
  335. package/dist/scripts/exportUsersForCommunity.js +0 -24
  336. package/dist/scripts/exportUsersForDomain.js +0 -24
  337. package/dist/scripts/exportUsersForGroup.js +0 -24
  338. package/dist/scripts/exports/ratingDistribution.js +0 -71
  339. package/dist/scripts/exports/whoEndorsedWhatByCommunity.js +0 -56
  340. package/dist/scripts/findUnusedClientImports.js +0 -56
  341. package/dist/scripts/fixAllPostPointCounts.js +0 -22
  342. package/dist/scripts/fixAnonNotificationsSettings.js +0 -48
  343. package/dist/scripts/fixCountKopavogur.js +0 -9
  344. package/dist/scripts/fixEndorsementsAfterCopyPostToGroup.js +0 -190
  345. package/dist/scripts/fixExternalUserId.js +0 -24
  346. package/dist/scripts/fixGroupAccess.js +0 -16
  347. package/dist/scripts/fixGroupIdeasAndPointsCount.js +0 -49
  348. package/dist/scripts/fixNotificationSettings.js +0 -39
  349. package/dist/scripts/fixSurveyRadioBakedInSubCodes.js +0 -64
  350. package/dist/scripts/fixWrongUserIdForStatusUpdates.js +0 -49
  351. package/dist/scripts/gallery/exportGalleryData.js +0 -40
  352. package/dist/scripts/gallery/importGalleryForCommunity.js +0 -168
  353. package/dist/scripts/gallery/readJsonAndDownloadImagesVersion2.js +0 -55
  354. package/dist/scripts/gallery/refreshAcApiPostIdsForCommunity.js +0 -58
  355. package/dist/scripts/genderAnalysis.js +0 -63
  356. package/dist/scripts/genderAnalysisByStatus.js +0 -62
  357. package/dist/scripts/importAllLocalesFromLocalFolders.js +0 -55
  358. package/dist/scripts/importDomain.js +0 -1652
  359. package/dist/scripts/keys/addOidcToDomain.cjs +0 -61
  360. package/dist/scripts/landUseGame/export3Ddata.js +0 -162
  361. package/dist/scripts/listLanguagesForGroup.js +0 -54
  362. package/dist/scripts/loadTestCreateDummyContentForGroup.js +0 -27
  363. package/dist/scripts/makeRecursiveMapData.js +0 -103
  364. package/dist/scripts/mapping/community_map_csv.js +0 -145
  365. package/dist/scripts/moveCommunityToDomain.js +0 -22
  366. package/dist/scripts/moveGroupToCommunity.js +0 -23
  367. package/dist/scripts/movePostToGroup.js +0 -101
  368. package/dist/scripts/movePostsToGroupsRecountGroupFromUrl.js +0 -297
  369. package/dist/scripts/oldMovePostToGroup.js +0 -153
  370. package/dist/scripts/processCsvForPdfUrls.js +0 -37
  371. package/dist/scripts/processCsvForTranslationAndToxicity.js +0 -125
  372. package/dist/scripts/recount/recount_recursive_communities.js +0 -125
  373. package/dist/scripts/recountALLCommunityGroupCounts.js +0 -37
  374. package/dist/scripts/recountAll.js +0 -97
  375. package/dist/scripts/recountCommunitesFromUrl.js +0 -58
  376. package/dist/scripts/recountCommunity.js +0 -19
  377. package/dist/scripts/recountGroup.js +0 -218
  378. package/dist/scripts/recountGroupNoUserChange.js +0 -219
  379. package/dist/scripts/resetAllEndorsementsForGroup.js +0 -57
  380. package/dist/scripts/resetEnTranslationForGroup.js +0 -45
  381. package/dist/scripts/setAdminOnAll.cjs +0 -107
  382. package/dist/scripts/setDomainAdmin.cjs +0 -43
  383. package/dist/scripts/setDomainLocales.js +0 -33
  384. package/dist/scripts/setEarlQuestionIdOnGroup.cjs +0 -29
  385. package/dist/scripts/setLanguageOnGroupCommunitesFromUrl.js +0 -86
  386. package/dist/scripts/setMemberOfAll.js +0 -101
  387. package/dist/scripts/setNewUserForContentOfCommunity.js +0 -189
  388. package/dist/scripts/setOfficialStatusOnAllPostsForCommunity.js +0 -35
  389. package/dist/scripts/setUserOnAll.js +0 -101
  390. package/dist/scripts/showCategoryForGroup.js +0 -18
  391. package/dist/scripts/showOldActivityTypes.js +0 -14
  392. package/dist/scripts/showPostsMissingCategoryForGroup.js +0 -17
  393. package/dist/scripts/showStatuses.js +0 -17
  394. package/dist/scripts/showUniqueVotersInCommunity.js +0 -61
  395. package/dist/scripts/showUserAgentsAndIpsForEmails.js +0 -66
  396. package/dist/scripts/simpleExportForGroupsForCommunity.js +0 -46
  397. package/dist/scripts/simpleExportForPointsForCommunity.js +0 -82
  398. package/dist/scripts/simpleExportForPostsForCommunity.js +0 -61
  399. package/dist/scripts/testForEndorsments.js +0 -21
  400. package/dist/scripts/undeleteGroupAndAllContent.js +0 -151
  401. package/dist/scripts/undeletePost.js +0 -135
  402. package/dist/scripts/unlinkSsn.js +0 -23
  403. package/dist/scripts/updateFromAlthingi.js +0 -303
  404. package/dist/server.js +0 -3
  405. package/dist/utils/airbrake.cjs +0 -17
  406. package/dist/utils/cjsCodeReview.js +0 -99
  407. package/dist/utils/community_mapping_tools.cjs +0 -124
  408. package/dist/utils/copy_utils.cjs +0 -1399
  409. package/dist/utils/docx_utils.cjs +0 -464
  410. package/dist/utils/export_utils.cjs +0 -491
  411. package/dist/utils/i18n.cjs +0 -17
  412. package/dist/utils/is_valid_db_id.cjs +0 -28
  413. package/dist/utils/logger.cjs +0 -25
  414. package/dist/utils/loggerTs.js +0 -26
  415. package/dist/utils/manifest_generator.cjs +0 -104
  416. package/dist/utils/parse_domain.cjs +0 -16
  417. package/dist/utils/recount_utils.cjs +0 -415
  418. package/dist/utils/sharing_parameters.cjs +0 -111
  419. package/dist/utils/sitemap_generator.cjs +0 -286
  420. package/dist/utils/to_json.cjs +0 -14
  421. package/dist/utils/ypLanguages.js +0 -747
  422. package/dist/webSockets.js +0 -77
@@ -1,447 +0,0 @@
1
- import { BaseAssistantTools } from "./baseTools.js";
2
- import { AgentModels } from "./models/agents.js";
3
- export class AgentTools extends BaseAssistantTools {
4
- constructor(assistant) {
5
- super(assistant);
6
- this.agentModels = new AgentModels(assistant);
7
- }
8
- get showAgentWorkflowOverviewWidget() {
9
- return {
10
- name: "show_agent_workflow_overview_widget",
11
- description: "Show the workflow widget overview for the current agent.",
12
- type: "function",
13
- parameters: {
14
- type: "object",
15
- properties: {},
16
- },
17
- handler: this.showAgentWorkflowOverviewWidgetHandler.bind(this),
18
- };
19
- }
20
- async showAgentWorkflowOverviewWidgetHandler(params) {
21
- try {
22
- const { agent, run } = await this.agentModels.getCurrentAgentAndWorkflow();
23
- console.log("--------------------> agent", agent);
24
- const workflowJson = JSON.stringify(this.getSimpleWorkflow(agent.configuration.workflow));
25
- const base64Workflow = btoa(workflowJson);
26
- const html = `<yp-agent-workflow-widget
27
- agentProductId="${agent.id}"
28
- runId="${run?.id}"
29
- agentName="${agent.name}"
30
- agentDescription="${agent.description}"
31
- workflow="${base64Workflow}"
32
- workflowStatus="${run?.status || "not_started"}"
33
- ></yp-agent-workflow-widget>`;
34
- let message;
35
- if (!this.assistant.isSubscribedToCurrentAgentProduct) {
36
- if (this.assistant.isLoggedIn) {
37
- message =
38
- "Inform the user that the next step is to subscribe to the agent plan to start the workflow. Offer the user to explain the workflow to them first.";
39
- }
40
- else {
41
- message =
42
- "Inform the user that the next step is to login, then subscribe to the agent plan to start the workflow. You can also offer the user to explain the workflow to them first.";
43
- }
44
- }
45
- else {
46
- message =
47
- "Inform the user that the next step is to start the workflow. You can also ffer the user to explain the workflow to them first.";
48
- }
49
- this.assistant.emit("update-ai-model-session", message);
50
- return {
51
- success: true,
52
- html,
53
- data: { message, agent, run, workflowJson },
54
- };
55
- }
56
- catch (error) {
57
- const errorMessage = error instanceof Error
58
- ? error.message
59
- : "Failed to show workflow widget";
60
- console.error(errorMessage);
61
- console.error("--------------------_> ", error);
62
- return {
63
- success: false,
64
- error: errorMessage,
65
- };
66
- }
67
- }
68
- get showAgentRunWidget() {
69
- return {
70
- name: "show_agent_run_widget",
71
- description: "Show the agent run widget for the current agent run",
72
- type: "function",
73
- parameters: {
74
- type: "object",
75
- properties: {},
76
- },
77
- handler: this.showAgentRunWidgetHandler.bind(this),
78
- };
79
- }
80
- async showAgentRunWidgetHandler(params) {
81
- try {
82
- const { agent, run } = await this.agentModels.getCurrentAgentAndWorkflow();
83
- const agentRun = await this.assistant.getCurrentAgentRun();
84
- if (!agentRun) {
85
- return {
86
- success: false,
87
- error: "No active agent run found",
88
- };
89
- }
90
- const html = await this.renderAgentRunWidget(agent, agentRun);
91
- //TODO: Create a unique identifer so we can make sure to only have one widget showing at the same time on the client but also in the
92
- // chatLog history that we only have the latest html and json so not to confuse the model
93
- const subscription = await this.assistant.getCurrentSubscription();
94
- return {
95
- success: true,
96
- html,
97
- uniqueToken: "agentRunWidget",
98
- data: {
99
- agent,
100
- run,
101
- subscription,
102
- },
103
- };
104
- }
105
- catch (error) {
106
- const errorMessage = error instanceof Error
107
- ? error.message
108
- : "Failed to show agent run widget";
109
- console.error(errorMessage);
110
- return {
111
- success: false,
112
- error: errorMessage,
113
- };
114
- }
115
- }
116
- get createNewAgentRunReadyToRunFirstWorkflowStep() {
117
- return {
118
- name: "create_new_agent_run_ready_to_run_first_workflow_step",
119
- description: "Create a new agent run ready to run the first workflow step. Get a confirmation from the user and set the hasVerballyConfirmedTheRun property to true after the user confirms",
120
- type: "function",
121
- parameters: {
122
- type: "object",
123
- properties: {
124
- hasVerballyConfirmedTheRun: {
125
- type: "boolean",
126
- },
127
- },
128
- required: [
129
- "hasVerballyConfirmedTheRun",
130
- ],
131
- },
132
- handler: this.createNewAgentRunReadyToRunFirstWorkflowStepHandler.bind(this),
133
- };
134
- }
135
- async createNewAgentRunReadyToRunFirstWorkflowStepHandler(params) {
136
- params = this.assistant.getCleanedParams(params);
137
- if (!params.hasVerballyConfirmedTheRun) {
138
- return {
139
- success: false,
140
- error: "User did not verbally confirm starting the new run",
141
- };
142
- }
143
- if (!this.assistant.memory.currentAgentStatus?.subscriptionId) {
144
- return {
145
- success: false,
146
- error: "No subscription found",
147
- };
148
- }
149
- try {
150
- const { agentRun, subscription } = await this.assistant.subscriptionManager.startAgentRun(this.assistant.memory.currentAgentStatus.subscriptionId, this.assistant.wsClients, this.assistant.wsClientId,
151
- //TODO: Fix this type casting
152
- this.assistant.memory.currentUser);
153
- await this.updateAgentProductRun(agentRun);
154
- const html = await this.renderAgentRunWidget(subscription.AgentProduct, agentRun);
155
- const message = "You've created new agent run ready to run the first workflow step, out of many. It will not start automatically, the user needs to start it verbally.";
156
- this.assistant.emit("update-ai-model-session", message);
157
- return {
158
- success: true,
159
- html,
160
- uniqueToken: "agentRunWidget",
161
- data: {
162
- message,
163
- agentRun,
164
- subscription,
165
- },
166
- };
167
- }
168
- catch (error) {
169
- const errorMessage = error instanceof Error ? error.message : "Failed to start run";
170
- console.error(errorMessage);
171
- return {
172
- success: false,
173
- error: errorMessage,
174
- };
175
- }
176
- }
177
- async startCurrentRunAgentNextWorkflowStep() {
178
- const nextWorkflowStep = await this.agentModels.getNextWorkflowStep();
179
- if (!nextWorkflowStep) {
180
- throw new Error("No next workflow step found");
181
- }
182
- return {
183
- name: `start_next_workflow_step_for_${this.agentModels.convertToUnderscoresWithMaxLength(nextWorkflowStep.name)}`,
184
- description: `Start the next workflow step for this current agent run. ${nextWorkflowStep.description}`,
185
- type: "function",
186
- parameters: {
187
- type: "object",
188
- properties: {
189
- userHasVerballyConfirmedStartOfNextWorkflowStepWithTheAgentName: {
190
- type: "boolean",
191
- },
192
- },
193
- required: [
194
- "userHasVerballyConfirmedStartOfNextWorkflowStepWithTheAgentName",
195
- ],
196
- },
197
- handler: this.startCurrentRunAgentNextWorkflowStepHandler.bind(this),
198
- };
199
- }
200
- async startCurrentRunAgentNextWorkflowStepHandler(params) {
201
- params = this.assistant.getCleanedParams(params);
202
- if (!params.userHasVerballyConfirmedStartOfNextWorkflowStepWithTheAgentName) {
203
- return {
204
- success: false,
205
- error: "User did not confirm starting the next workflow step with the agent name",
206
- };
207
- }
208
- const agentRun = await this.assistant.getCurrentAgentRun();
209
- if (!agentRun) {
210
- return {
211
- success: false,
212
- error: "No active agent run found",
213
- };
214
- }
215
- try {
216
- const structuredAnswersOverrides = [];
217
- const subscription = await this.assistant.getCurrentSubscription();
218
- const subscriptionPlan = await this.assistant.getCurrentSubscriptionPlan();
219
- if (!subscriptionPlan) {
220
- throw new Error("No subscription plan found");
221
- }
222
- if (subscription &&
223
- subscription.configuration?.requiredQuestionsAnswered) {
224
- structuredAnswersOverrides.push(...subscription.configuration.requiredQuestionsAnswered);
225
- }
226
- if (subscriptionPlan &&
227
- subscriptionPlan.AgentProduct?.configuration.structuredAnswersOverride) {
228
- structuredAnswersOverrides.push(...subscriptionPlan.AgentProduct.configuration
229
- .structuredAnswersOverride);
230
- }
231
- const result = await this.agentModels.startCurrentWorkflowStep(agentRun.id, structuredAnswersOverrides);
232
- await this.updateAgentProductRun(result.agentRun);
233
- const html = await this.renderAgentRunWidget(subscriptionPlan.AgentProduct, result.agentRun);
234
- this.assistant.emit("update-ai-model-session", "You have started the next workflow step for the current agent run, let the user know you will email them a notification when the task is completed or if a problem occurs.");
235
- setTimeout(() => {
236
- /*this.assistant.triggerResponseIfNeeded(
237
- "Offer the user to deactivate yourself as long running agents are in progress."
238
- );*/
239
- }, 25000);
240
- return {
241
- success: true,
242
- html,
243
- uniqueToken: "agentRunWidget",
244
- data: result,
245
- };
246
- }
247
- catch (error) {
248
- const errorMessage = error instanceof Error ? error.message : "Failed to start workflow";
249
- console.error(errorMessage);
250
- return {
251
- success: false,
252
- error: errorMessage,
253
- };
254
- }
255
- }
256
- get stopCurrentAgentWorkflow() {
257
- return {
258
- name: "stop_current_agent_workflow_step",
259
- description: "Stop the currently running agent workflow step",
260
- type: "function",
261
- parameters: {
262
- type: "object",
263
- properties: {
264
- userHasVerballyConfirmedStopCurrentWorkflowStepWithTheAgentName: {
265
- type: "boolean",
266
- },
267
- },
268
- required: [
269
- "userHasVerballyConfirmedStopCurrentWorkflowStepWithTheAgentName",
270
- ],
271
- },
272
- handler: this.stopCurrentAgentWorkflowHandler.bind(this),
273
- };
274
- }
275
- async stopCurrentAgentWorkflowHandler(params) {
276
- params = this.assistant.getCleanedParams(params);
277
- if (!params.userHasVerballyConfirmedStopCurrentWorkflowStepWithTheAgentName) {
278
- return {
279
- success: false,
280
- error: "User did not confirm stopping the current workflow step with the agent name",
281
- };
282
- }
283
- try {
284
- const result = await this.agentModels.stopCurrentWorkflowStep();
285
- const html = await this.renderAgentRunWidget(result.agent, result.run);
286
- await this.updateAgentProductRun(result.run);
287
- this.assistant.emit("update-ai-model-session", "We have stopped the current workflow step for the current agent run");
288
- return {
289
- success: true,
290
- html,
291
- uniqueToken: "agentRunWidget",
292
- data: result,
293
- };
294
- }
295
- catch (error) {
296
- const errorMessage = error instanceof Error ? error.message : "Failed to stop workflow";
297
- console.error(errorMessage);
298
- return {
299
- success: false,
300
- error: errorMessage,
301
- };
302
- }
303
- }
304
- get deactivateAgent() {
305
- return {
306
- name: "deactivate_yourself_until_later",
307
- description: "Deactivate yourself after long running task has started, then you will be reactivated automatically when the task is completed or if a problem occurs",
308
- type: "function",
309
- parameters: {
310
- type: "object",
311
- properties: {},
312
- },
313
- handler: this.deactivateAgentHandler.bind(this),
314
- };
315
- }
316
- async deactivateAgentHandler(params) {
317
- try {
318
- //await this.agentModels.deactivateAgent();
319
- return {
320
- success: true,
321
- data: { message: "Deactivated the current agent" },
322
- };
323
- }
324
- catch (error) {
325
- const errorMessage = error instanceof Error ? error.message : "Failed to deactivate agent";
326
- console.error(errorMessage);
327
- return {
328
- success: false,
329
- error: errorMessage,
330
- };
331
- }
332
- }
333
- get showConfigurationWidget() {
334
- return {
335
- name: "show_configuration_widget_if_needed_or_user_asks_to_show_it",
336
- description: "Show the configuration widget for the current agent. The user needs to fill out the configuration before running the agent workflow to make sure to offer it to the user. \
337
- The user can not provide you with the configuration verbally or through chat, the user must provide the configuration through the configuration widget.",
338
- type: "function",
339
- parameters: {
340
- type: "object",
341
- properties: {},
342
- },
343
- handler: this.showConfigurationWidgetHandler.bind(this),
344
- };
345
- }
346
- async showConfigurationWidgetHandler(params) {
347
- try {
348
- const agent = await this.assistant.getCurrentAgentProduct();
349
- const subscription = await this.assistant.getCurrentSubscription();
350
- const subscriptionPlan = await this.assistant.getCurrentSubscriptionPlan();
351
- if (!agent || !subscription || !subscriptionPlan) {
352
- throw new Error("No agent, subscription or subscription plan found");
353
- }
354
- const html = `<yp-agent-configuration-widget
355
- domainId="${this.assistant.domainId}"
356
- agentProductId="${agent.id}"
357
- agentName="${agent.name}"
358
- subscriptionId="${subscription.id}"
359
- agentImageUrl="${agent.configuration.avatar?.imageUrl}"
360
- requiredQuestions='${JSON.stringify(subscriptionPlan.configuration.requiredStructuredQuestions)}'
361
- requiredQuestionsAnswered='${JSON.stringify(subscription?.configuration?.requiredQuestionsAnswered ?? [])}'
362
- ></yp-agent-configuration-widget>`;
363
- await this.updateShownConfigurationWidget();
364
- this.assistant.emit("update-ai-model-session", "You've shown the configuration widget to the user");
365
- return {
366
- success: true,
367
- html,
368
- uniqueToken: "agentConfigurationWidget",
369
- data: {
370
- agent,
371
- subscription,
372
- },
373
- };
374
- }
375
- catch (error) {
376
- const errorMessage = error instanceof Error
377
- ? error.message
378
- : "Failed to show configuration widget";
379
- console.error(errorMessage);
380
- return {
381
- success: false,
382
- error: errorMessage,
383
- };
384
- }
385
- }
386
- get submitConfiguration() {
387
- return {
388
- name: "submit_configuration",
389
- description: "Submit the configuration for the current agent by clicking the submit button for the user. The only way for the user to provide the configuration is through the configuration widget.",
390
- type: "function",
391
- parameters: {
392
- type: "object",
393
- properties: {},
394
- },
395
- handler: this.submitConfigurationHandler.bind(this),
396
- };
397
- }
398
- async submitConfigurationHandler(params) {
399
- try {
400
- const clientEvent = {
401
- name: "ui_click",
402
- details: "submit-agent-configuration",
403
- };
404
- return {
405
- success: true,
406
- clientEvents: [clientEvent],
407
- data: {
408
- message: "Submitted configuration for the current agent successfully now offer the user to start the agent workflow run",
409
- },
410
- };
411
- }
412
- catch (error) {
413
- const errorMessage = error instanceof Error
414
- ? error.message
415
- : "Failed to submit configuration";
416
- console.error(errorMessage);
417
- return {
418
- success: false,
419
- error: errorMessage,
420
- };
421
- }
422
- }
423
- getSimpleWorkflow(workflow) {
424
- const workflowCopy = JSON.parse(JSON.stringify(workflow));
425
- if (workflowCopy.steps) {
426
- workflowCopy.steps.forEach((step) => {
427
- step.emailInstructions = "";
428
- });
429
- }
430
- return workflowCopy;
431
- }
432
- async renderAgentRunWidget(agent, run) {
433
- const subscription = await this.assistant.getCurrentSubscription();
434
- const workflowCopy = this.getSimpleWorkflow(run.workflow);
435
- const workflowBase64 = btoa(JSON.stringify(workflowCopy));
436
- return `<yp-agent-run-widget
437
- agentProductId="${agent.id}"
438
- runId="${run.id}"
439
- wsClientId="${this.assistant.wsClientId}"
440
- agentName="${agent.name}"
441
- agentImageUrl="${agent.configuration.avatar?.imageUrl}"
442
- workflow="${workflowBase64}"
443
- runStatus="${run.status}"
444
- maxRunsPerCycle="${subscription?.Plan?.configuration.max_runs_per_cycle}"
445
- ></yp-agent-run-widget>`;
446
- }
447
- }
@@ -1,58 +0,0 @@
1
- export class BaseAssistantTools {
2
- constructor(assistant) {
3
- this.assistant = assistant;
4
- }
5
- //TODO: Look into this but it's here as we want the tool execution to finish before we update the memory
6
- async waitTick() {
7
- await new Promise((resolve) => setTimeout(resolve, 1));
8
- }
9
- async updateCurrentAgentProductPlan(plan, subscription, options = { sendEvent: true }) {
10
- await this.assistant.updateCurrentAgentProductPlan(plan.id, subscription?.id ?? null);
11
- await this.waitTick();
12
- // Emit memory update event
13
- if (options.sendEvent) {
14
- this.assistant.emit("memory-changed", this.assistant.memory);
15
- }
16
- //TODO: Do we need this?
17
- //this.assistant.emit("update-ai-model-session", "Updated agent product");
18
- }
19
- async updateAgentProductRun(agentRun, options = { sendEvent: true }) {
20
- if (!this.assistant.memory.currentAgentStatus) {
21
- throw new Error("No current agent status found");
22
- }
23
- await this.assistant.loadMemoryAsync();
24
- this.assistant.memory.currentAgentStatus.activeAgentRunId = agentRun.id;
25
- await this.assistant.saveMemory();
26
- await this.waitTick();
27
- if (options.sendEvent) {
28
- this.assistant.emit("memory-changed", this.assistant.memory);
29
- }
30
- this.assistant.emit("update-ai-model-session", "Updated agent product run");
31
- }
32
- async updateShownConfigurationWidget(options = { sendEvent: true }) {
33
- this.assistant.memory.haveShownConfigurationWidget = true;
34
- await this.assistant.saveMemory();
35
- await this.waitTick();
36
- if (options.sendEvent) {
37
- this.assistant.emit("memory-changed", this.assistant.memory);
38
- }
39
- }
40
- async updateHaveShownLoginWidget(options = { sendEvent: true }) {
41
- this.assistant.memory.haveShownLoginWidget = true;
42
- await this.assistant.saveMemory();
43
- await this.waitTick();
44
- if (options.sendEvent) {
45
- this.assistant.emit("memory-changed", this.assistant.memory);
46
- }
47
- this.assistant.emit("update-ai-model-session", "Shown login widget");
48
- }
49
- async clearCurrentAgentProduct(options = { sendEvent: true }) {
50
- this.assistant.memory.currentAgentStatus = undefined;
51
- await this.assistant.saveMemory();
52
- await this.waitTick();
53
- if (options.sendEvent) {
54
- this.assistant.emit("memory-changed", this.assistant.memory);
55
- }
56
- this.assistant.emit("update-ai-model-session", "Cleared current agent product");
57
- }
58
- }
@@ -1,156 +0,0 @@
1
- // commonTools.ts
2
- import { BaseAssistantTools } from "./baseTools.js";
3
- export class LoginAssistantTools extends BaseAssistantTools {
4
- constructor(assistant) {
5
- super(assistant);
6
- }
7
- showLogin(description) {
8
- return {
9
- name: "show_login_widget",
10
- description,
11
- type: "function",
12
- parameters: {
13
- type: "object",
14
- properties: {},
15
- required: [],
16
- },
17
- handler: this.showLoginHandler.bind(this),
18
- };
19
- }
20
- async showLoginHandler(params) {
21
- params = this.assistant.getCleanedParams(params);
22
- console.log(`handler: showLogin: ${JSON.stringify(params, null, 2)}`);
23
- try {
24
- await this.updateHaveShownLoginWidget();
25
- const html = `<yp-login-widget
26
- id="userLogin"
27
- class="loginSurface"
28
- fullWithLoginButton
29
- ></yp-login-widget>`;
30
- return {
31
- success: true,
32
- html,
33
- uniqueToken: "loginWidget",
34
- data: { message: "Login widget shown successfully" },
35
- metadata: {
36
- timestamp: new Date().toISOString(),
37
- },
38
- };
39
- }
40
- catch (error) {
41
- const errorMessage = error instanceof Error ? error.message : "Failed to login";
42
- console.error(`Failed to login: ${errorMessage}`);
43
- return {
44
- success: false,
45
- error: errorMessage,
46
- };
47
- }
48
- }
49
- get clickMainLoginButton() {
50
- return {
51
- name: "click_main_login_button",
52
- description: "Send an event to click the main login button to the web app",
53
- type: "function",
54
- parameters: {
55
- type: "object",
56
- properties: {},
57
- },
58
- handler: this.clickMainLoginButtonHandler.bind(this),
59
- };
60
- }
61
- async clickMainLoginButtonHandler(params) {
62
- params = this.assistant.getCleanedParams(params);
63
- console.log(`handler: clickMainLoginButton: ${JSON.stringify(params, null, 2)}`);
64
- const clientEvent = {
65
- name: "ui_click",
66
- details: "login-button-main",
67
- };
68
- return {
69
- success: true,
70
- data: { message: "Main login button clicked successfully" },
71
- clientEvents: [clientEvent],
72
- metadata: {
73
- timestamp: new Date().toISOString(),
74
- },
75
- };
76
- }
77
- get clickGoogleLoginButton() {
78
- return {
79
- name: "click_google_login_button",
80
- description: "Submit an event to click the Google login button to the web app",
81
- type: "function",
82
- parameters: {
83
- type: "object",
84
- properties: {},
85
- },
86
- handler: this.clickGoogleLoginButtonHandler.bind(this),
87
- };
88
- }
89
- async clickGoogleLoginButtonHandler(params) {
90
- params = this.assistant.getCleanedParams(params);
91
- console.log(`handler: clickGoogleLoginButton: ${JSON.stringify(params, null, 2)}`);
92
- const clientEvent = {
93
- name: "ui_click",
94
- details: "login-button-google",
95
- };
96
- return {
97
- success: true,
98
- data: { message: "Google login button clicked successfully" },
99
- clientEvents: [clientEvent],
100
- metadata: {
101
- timestamp: new Date().toISOString(),
102
- },
103
- };
104
- }
105
- get logout() {
106
- return {
107
- name: "logout",
108
- description: "Log out from the system with confirmation if the user asks for it. If this tools is showing it means that the user is already logged in.",
109
- type: "function",
110
- parameters: {
111
- type: "object",
112
- properties: {
113
- confirmLogout: { type: "boolean" },
114
- },
115
- required: [
116
- "confirmLogout",
117
- ],
118
- },
119
- handler: this.logoutHandler.bind(this),
120
- };
121
- }
122
- async logoutHandler(params) {
123
- params = this.assistant.getCleanedParams(params);
124
- console.log(`handler: logout: ${JSON.stringify(params, null, 2)}`);
125
- const clientEvent = {
126
- name: "ui_click",
127
- details: {
128
- element: "logout",
129
- },
130
- };
131
- try {
132
- if (!params.confirmLogout) {
133
- return {
134
- success: false,
135
- error: "Please confirm that you want to log out",
136
- };
137
- }
138
- return {
139
- success: true,
140
- data: { message: "UI Event for logout sent successfully" },
141
- clientEvents: [clientEvent],
142
- metadata: {
143
- timestamp: new Date().toISOString(),
144
- },
145
- };
146
- }
147
- catch (error) {
148
- const errorMessage = error instanceof Error ? error.message : "Failed to logout";
149
- console.error(`Failed to logout: ${errorMessage}`);
150
- return {
151
- success: false,
152
- error: errorMessage,
153
- };
154
- }
155
- }
156
- }