openloops 0.1.8 → 0.1.10
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.
- package/dist/chunk-XRJFNASX.mjs +14 -0
- package/dist/common/clients/index.js +26 -0
- package/dist/common/clients/index.mjs +3 -0
- package/dist/common/clients/llm-client.js +159 -0
- package/dist/common/clients/llm-client.mjs +126 -0
- package/dist/common/clients/sentry-client.js +87 -0
- package/dist/common/clients/sentry-client.mjs +53 -0
- package/dist/common/clients/serper-client.js +74 -0
- package/dist/common/clients/serper-client.mjs +41 -0
- package/dist/common/core/base.app.js +57 -0
- package/dist/common/core/base.app.mjs +34 -0
- package/dist/common/core/base.entity.js +208 -0
- package/dist/common/core/base.entity.mjs +179 -0
- package/dist/common/core/base.use-case.js +30 -0
- package/dist/common/core/base.use-case.mjs +7 -0
- package/dist/common/core/index.js +1 -0
- package/dist/common/core/index.mjs +0 -0
- package/dist/common/core/utils/delete-empty-fields.js +66 -0
- package/dist/common/core/utils/delete-empty-fields.mjs +43 -0
- package/dist/common/core/utils/flatten-object.js +45 -0
- package/dist/common/core/utils/flatten-object.mjs +22 -0
- package/dist/common/core/utils/index.js +26 -0
- package/dist/common/core/utils/index.mjs +3 -0
- package/dist/common/core/utils/is-plain-object.js +32 -0
- package/dist/common/core/utils/is-plain-object.mjs +9 -0
- package/dist/common/decorators/admin-only/admin-only.js +52 -0
- package/dist/common/decorators/admin-only/admin-only.mjs +28 -0
- package/dist/common/decorators/admin-only/index.js +22 -0
- package/dist/common/decorators/admin-only/index.mjs +1 -0
- package/dist/common/decorators/index.js +26 -0
- package/dist/common/decorators/index.mjs +3 -0
- package/dist/common/decorators/mask-in-logs/index.js +22 -0
- package/dist/common/decorators/mask-in-logs/index.mjs +1 -0
- package/dist/common/decorators/mask-in-logs/mask-in-logs.js +53 -0
- package/dist/common/decorators/mask-in-logs/mask-in-logs.mjs +29 -0
- package/dist/common/decorators/owner-only/index.js +22 -0
- package/dist/common/decorators/owner-only/index.mjs +1 -0
- package/dist/common/decorators/owner-only/owner-only.js +52 -0
- package/dist/common/decorators/owner-only/owner-only.mjs +28 -0
- package/dist/common/error/http-error.js +37 -0
- package/dist/common/error/http-error.mjs +14 -0
- package/dist/common/error/index.js +24 -0
- package/dist/common/error/index.mjs +2 -0
- package/dist/common/error/reportError.js +51 -0
- package/dist/common/error/reportError.mjs +28 -0
- package/dist/common/helpers/extract-json-from-text.js +63 -0
- package/dist/common/helpers/extract-json-from-text.mjs +40 -0
- package/dist/common/helpers/index.js +24 -0
- package/dist/common/helpers/index.mjs +2 -0
- package/dist/common/helpers/sanitize-string.js +45 -0
- package/dist/common/helpers/sanitize-string.mjs +12 -0
- package/dist/common/logger/index.js +22 -0
- package/dist/common/logger/index.mjs +1 -0
- package/dist/common/logger/pino.js +70 -0
- package/dist/common/logger/pino.mjs +36 -0
- package/dist/common/repositories/index.js +24 -0
- package/dist/common/repositories/index.mjs +2 -0
- package/dist/common/repositories/mongo-db.client.js +79 -0
- package/dist/common/repositories/mongo-db.client.mjs +57 -0
- package/dist/common/repositories/mongo-db.repository.js +219 -0
- package/dist/common/repositories/mongo-db.repository.mjs +196 -0
- package/dist/common/utils/secret-manager.js +105 -0
- package/dist/common/utils/secret-manager.mjs +71 -0
- package/dist/index.js +22 -7
- package/dist/index.mjs +1 -7
- package/dist/services/agent/core/agent-loop.js +29 -0
- package/dist/services/agent/core/agent-loop.mjs +6 -0
- package/dist/services/agent/core/agent-state.js +102 -0
- package/dist/services/agent/core/agent-state.mjs +78 -0
- package/dist/services/agent/core/agent.js +351 -0
- package/dist/services/agent/core/agent.mjs +327 -0
- package/dist/services/agent/core/index.js +26 -0
- package/dist/services/agent/core/index.mjs +3 -0
- package/dist/services/agent/loops/index.js +24 -0
- package/dist/services/agent/loops/index.mjs +2 -0
- package/dist/services/agent/loops/plan-execute/index.js +22 -0
- package/dist/services/agent/loops/plan-execute/index.mjs +1 -0
- package/dist/services/agent/loops/plan-execute/plan-execute-loop.js +242 -0
- package/dist/services/agent/loops/plan-execute/plan-execute-loop.mjs +226 -0
- package/dist/services/agent/loops/shared/index.js +22 -0
- package/dist/services/agent/loops/shared/index.mjs +1 -0
- package/dist/services/agent/loops/shared/skills/action-planner.js +68 -0
- package/dist/services/agent/loops/shared/skills/action-planner.mjs +45 -0
- package/dist/services/agent/loops/shared/skills/confirmation-gate.js +53 -0
- package/dist/services/agent/loops/shared/skills/confirmation-gate.mjs +30 -0
- package/dist/services/agent/loops/shared/skills/fast-responder.js +70 -0
- package/dist/services/agent/loops/shared/skills/fast-responder.mjs +47 -0
- package/dist/services/agent/loops/shared/skills/final-responder.js +57 -0
- package/dist/services/agent/loops/shared/skills/final-responder.mjs +34 -0
- package/dist/services/agent/loops/shared/skills/index.js +32 -0
- package/dist/services/agent/loops/shared/skills/index.mjs +6 -0
- package/dist/services/agent/loops/shared/skills/state-observer.js +57 -0
- package/dist/services/agent/loops/shared/skills/state-observer.mjs +34 -0
- package/dist/services/agent/loops/shared/skills/strategy-engine.js +60 -0
- package/dist/services/agent/loops/shared/skills/strategy-engine.mjs +37 -0
- package/dist/services/agent/modules/chats/entities/agent-action.entity.js +151 -0
- package/dist/services/agent/modules/chats/entities/agent-action.entity.mjs +128 -0
- package/dist/services/agent/modules/chats/entities/agent-task.entity.js +231 -0
- package/dist/services/agent/modules/chats/entities/agent-task.entity.mjs +207 -0
- package/dist/services/agent/modules/chats/entities/chat-context.entity.js +70 -0
- package/dist/services/agent/modules/chats/entities/chat-context.entity.mjs +47 -0
- package/dist/services/agent/modules/chats/entities/chat-message.entity.js +58 -0
- package/dist/services/agent/modules/chats/entities/chat-message.entity.mjs +35 -0
- package/dist/services/agent/modules/chats/entities/chat-settings.entity.js +63 -0
- package/dist/services/agent/modules/chats/entities/chat-settings.entity.mjs +40 -0
- package/dist/services/agent/modules/chats/entities/chat.entity.js +163 -0
- package/dist/services/agent/modules/chats/entities/chat.entity.mjs +140 -0
- package/dist/services/agent/modules/chats/entities/index.js +22 -0
- package/dist/services/agent/modules/chats/entities/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/create-chat.use-case.js +56 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/create-chat.use-case.mjs +27 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/delete-chat.use-case.js +61 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/delete-chat.use-case.mjs +32 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/interrupt-execution.use-case.js +64 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/interrupt-execution.use-case.mjs +35 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/list-chats-by-props.use-case.js +52 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/list-chats-by-props.use-case.mjs +23 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/list-chats-by-user.use-case.js +59 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/list-chats-by-user.use-case.mjs +30 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/update-chat.use-case.js +64 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/update-chat.use-case.mjs +35 -0
- package/dist/services/agent/modules/chats/repositories/chat.repository.js +67 -0
- package/dist/services/agent/modules/chats/repositories/chat.repository.mjs +38 -0
- package/dist/services/agent/modules/chats/repositories/index.js +22 -0
- package/dist/services/agent/modules/chats/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/entities/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/entities/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/entities/llmcall.entity.js +71 -0
- package/dist/services/agent/modules/llmcalls/entities/llmcall.entity.mjs +48 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/create-llmcall.use-case.js +56 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/create-llmcall.use-case.mjs +27 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/delete-llmcall.use-case.js +61 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/delete-llmcall.use-case.mjs +32 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/get-llm-usage.use-case.js +123 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/get-llm-usage.use-case.mjs +94 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/get-llmcall-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/get-llmcall-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/list-llmcalls-by-props.use-case.js +52 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/list-llmcalls-by-props.use-case.mjs +23 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/update-llmcall.use-case.js +62 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/update-llmcall.use-case.mjs +33 -0
- package/dist/services/agent/modules/llmcalls/repositories/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/repositories/llmcall.repository.js +67 -0
- package/dist/services/agent/modules/llmcalls/repositories/llmcall.repository.mjs +38 -0
- package/dist/services/agent/modules/mcp-servers/entities/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/entities/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/entities/mcpserver.entity.js +79 -0
- package/dist/services/agent/modules/mcp-servers/entities/mcpserver.entity.mjs +56 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/create-mcpserver.use-case.js +56 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/create-mcpserver.use-case.mjs +27 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/delete-mcpserver.use-case.js +61 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/delete-mcpserver.use-case.mjs +32 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/get-mcpserver-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/get-mcpserver-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/list-mcpservers-by-user.use-case.js +59 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/list-mcpservers-by-user.use-case.mjs +30 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/update-mcpserver.use-case.js +61 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/update-mcpserver.use-case.mjs +32 -0
- package/dist/services/agent/modules/mcp-servers/repositories/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/repositories/mcpserver.repository.js +67 -0
- package/dist/services/agent/modules/mcp-servers/repositories/mcpserver.repository.mjs +38 -0
- package/dist/services/agent/skills/index.js +24 -0
- package/dist/services/agent/skills/index.mjs +2 -0
- package/dist/services/agent/skills/shared/index.js +22 -0
- package/dist/services/agent/skills/shared/index.mjs +1 -0
- package/dist/services/agent/skills/shared/shared-rules.js +37 -0
- package/dist/services/agent/skills/shared/shared-rules.mjs +11 -0
- package/dist/services/agent/skills/skill-runner.js +121 -0
- package/dist/services/agent/skills/skill-runner.mjs +92 -0
- package/dist/services/agent/skills/skill.js +128 -0
- package/dist/services/agent/skills/skill.mjs +105 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.skill.js +54 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.skill.mjs +31 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.tool.js +68 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.tool.mjs +45 -0
- package/dist/services/agent/tools/core/call-ai/index.js +22 -0
- package/dist/services/agent/tools/core/call-ai/index.mjs +1 -0
- package/dist/services/agent/tools/core/index.js +24 -0
- package/dist/services/agent/tools/core/index.mjs +2 -0
- package/dist/services/agent/tools/core/web-search/index.js +22 -0
- package/dist/services/agent/tools/core/web-search/index.mjs +1 -0
- package/dist/services/agent/tools/core/web-search/web-search.tool.js +51 -0
- package/dist/services/agent/tools/core/web-search/web-search.tool.mjs +30 -0
- package/dist/services/agent/tools/index.js +24 -0
- package/dist/services/agent/tools/index.mjs +2 -0
- package/dist/services/agent/tools/tool.js +57 -0
- package/dist/services/agent/tools/tool.mjs +34 -0
- package/dist/services/agent/utils/rank-tools-by-keywords.js +65 -0
- package/dist/services/agent/utils/rank-tools-by-keywords.mjs +42 -0
- package/dist/services/app/core/app.js +60 -0
- package/dist/services/app/core/app.mjs +47 -0
- package/dist/services/app/core/current-session.js +124 -0
- package/dist/services/app/core/current-session.mjs +104 -0
- package/dist/services/app/core/current-user.js +84 -0
- package/dist/services/app/core/current-user.mjs +61 -0
- package/dist/services/app/core/index.js +26 -0
- package/dist/services/app/core/index.mjs +3 -0
- package/dist/services/app/modules/authentication/lambdas/login/index.js +22 -0
- package/dist/services/app/modules/authentication/lambdas/login/index.mjs +1 -0
- package/dist/services/app/modules/authentication/lambdas/login/login.use-case.js +89 -0
- package/dist/services/app/modules/authentication/lambdas/login/login.use-case.mjs +50 -0
- package/dist/services/app/modules/users/entities/index.js +22 -0
- package/dist/services/app/modules/users/entities/index.mjs +1 -0
- package/dist/services/app/modules/users/entities/user-acquisition.js +55 -0
- package/dist/services/app/modules/users/entities/user-acquisition.mjs +26 -0
- package/dist/services/app/modules/users/entities/user-country.js +44 -0
- package/dist/services/app/modules/users/entities/user-country.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-currency.js +44 -0
- package/dist/services/app/modules/users/entities/user-currency.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-email.value-object.js +43 -0
- package/dist/services/app/modules/users/entities/user-email.value-object.mjs +20 -0
- package/dist/services/app/modules/users/entities/user-language.js +44 -0
- package/dist/services/app/modules/users/entities/user-language.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-marketing.js +53 -0
- package/dist/services/app/modules/users/entities/user-marketing.mjs +24 -0
- package/dist/services/app/modules/users/entities/user-notification-preferences.js +41 -0
- package/dist/services/app/modules/users/entities/user-notification-preferences.mjs +18 -0
- package/dist/services/app/modules/users/entities/user-password.value-object.js +69 -0
- package/dist/services/app/modules/users/entities/user-password.value-object.mjs +36 -0
- package/dist/services/app/modules/users/entities/user-permissions.js +59 -0
- package/dist/services/app/modules/users/entities/user-permissions.mjs +36 -0
- package/dist/services/app/modules/users/entities/user-preferences.js +69 -0
- package/dist/services/app/modules/users/entities/user-preferences.mjs +46 -0
- package/dist/services/app/modules/users/entities/user-report-preferences.js +56 -0
- package/dist/services/app/modules/users/entities/user-report-preferences.mjs +33 -0
- package/dist/services/app/modules/users/entities/user-report-schedule.js +41 -0
- package/dist/services/app/modules/users/entities/user-report-schedule.mjs +18 -0
- package/dist/services/app/modules/users/entities/user-timezone.js +44 -0
- package/dist/services/app/modules/users/entities/user-timezone.mjs +21 -0
- package/dist/services/app/modules/users/entities/user.entity.js +133 -0
- package/dist/services/app/modules/users/entities/user.entity.mjs +103 -0
- package/dist/services/app/modules/users/lambdas/create-user/create-user.use-case.js +58 -0
- package/dist/services/app/modules/users/lambdas/create-user/create-user.use-case.mjs +29 -0
- package/dist/services/app/modules/users/lambdas/create-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/create-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/delete-user/delete-user.use-case.js +61 -0
- package/dist/services/app/modules/users/lambdas/delete-user/delete-user.use-case.mjs +32 -0
- package/dist/services/app/modules/users/lambdas/delete-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/delete-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/get-user-by-id.use-case.js +52 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/get-user-by-id.use-case.mjs +23 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/list-users-by-props.use-case.js +52 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/list-users-by-props.use-case.mjs +23 -0
- package/dist/services/app/modules/users/lambdas/update-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/update-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/update-user/update-user.use-case.js +62 -0
- package/dist/services/app/modules/users/lambdas/update-user/update-user.use-case.mjs +33 -0
- package/dist/services/app/modules/users/repositories/index.js +22 -0
- package/dist/services/app/modules/users/repositories/index.mjs +1 -0
- package/dist/services/app/modules/users/repositories/user.repository.js +83 -0
- package/dist/services/app/modules/users/repositories/user.repository.mjs +54 -0
- package/package.json +2 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result) __defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var skill_runner_exports = {};
|
|
28
|
+
__export(skill_runner_exports, {
|
|
29
|
+
SkillRunner: () => SkillRunner
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(skill_runner_exports);
|
|
32
|
+
var import_tsyringe = require("tsyringe");
|
|
33
|
+
var import_helpers = require("@common/helpers");
|
|
34
|
+
let SkillRunner = class {
|
|
35
|
+
constructor(llmClient) {
|
|
36
|
+
this.llmClient = llmClient;
|
|
37
|
+
}
|
|
38
|
+
llmClient;
|
|
39
|
+
async execute(options) {
|
|
40
|
+
const { skill, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {} } = options;
|
|
41
|
+
const currentCountryCode = currentSession?.location?.country;
|
|
42
|
+
const currentCurrencyCode = currentSession?.currencyCode;
|
|
43
|
+
const now = /* @__PURE__ */ new Date();
|
|
44
|
+
const timezone = currentSession?.location?.timezone;
|
|
45
|
+
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
46
|
+
const payload = {
|
|
47
|
+
SYSTEM_INSTRUCTIONS: {
|
|
48
|
+
...skill.systemInstructions
|
|
49
|
+
},
|
|
50
|
+
CONTEXT: {
|
|
51
|
+
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52
|
+
now_local: nowLocal,
|
|
53
|
+
timezone: currentSession?.location?.timezone,
|
|
54
|
+
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
55
|
+
...currentUser ? {
|
|
56
|
+
user_details: {
|
|
57
|
+
first_name: currentUser?.firstName,
|
|
58
|
+
last_name: currentUser?.lastName,
|
|
59
|
+
// Configuración/Preferencias del usuario
|
|
60
|
+
preferred_language: currentUser?.language,
|
|
61
|
+
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
62
|
+
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
63
|
+
}
|
|
64
|
+
} : {},
|
|
65
|
+
...currentSession ? {
|
|
66
|
+
session_details: {
|
|
67
|
+
current_location: {
|
|
68
|
+
country_code: currentCountryCode,
|
|
69
|
+
currency_code: currentCurrencyCode,
|
|
70
|
+
timezone_offset: currentSession?.timezoneOffset
|
|
71
|
+
},
|
|
72
|
+
client_info: {
|
|
73
|
+
platform: currentSession?.device?.os,
|
|
74
|
+
brand: currentSession?.device?.brand,
|
|
75
|
+
model: currentSession?.device?.model
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} : {},
|
|
79
|
+
...contextInjection
|
|
80
|
+
},
|
|
81
|
+
INPUT: {
|
|
82
|
+
...userMessage ? { user_message: userMessage } : {},
|
|
83
|
+
...input
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const response = await this.llmClient.complete({
|
|
87
|
+
sessionId,
|
|
88
|
+
answerId,
|
|
89
|
+
taskName: skill.name,
|
|
90
|
+
currentUser,
|
|
91
|
+
messages: [
|
|
92
|
+
{
|
|
93
|
+
role: "user",
|
|
94
|
+
timestamp: Date.now(),
|
|
95
|
+
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
temperature: skill.temperature ?? 0.7
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
...this.parseJsonResponse(response),
|
|
102
|
+
responseId: response.responseId ?? "",
|
|
103
|
+
costInUsd: response?.usage?.cost?.total
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
parseJsonResponse(response) {
|
|
107
|
+
const rawContent = response?.content ?? [];
|
|
108
|
+
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
109
|
+
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
110
|
+
const content = (0, import_helpers.extractJSON)(text);
|
|
111
|
+
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
112
|
+
return content;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
SkillRunner = __decorateClass([
|
|
116
|
+
(0, import_tsyringe.autoInjectable)()
|
|
117
|
+
], SkillRunner);
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
SkillRunner
|
|
121
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "../../../chunk-XRJFNASX.mjs";
|
|
4
|
+
import { autoInjectable } from "tsyringe";
|
|
5
|
+
import { extractJSON } from "@common/helpers";
|
|
6
|
+
let SkillRunner = class {
|
|
7
|
+
constructor(llmClient) {
|
|
8
|
+
this.llmClient = llmClient;
|
|
9
|
+
}
|
|
10
|
+
llmClient;
|
|
11
|
+
async execute(options) {
|
|
12
|
+
const { skill, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {} } = options;
|
|
13
|
+
const currentCountryCode = currentSession?.location?.country;
|
|
14
|
+
const currentCurrencyCode = currentSession?.currencyCode;
|
|
15
|
+
const now = /* @__PURE__ */ new Date();
|
|
16
|
+
const timezone = currentSession?.location?.timezone;
|
|
17
|
+
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
18
|
+
const payload = {
|
|
19
|
+
SYSTEM_INSTRUCTIONS: {
|
|
20
|
+
...skill.systemInstructions
|
|
21
|
+
},
|
|
22
|
+
CONTEXT: {
|
|
23
|
+
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
+
now_local: nowLocal,
|
|
25
|
+
timezone: currentSession?.location?.timezone,
|
|
26
|
+
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
27
|
+
...currentUser ? {
|
|
28
|
+
user_details: {
|
|
29
|
+
first_name: currentUser?.firstName,
|
|
30
|
+
last_name: currentUser?.lastName,
|
|
31
|
+
// Configuración/Preferencias del usuario
|
|
32
|
+
preferred_language: currentUser?.language,
|
|
33
|
+
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
34
|
+
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
35
|
+
}
|
|
36
|
+
} : {},
|
|
37
|
+
...currentSession ? {
|
|
38
|
+
session_details: {
|
|
39
|
+
current_location: {
|
|
40
|
+
country_code: currentCountryCode,
|
|
41
|
+
currency_code: currentCurrencyCode,
|
|
42
|
+
timezone_offset: currentSession?.timezoneOffset
|
|
43
|
+
},
|
|
44
|
+
client_info: {
|
|
45
|
+
platform: currentSession?.device?.os,
|
|
46
|
+
brand: currentSession?.device?.brand,
|
|
47
|
+
model: currentSession?.device?.model
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} : {},
|
|
51
|
+
...contextInjection
|
|
52
|
+
},
|
|
53
|
+
INPUT: {
|
|
54
|
+
...userMessage ? { user_message: userMessage } : {},
|
|
55
|
+
...input
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const response = await this.llmClient.complete({
|
|
59
|
+
sessionId,
|
|
60
|
+
answerId,
|
|
61
|
+
taskName: skill.name,
|
|
62
|
+
currentUser,
|
|
63
|
+
messages: [
|
|
64
|
+
{
|
|
65
|
+
role: "user",
|
|
66
|
+
timestamp: Date.now(),
|
|
67
|
+
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
temperature: skill.temperature ?? 0.7
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
...this.parseJsonResponse(response),
|
|
74
|
+
responseId: response.responseId ?? "",
|
|
75
|
+
costInUsd: response?.usage?.cost?.total
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
parseJsonResponse(response) {
|
|
79
|
+
const rawContent = response?.content ?? [];
|
|
80
|
+
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
81
|
+
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
82
|
+
const content = extractJSON(text);
|
|
83
|
+
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
84
|
+
return content;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
SkillRunner = __decorateClass([
|
|
88
|
+
autoInjectable()
|
|
89
|
+
], SkillRunner);
|
|
90
|
+
export {
|
|
91
|
+
SkillRunner
|
|
92
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var skill_exports = {};
|
|
20
|
+
__export(skill_exports, {
|
|
21
|
+
Skill: () => Skill
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(skill_exports);
|
|
24
|
+
var import_tsyringe = require("tsyringe");
|
|
25
|
+
var import_helpers = require("@common/helpers");
|
|
26
|
+
var import_clients = require("@common/clients");
|
|
27
|
+
class Skill {
|
|
28
|
+
name;
|
|
29
|
+
version;
|
|
30
|
+
description;
|
|
31
|
+
temperature;
|
|
32
|
+
systemInstructions;
|
|
33
|
+
constructor(props) {
|
|
34
|
+
this.name = props.name;
|
|
35
|
+
this.version = props.version;
|
|
36
|
+
this.description = props.description;
|
|
37
|
+
this.temperature = props.temperature;
|
|
38
|
+
this.systemInstructions = props.systemInstructions;
|
|
39
|
+
}
|
|
40
|
+
async run(options) {
|
|
41
|
+
const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
42
|
+
try {
|
|
43
|
+
const llmClient = import_tsyringe.container.resolve(import_clients.LLMClient);
|
|
44
|
+
const currentCountryCode = currentSession?.location?.country;
|
|
45
|
+
const currentCurrencyCode = currentSession?.currencyCode;
|
|
46
|
+
const now = /* @__PURE__ */ new Date();
|
|
47
|
+
const timezone = currentSession?.location?.timezone;
|
|
48
|
+
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
49
|
+
const payload = {
|
|
50
|
+
SYSTEM_INSTRUCTIONS: {
|
|
51
|
+
...this.systemInstructions
|
|
52
|
+
},
|
|
53
|
+
CONTEXT: {
|
|
54
|
+
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
55
|
+
now_local: nowLocal,
|
|
56
|
+
timezone: currentSession?.location?.timezone,
|
|
57
|
+
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
58
|
+
...chat?.state?.language ? { detected_language: chat.state.language } : {},
|
|
59
|
+
...currentUser ? {
|
|
60
|
+
user_details: {
|
|
61
|
+
first_name: currentUser?.firstName,
|
|
62
|
+
last_name: currentUser?.lastName,
|
|
63
|
+
// Configuración/Preferencias del usuario
|
|
64
|
+
preferred_language: currentUser?.language,
|
|
65
|
+
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
66
|
+
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
67
|
+
}
|
|
68
|
+
} : {},
|
|
69
|
+
...currentSession ? {
|
|
70
|
+
session_details: {
|
|
71
|
+
current_location: {
|
|
72
|
+
country_code: currentCountryCode,
|
|
73
|
+
currency_code: currentCurrencyCode,
|
|
74
|
+
timezone_offset: currentSession?.timezoneOffset
|
|
75
|
+
},
|
|
76
|
+
client_info: {
|
|
77
|
+
platform: currentSession?.device?.os,
|
|
78
|
+
brand: currentSession?.device?.brand,
|
|
79
|
+
model: currentSession?.device?.model
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} : {},
|
|
83
|
+
...contextInjection
|
|
84
|
+
},
|
|
85
|
+
INPUT: {
|
|
86
|
+
...userMessage ? { user_message: userMessage } : {},
|
|
87
|
+
...input
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const response = await llmClient.complete({
|
|
91
|
+
sessionId,
|
|
92
|
+
answerId,
|
|
93
|
+
taskName: this.name,
|
|
94
|
+
currentUser,
|
|
95
|
+
messages: [
|
|
96
|
+
{
|
|
97
|
+
role: "user",
|
|
98
|
+
timestamp: Date.now(),
|
|
99
|
+
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
temperature: this.temperature ?? 0.7
|
|
103
|
+
});
|
|
104
|
+
const result = {
|
|
105
|
+
...this.parseJsonResponse(response),
|
|
106
|
+
responseId: response.responseId ?? "",
|
|
107
|
+
costInUsd: response?.usage?.cost?.total
|
|
108
|
+
};
|
|
109
|
+
chat?.addTrace({ node: this.name, reasoning: result?.reasoning });
|
|
110
|
+
return result;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
chat?.addTrace({ node: this.name, reasoning: `Failed: ${error?.message ?? error}` });
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
parseJsonResponse(response) {
|
|
117
|
+
const rawContent = response?.content ?? [];
|
|
118
|
+
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
119
|
+
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
120
|
+
const content = (0, import_helpers.extractJSON)(text);
|
|
121
|
+
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
122
|
+
return content;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
Skill
|
|
128
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import "../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { container } from "tsyringe";
|
|
3
|
+
import { extractJSON } from "@common/helpers";
|
|
4
|
+
import { LLMClient } from "@common/clients";
|
|
5
|
+
class Skill {
|
|
6
|
+
name;
|
|
7
|
+
version;
|
|
8
|
+
description;
|
|
9
|
+
temperature;
|
|
10
|
+
systemInstructions;
|
|
11
|
+
constructor(props) {
|
|
12
|
+
this.name = props.name;
|
|
13
|
+
this.version = props.version;
|
|
14
|
+
this.description = props.description;
|
|
15
|
+
this.temperature = props.temperature;
|
|
16
|
+
this.systemInstructions = props.systemInstructions;
|
|
17
|
+
}
|
|
18
|
+
async run(options) {
|
|
19
|
+
const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
20
|
+
try {
|
|
21
|
+
const llmClient = container.resolve(LLMClient);
|
|
22
|
+
const currentCountryCode = currentSession?.location?.country;
|
|
23
|
+
const currentCurrencyCode = currentSession?.currencyCode;
|
|
24
|
+
const now = /* @__PURE__ */ new Date();
|
|
25
|
+
const timezone = currentSession?.location?.timezone;
|
|
26
|
+
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
27
|
+
const payload = {
|
|
28
|
+
SYSTEM_INSTRUCTIONS: {
|
|
29
|
+
...this.systemInstructions
|
|
30
|
+
},
|
|
31
|
+
CONTEXT: {
|
|
32
|
+
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
33
|
+
now_local: nowLocal,
|
|
34
|
+
timezone: currentSession?.location?.timezone,
|
|
35
|
+
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
36
|
+
...chat?.state?.language ? { detected_language: chat.state.language } : {},
|
|
37
|
+
...currentUser ? {
|
|
38
|
+
user_details: {
|
|
39
|
+
first_name: currentUser?.firstName,
|
|
40
|
+
last_name: currentUser?.lastName,
|
|
41
|
+
// Configuración/Preferencias del usuario
|
|
42
|
+
preferred_language: currentUser?.language,
|
|
43
|
+
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
44
|
+
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
45
|
+
}
|
|
46
|
+
} : {},
|
|
47
|
+
...currentSession ? {
|
|
48
|
+
session_details: {
|
|
49
|
+
current_location: {
|
|
50
|
+
country_code: currentCountryCode,
|
|
51
|
+
currency_code: currentCurrencyCode,
|
|
52
|
+
timezone_offset: currentSession?.timezoneOffset
|
|
53
|
+
},
|
|
54
|
+
client_info: {
|
|
55
|
+
platform: currentSession?.device?.os,
|
|
56
|
+
brand: currentSession?.device?.brand,
|
|
57
|
+
model: currentSession?.device?.model
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} : {},
|
|
61
|
+
...contextInjection
|
|
62
|
+
},
|
|
63
|
+
INPUT: {
|
|
64
|
+
...userMessage ? { user_message: userMessage } : {},
|
|
65
|
+
...input
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const response = await llmClient.complete({
|
|
69
|
+
sessionId,
|
|
70
|
+
answerId,
|
|
71
|
+
taskName: this.name,
|
|
72
|
+
currentUser,
|
|
73
|
+
messages: [
|
|
74
|
+
{
|
|
75
|
+
role: "user",
|
|
76
|
+
timestamp: Date.now(),
|
|
77
|
+
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
temperature: this.temperature ?? 0.7
|
|
81
|
+
});
|
|
82
|
+
const result = {
|
|
83
|
+
...this.parseJsonResponse(response),
|
|
84
|
+
responseId: response.responseId ?? "",
|
|
85
|
+
costInUsd: response?.usage?.cost?.total
|
|
86
|
+
};
|
|
87
|
+
chat?.addTrace({ node: this.name, reasoning: result?.reasoning });
|
|
88
|
+
return result;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
chat?.addTrace({ node: this.name, reasoning: `Failed: ${error?.message ?? error}` });
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
parseJsonResponse(response) {
|
|
95
|
+
const rawContent = response?.content ?? [];
|
|
96
|
+
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
97
|
+
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
98
|
+
const content = extractJSON(text);
|
|
99
|
+
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
100
|
+
return content;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
Skill
|
|
105
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var call_ai_skill_exports = {};
|
|
20
|
+
__export(call_ai_skill_exports, {
|
|
21
|
+
callAiSkill: () => callAiSkill
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(call_ai_skill_exports);
|
|
24
|
+
var import_skill = require("../../../skills/skill");
|
|
25
|
+
var import_shared_rules = require("../../../skills/shared/shared-rules");
|
|
26
|
+
const callAiSkill = new import_skill.Skill({
|
|
27
|
+
name: "call-ai",
|
|
28
|
+
version: "1.0.0",
|
|
29
|
+
description: "Executes custom AI analysis, summarization, extraction, or transformation tasks using dynamic agent-provided instructions and input context.",
|
|
30
|
+
temperature: 0.3,
|
|
31
|
+
systemInstructions: {
|
|
32
|
+
instruction_set: {
|
|
33
|
+
goal: "Execute the given task according to the specified instruction prompt, analyzing or processing the provided input to produce a clear, high-quality result.",
|
|
34
|
+
role: "Flexible AI reasoning, analysis, summarization, and task execution engine",
|
|
35
|
+
logic_rules: [
|
|
36
|
+
"INSTRUCTION_EXECUTION: Strictly follow the custom guidelines, criteria, and role instructions defined in 'systemPrompt'.",
|
|
37
|
+
"TASK_PROCESSING: Process the provided 'input_data' or context thoroughly, applying reasoning, extraction, or summarization as requested.",
|
|
38
|
+
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy in 'reasoning' strictly in English.",
|
|
39
|
+
import_shared_rules.FORMATTING,
|
|
40
|
+
import_shared_rules.LATEX_FORMATTING,
|
|
41
|
+
import_shared_rules.CITATION_FORMATTING,
|
|
42
|
+
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
43
|
+
],
|
|
44
|
+
response_schema: {
|
|
45
|
+
result: "string",
|
|
46
|
+
reasoning: "string"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
callAiSkill
|
|
54
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../../../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { Skill } from "../../../skills/skill";
|
|
3
|
+
import { FORMATTING, LATEX_FORMATTING, CITATION_FORMATTING } from "../../../skills/shared/shared-rules";
|
|
4
|
+
const callAiSkill = new Skill({
|
|
5
|
+
name: "call-ai",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
description: "Executes custom AI analysis, summarization, extraction, or transformation tasks using dynamic agent-provided instructions and input context.",
|
|
8
|
+
temperature: 0.3,
|
|
9
|
+
systemInstructions: {
|
|
10
|
+
instruction_set: {
|
|
11
|
+
goal: "Execute the given task according to the specified instruction prompt, analyzing or processing the provided input to produce a clear, high-quality result.",
|
|
12
|
+
role: "Flexible AI reasoning, analysis, summarization, and task execution engine",
|
|
13
|
+
logic_rules: [
|
|
14
|
+
"INSTRUCTION_EXECUTION: Strictly follow the custom guidelines, criteria, and role instructions defined in 'systemPrompt'.",
|
|
15
|
+
"TASK_PROCESSING: Process the provided 'input_data' or context thoroughly, applying reasoning, extraction, or summarization as requested.",
|
|
16
|
+
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy in 'reasoning' strictly in English.",
|
|
17
|
+
FORMATTING,
|
|
18
|
+
LATEX_FORMATTING,
|
|
19
|
+
CITATION_FORMATTING,
|
|
20
|
+
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
21
|
+
],
|
|
22
|
+
response_schema: {
|
|
23
|
+
result: "string",
|
|
24
|
+
reasoning: "string"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
callAiSkill
|
|
31
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var call_ai_tool_exports = {};
|
|
20
|
+
__export(call_ai_tool_exports, {
|
|
21
|
+
callAiTool: () => callAiTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(call_ai_tool_exports);
|
|
24
|
+
var import_call_ai = require("./call-ai.skill");
|
|
25
|
+
var import_tool = require("../../tool");
|
|
26
|
+
const callAiTool = new import_tool.Tool({
|
|
27
|
+
name: "call_ai",
|
|
28
|
+
description: import_call_ai.callAiSkill.description ?? "",
|
|
29
|
+
destructive: false,
|
|
30
|
+
parameters: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
instructions: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "System instructions or guidelines to perform the analysis, extraction, or transformation task."
|
|
36
|
+
},
|
|
37
|
+
input_data: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "The raw text, data, or context to be processed."
|
|
40
|
+
},
|
|
41
|
+
temperature: {
|
|
42
|
+
type: "number",
|
|
43
|
+
description: "Optional sampling temperature (0.0 to 1.0) to control creativity or precision."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
required: ["instructions", "input_data"]
|
|
47
|
+
},
|
|
48
|
+
handler: async (params) => {
|
|
49
|
+
const { payload, currentUser, sessionId, answerId } = params;
|
|
50
|
+
const { instructions, input_data } = payload;
|
|
51
|
+
if (!instructions) throw new Error("[call_ai_tool] Param instructions is required");
|
|
52
|
+
if (!input_data) throw new Error("[call_ai_tool] Param input_data is required");
|
|
53
|
+
const result = await import_call_ai.callAiSkill.run({
|
|
54
|
+
sessionId,
|
|
55
|
+
answerId,
|
|
56
|
+
input: input_data,
|
|
57
|
+
contextInjection: {
|
|
58
|
+
systemPrompt: instructions
|
|
59
|
+
},
|
|
60
|
+
currentUser
|
|
61
|
+
});
|
|
62
|
+
return { data: result };
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
callAiTool
|
|
68
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "../../../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { callAiSkill } from "./call-ai.skill";
|
|
3
|
+
import { Tool } from "../../tool";
|
|
4
|
+
const callAiTool = new Tool({
|
|
5
|
+
name: "call_ai",
|
|
6
|
+
description: callAiSkill.description ?? "",
|
|
7
|
+
destructive: false,
|
|
8
|
+
parameters: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
instructions: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "System instructions or guidelines to perform the analysis, extraction, or transformation task."
|
|
14
|
+
},
|
|
15
|
+
input_data: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "The raw text, data, or context to be processed."
|
|
18
|
+
},
|
|
19
|
+
temperature: {
|
|
20
|
+
type: "number",
|
|
21
|
+
description: "Optional sampling temperature (0.0 to 1.0) to control creativity or precision."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
required: ["instructions", "input_data"]
|
|
25
|
+
},
|
|
26
|
+
handler: async (params) => {
|
|
27
|
+
const { payload, currentUser, sessionId, answerId } = params;
|
|
28
|
+
const { instructions, input_data } = payload;
|
|
29
|
+
if (!instructions) throw new Error("[call_ai_tool] Param instructions is required");
|
|
30
|
+
if (!input_data) throw new Error("[call_ai_tool] Param input_data is required");
|
|
31
|
+
const result = await callAiSkill.run({
|
|
32
|
+
sessionId,
|
|
33
|
+
answerId,
|
|
34
|
+
input: input_data,
|
|
35
|
+
contextInjection: {
|
|
36
|
+
systemPrompt: instructions
|
|
37
|
+
},
|
|
38
|
+
currentUser
|
|
39
|
+
});
|
|
40
|
+
return { data: result };
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
callAiTool
|
|
45
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var call_ai_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(call_ai_exports);
|
|
18
|
+
__reExport(call_ai_exports, require("./call-ai.tool"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./call-ai.tool")
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./call-ai.tool";
|