openloops 0.1.9 → 0.1.11
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.d.ts +3 -0
- package/dist/common/clients/index.js +26 -0
- package/dist/common/clients/index.mjs +3 -0
- package/dist/common/clients/llm-client.d.ts +30 -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.d.ts +10 -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.d.ts +66 -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.d.ts +12 -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.d.ts +55 -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.d.ts +15 -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.d.ts +1 -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.d.ts +1 -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.d.ts +1 -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.d.ts +3 -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.d.ts +1 -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.d.ts +2 -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.d.ts +1 -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.d.ts +3 -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.d.ts +1 -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.d.ts +2 -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.d.ts +1 -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.d.ts +2 -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.d.ts +11 -0
- package/dist/common/error/http-error.js +37 -0
- package/dist/common/error/http-error.mjs +14 -0
- package/dist/common/error/index.d.ts +2 -0
- package/dist/common/error/index.js +24 -0
- package/dist/common/error/index.mjs +2 -0
- package/dist/common/error/reportError.d.ts +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.d.ts +1 -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.d.ts +2 -0
- package/dist/common/helpers/index.js +24 -0
- package/dist/common/helpers/index.mjs +2 -0
- package/dist/common/helpers/sanitize-string.d.ts +1 -0
- package/dist/common/helpers/sanitize-string.js +45 -0
- package/dist/common/helpers/sanitize-string.mjs +12 -0
- package/dist/common/logger/index.d.ts +1 -0
- package/dist/common/logger/index.js +22 -0
- package/dist/common/logger/index.mjs +1 -0
- package/dist/common/logger/pino.d.ts +12 -0
- package/dist/common/logger/pino.js +70 -0
- package/dist/common/logger/pino.mjs +36 -0
- package/dist/common/repositories/index.d.ts +2 -0
- package/dist/common/repositories/index.js +24 -0
- package/dist/common/repositories/index.mjs +2 -0
- package/dist/common/repositories/mongo-db.client.d.ts +11 -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.d.ts +87 -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.d.ts +15 -0
- package/dist/common/utils/secret-manager.js +105 -0
- package/dist/common/utils/secret-manager.mjs +71 -0
- package/dist/index.d.ts +1 -10
- package/dist/index.js +22 -7
- package/dist/index.mjs +1 -1
- package/dist/services/agent/core/agent-loop.d.ts +38 -0
- 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.d.ts +42 -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.d.ts +70 -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.d.ts +3 -122
- package/dist/services/agent/core/index.js +26 -7
- package/dist/services/agent/core/index.mjs +3 -1
- package/dist/services/agent/loops/index.d.ts +2 -116
- package/dist/services/agent/loops/index.js +24 -10
- package/dist/services/agent/loops/index.mjs +2 -4
- package/dist/services/agent/loops/plan-execute/index.d.ts +1 -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.d.ts +27 -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.d.ts +1 -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.d.ts +35 -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.d.ts +9 -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.d.ts +9 -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.d.ts +7 -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.d.ts +6 -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.d.ts +10 -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.d.ts +15 -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.d.ts +58 -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.d.ts +59 -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.d.ts +39 -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.d.ts +16 -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.d.ts +17 -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.d.ts +50 -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.d.ts +1 -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.d.ts +14 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +14 -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.d.ts +1 -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.d.ts +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.d.ts +14 -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.d.ts +1 -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.d.ts +16 -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.d.ts +1 -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.d.ts +16 -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.d.ts +1 -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.d.ts +15 -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.d.ts +10 -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.d.ts +1 -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.d.ts +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.d.ts +23 -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.d.ts +14 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +21 -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.d.ts +1 -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.d.ts +14 -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.d.ts +1 -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.d.ts +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.d.ts +16 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +10 -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.d.ts +1 -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.d.ts +23 -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.d.ts +14 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +14 -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.d.ts +1 -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.d.ts +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.d.ts +16 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +10 -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.d.ts +2 -14
- package/dist/services/agent/skills/index.js +24 -7
- package/dist/services/agent/skills/index.mjs +2 -1
- package/dist/services/agent/skills/shared/index.d.ts +1 -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.d.ts +4 -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.d.ts +31 -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.d.ts +33 -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.d.ts +6 -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.d.ts +2 -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.d.ts +1 -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.d.ts +2 -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.d.ts +1 -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.d.ts +2 -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.d.ts +2 -12
- package/dist/services/agent/tools/index.js +24 -7
- package/dist/services/agent/tools/index.mjs +2 -1
- package/dist/{tool-DMR_ZdjP.d.ts → services/agent/tools/tool.d.ts} +7 -9
- 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.d.ts +12 -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.d.ts +14 -0
- package/dist/services/app/core/app.js +60 -0
- package/dist/services/app/core/app.mjs +47 -0
- package/dist/{current-session-DC-SF7rl.d.mts → services/app/core/current-session.d.ts} +4 -5
- 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.d.ts +16 -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.d.ts +3 -60
- package/dist/services/app/core/index.js +26 -7
- package/dist/services/app/core/index.mjs +3 -1
- package/dist/services/app/modules/authentication/lambdas/login/index.d.ts +1 -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.d.ts +21 -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.d.ts +1 -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.d.ts +12 -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.d.ts +11 -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.d.ts +13 -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.d.ts +6 -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.d.ts +11 -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.d.ts +9 -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.d.ts +11 -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.d.ts +8 -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.d.ts +21 -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.d.ts +25 -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.d.ts +16 -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.d.ts +11 -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.d.ts +11 -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.d.ts +41 -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.d.ts +14 -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.d.ts +1 -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.d.ts +16 -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.d.ts +1 -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.d.ts +14 -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.d.ts +1 -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.d.ts +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.d.ts +16 -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.d.ts +1 -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.d.ts +15 -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.d.ts +1 -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.d.ts +12 -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
- package/dist/agent-loop-C41Y1CGp.d.mts +0 -60
- package/dist/agent-loop-ZH4GRi4A.d.ts +0 -60
- package/dist/base.use-case-8K6_Ods0.d.mts +0 -14
- package/dist/base.use-case-ChEb3nh6.d.ts +0 -14
- package/dist/chunk-6PCVBY5G.mjs +0 -1
- package/dist/chunk-7WJ3XXSP.mjs +0 -7
- package/dist/chunk-CCRMOWMO.mjs +0 -1
- package/dist/chunk-ISOEJA2L.mjs +0 -1
- package/dist/chunk-XXB52O7H.mjs +0 -1
- package/dist/current-session-DC-SF7rl.d.ts +0 -130
- package/dist/current-user-4BppBUBP.d.mts +0 -264
- package/dist/current-user-4BppBUBP.d.ts +0 -264
- package/dist/index.d.mts +0 -10
- package/dist/services/agent/core/index.d.mts +0 -122
- package/dist/services/agent/loops/index.d.mts +0 -116
- package/dist/services/agent/skills/index.d.mts +0 -14
- package/dist/services/agent/tools/index.d.mts +0 -12
- package/dist/services/app/core/index.d.mts +0 -60
- package/dist/skill-CtYQbG6-.d.ts +0 -308
- package/dist/skill-DXNkK5FG.d.mts +0 -308
- package/dist/tool-BaG2a8Np.d.mts +0 -42
|
@@ -0,0 +1,242 @@
|
|
|
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 plan_execute_loop_exports = {};
|
|
20
|
+
__export(plan_execute_loop_exports, {
|
|
21
|
+
PlanExecuteLoop: () => PlanExecuteLoop
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(plan_execute_loop_exports);
|
|
24
|
+
var import_core = require("../../core/index.js");
|
|
25
|
+
var import_skills = require("../shared/skills");
|
|
26
|
+
const MAX_STEP_RETRIES = 2;
|
|
27
|
+
class PlanExecuteLoop extends import_core.AgentLoop {
|
|
28
|
+
get initialNode() {
|
|
29
|
+
return this.nodes.fast_responder;
|
|
30
|
+
}
|
|
31
|
+
get nodes() {
|
|
32
|
+
return {
|
|
33
|
+
fast_responder: this.fastResponder,
|
|
34
|
+
strategy_engine: this.strategyEngine,
|
|
35
|
+
action_planner: this.actionPlanner,
|
|
36
|
+
execution_loop: this.executionLoop,
|
|
37
|
+
state_observer: this.executionObserver,
|
|
38
|
+
final_responder: this.finalResponder,
|
|
39
|
+
confirmation_gate: this.confirmationGate
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
get name() {
|
|
43
|
+
return "plan_execute";
|
|
44
|
+
}
|
|
45
|
+
get version() {
|
|
46
|
+
return "1.0.0";
|
|
47
|
+
}
|
|
48
|
+
get author() {
|
|
49
|
+
return {
|
|
50
|
+
name: "Jose Barcos",
|
|
51
|
+
email: "jose@openloops.xyz",
|
|
52
|
+
website: "https://openloops.xyz/jose"
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async fastResponder(ctx) {
|
|
56
|
+
ctx.chat.state?.setCurrentActivity("Analyzing requirement...");
|
|
57
|
+
const chat_history = ctx.chat.lastHistoryMessages();
|
|
58
|
+
const result = await import_skills.fastResponder.run({
|
|
59
|
+
...ctx.skillParams,
|
|
60
|
+
contextInjection: {
|
|
61
|
+
...chat_history?.length ? { chat_history } : {}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
ctx.chat.state?.setLanguage(result.detected_language);
|
|
65
|
+
if (!result.can_answer) {
|
|
66
|
+
ctx.setNextNode(this.nodes.strategy_engine);
|
|
67
|
+
} else {
|
|
68
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.IDLE);
|
|
69
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
70
|
+
ctx.reply(result.answer ?? "");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async strategyEngine(ctx) {
|
|
74
|
+
ctx.chat.state?.setCurrentActivity("Designing strategy...");
|
|
75
|
+
const lastCompletedTask = ctx.task ? void 0 : ctx.chat.lastCompletedTask();
|
|
76
|
+
const chatHistory = ctx.chat.lastHistoryMessages();
|
|
77
|
+
const result = await import_skills.strategyEngine.run({
|
|
78
|
+
...ctx.skillParams,
|
|
79
|
+
contextInjection: {
|
|
80
|
+
user_goal: ctx.currentMessage,
|
|
81
|
+
...chatHistory?.length ? { chat_history: chatHistory } : {},
|
|
82
|
+
...lastCompletedTask ? { last_completed_task: { goal: lastCompletedTask.goal, summary: lastCompletedTask.summary } } : {}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
ctx.chat.state?.setLanguage(result.detected_language);
|
|
86
|
+
const task = result.is_continuation && lastCompletedTask ? ctx.chat.reopenTask(lastCompletedTask.id) : ctx.chat.createTask(result.goal ?? ctx.currentMessage);
|
|
87
|
+
ctx.chat.context.addContext({
|
|
88
|
+
taskId: task.id,
|
|
89
|
+
meta: { name: "strategy", type: "artifact", shortDescription: "High-level strategy for the active task" },
|
|
90
|
+
content: result
|
|
91
|
+
});
|
|
92
|
+
ctx.setNextNode(this.nodes.action_planner);
|
|
93
|
+
}
|
|
94
|
+
async actionPlanner(ctx) {
|
|
95
|
+
ctx.chat.state?.setCurrentActivity("Creating action plan...");
|
|
96
|
+
const task = ctx.task;
|
|
97
|
+
const strategy = ctx.chat.context.lastContext({ taskId: task.id, name: "strategy" })?.content;
|
|
98
|
+
const tools = ctx.searchTools(strategy?.tool_keywords ?? []);
|
|
99
|
+
const result = await import_skills.actionPlanner.run({
|
|
100
|
+
...ctx.skillParams,
|
|
101
|
+
contextInjection: {
|
|
102
|
+
active_task: {
|
|
103
|
+
user_goal: task.goal,
|
|
104
|
+
strategy: strategy?.hypothesis,
|
|
105
|
+
required_capabilities: strategy?.required_capabilities
|
|
106
|
+
},
|
|
107
|
+
tools
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const enqueueSteps = (steps) => steps.map((step) => task.addAction({
|
|
111
|
+
name: step.tool_name,
|
|
112
|
+
stepId: String(step.step_id),
|
|
113
|
+
args: step.args ?? step.arguments,
|
|
114
|
+
dependsOn: step.depends_on?.map(String),
|
|
115
|
+
author: "action_planner"
|
|
116
|
+
}));
|
|
117
|
+
switch (result.plan_status) {
|
|
118
|
+
case "MISSING_TOOLS":
|
|
119
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.AWAITING_USER_INPUT);
|
|
120
|
+
ctx.chat.failTask(task.id);
|
|
121
|
+
ctx.setNextNode(void 0);
|
|
122
|
+
ctx.reply(result.user_response);
|
|
123
|
+
break;
|
|
124
|
+
case "NEEDS_CLARIFICATION":
|
|
125
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.AWAITING_USER_INPUT);
|
|
126
|
+
ctx.setNextNode(void 0);
|
|
127
|
+
ctx.reply(result.clarification_prompt);
|
|
128
|
+
break;
|
|
129
|
+
case "NEEDS_CONFIRMATION": {
|
|
130
|
+
enqueueSteps(result.steps);
|
|
131
|
+
const actionsList = (result.confirmation_details?.actions ?? []).map((action) => `- ${action.description}`).join("\n");
|
|
132
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.AWAITING_USER_CONFIRMATION);
|
|
133
|
+
ctx.setNextNode(this.nodes.confirmation_gate);
|
|
134
|
+
ctx.reply([
|
|
135
|
+
result.clarification_prompt,
|
|
136
|
+
result.confirmation_details?.impact_summary,
|
|
137
|
+
actionsList,
|
|
138
|
+
result.confirmation_details?.confirm_label
|
|
139
|
+
].filter(Boolean).join("\n\n"));
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case "SUCCESS":
|
|
143
|
+
enqueueSteps(result.steps);
|
|
144
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async executionLoop(ctx) {
|
|
149
|
+
const task = ctx.task;
|
|
150
|
+
const [next] = task.readyActions;
|
|
151
|
+
if (!next) {
|
|
152
|
+
ctx.setNextNode(this.nodes.final_responder);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
ctx.chat.state?.setCurrentActivity(`Running ${next.name}...`);
|
|
156
|
+
const tool = ctx.tools.find((t) => t.name === next.name);
|
|
157
|
+
const executed = await task.runReadyAction(next.id, tool, ctx.chat.context, ctx.baseParams);
|
|
158
|
+
if (executed.status === "failed" && (executed.retries ?? 0) < MAX_STEP_RETRIES) {
|
|
159
|
+
executed.incrementRetries();
|
|
160
|
+
executed.resetForRetry();
|
|
161
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
ctx.setNextNode(this.nodes.state_observer);
|
|
165
|
+
}
|
|
166
|
+
async confirmationGate(ctx) {
|
|
167
|
+
const task = ctx.task;
|
|
168
|
+
const result = await import_skills.confirmationGate.run({
|
|
169
|
+
...ctx.skillParams,
|
|
170
|
+
contextInjection: {
|
|
171
|
+
...ctx.chat.lastAnswer ? { pending_confirmation: ctx.chat.lastAnswer } : {}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
switch (result.decision) {
|
|
175
|
+
case "CONFIRMED":
|
|
176
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.PROCESSING);
|
|
177
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
178
|
+
break;
|
|
179
|
+
case "DECLINED":
|
|
180
|
+
ctx.chat.cancelTask(task.id);
|
|
181
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.IDLE);
|
|
182
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
183
|
+
ctx.reply(result.acknowledgement);
|
|
184
|
+
break;
|
|
185
|
+
case "UNCLEAR":
|
|
186
|
+
default:
|
|
187
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.AWAITING_USER_CONFIRMATION);
|
|
188
|
+
ctx.setNextNode(this.nodes.confirmation_gate);
|
|
189
|
+
ctx.reply(result.clarification_prompt);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async executionObserver(ctx) {
|
|
194
|
+
const task = ctx.task;
|
|
195
|
+
const lastAction = task.lastExecutedAction;
|
|
196
|
+
const result = await import_skills.stateObserver.run({
|
|
197
|
+
...ctx.skillParams,
|
|
198
|
+
contextInjection: {
|
|
199
|
+
user_intent: task.goal,
|
|
200
|
+
executed_step: lastAction?.toJSON(),
|
|
201
|
+
remaining_steps: task.readyActions.map((a) => a.toJSON())
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
ctx.chat.state?.setCurrentActivity(result.reasoning);
|
|
205
|
+
switch (result.action) {
|
|
206
|
+
case "REPLAN":
|
|
207
|
+
ctx.setNextNode(this.nodes.action_planner);
|
|
208
|
+
break;
|
|
209
|
+
case "ASK_USER":
|
|
210
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.AWAITING_USER_INPUT);
|
|
211
|
+
ctx.setNextNode(void 0);
|
|
212
|
+
ctx.reply(result.user_prompt ?? "");
|
|
213
|
+
break;
|
|
214
|
+
case "CONTINUE":
|
|
215
|
+
default: {
|
|
216
|
+
const stillPending = task.actions.some((a) => a.status === "pending");
|
|
217
|
+
ctx.setNextNode(stillPending ? this.nodes.execution_loop : this.nodes.final_responder);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async finalResponder(ctx) {
|
|
223
|
+
ctx.chat.state?.setCurrentActivity("Generating final response...");
|
|
224
|
+
const task = ctx.task;
|
|
225
|
+
const executionResults = task.actions.map((a) => ({ tool_name: a.name, args: a.args, output: a.output, status: a.status }));
|
|
226
|
+
const result = await import_skills.finalResponder.run({
|
|
227
|
+
...ctx.skillParams,
|
|
228
|
+
contextInjection: {
|
|
229
|
+
user_goal: task.goal,
|
|
230
|
+
execution_results: executionResults
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
ctx.reply(result.final_response ?? "");
|
|
234
|
+
ctx.chat.completeTask(task.id, result.reasoning);
|
|
235
|
+
ctx.chat.state?.setStatus(import_core.AgentStatus.IDLE);
|
|
236
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
240
|
+
0 && (module.exports = {
|
|
241
|
+
PlanExecuteLoop
|
|
242
|
+
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import "../../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { AgentLoop, AgentStatus } from "../../core/index.js";
|
|
3
|
+
import {
|
|
4
|
+
fastResponder,
|
|
5
|
+
strategyEngine,
|
|
6
|
+
actionPlanner,
|
|
7
|
+
stateObserver,
|
|
8
|
+
finalResponder,
|
|
9
|
+
confirmationGate
|
|
10
|
+
} from "../shared/skills";
|
|
11
|
+
const MAX_STEP_RETRIES = 2;
|
|
12
|
+
class PlanExecuteLoop extends AgentLoop {
|
|
13
|
+
get initialNode() {
|
|
14
|
+
return this.nodes.fast_responder;
|
|
15
|
+
}
|
|
16
|
+
get nodes() {
|
|
17
|
+
return {
|
|
18
|
+
fast_responder: this.fastResponder,
|
|
19
|
+
strategy_engine: this.strategyEngine,
|
|
20
|
+
action_planner: this.actionPlanner,
|
|
21
|
+
execution_loop: this.executionLoop,
|
|
22
|
+
state_observer: this.executionObserver,
|
|
23
|
+
final_responder: this.finalResponder,
|
|
24
|
+
confirmation_gate: this.confirmationGate
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
get name() {
|
|
28
|
+
return "plan_execute";
|
|
29
|
+
}
|
|
30
|
+
get version() {
|
|
31
|
+
return "1.0.0";
|
|
32
|
+
}
|
|
33
|
+
get author() {
|
|
34
|
+
return {
|
|
35
|
+
name: "Jose Barcos",
|
|
36
|
+
email: "jose@openloops.xyz",
|
|
37
|
+
website: "https://openloops.xyz/jose"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async fastResponder(ctx) {
|
|
41
|
+
ctx.chat.state?.setCurrentActivity("Analyzing requirement...");
|
|
42
|
+
const chat_history = ctx.chat.lastHistoryMessages();
|
|
43
|
+
const result = await fastResponder.run({
|
|
44
|
+
...ctx.skillParams,
|
|
45
|
+
contextInjection: {
|
|
46
|
+
...chat_history?.length ? { chat_history } : {}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
ctx.chat.state?.setLanguage(result.detected_language);
|
|
50
|
+
if (!result.can_answer) {
|
|
51
|
+
ctx.setNextNode(this.nodes.strategy_engine);
|
|
52
|
+
} else {
|
|
53
|
+
ctx.chat.state?.setStatus(AgentStatus.IDLE);
|
|
54
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
55
|
+
ctx.reply(result.answer ?? "");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async strategyEngine(ctx) {
|
|
59
|
+
ctx.chat.state?.setCurrentActivity("Designing strategy...");
|
|
60
|
+
const lastCompletedTask = ctx.task ? void 0 : ctx.chat.lastCompletedTask();
|
|
61
|
+
const chatHistory = ctx.chat.lastHistoryMessages();
|
|
62
|
+
const result = await strategyEngine.run({
|
|
63
|
+
...ctx.skillParams,
|
|
64
|
+
contextInjection: {
|
|
65
|
+
user_goal: ctx.currentMessage,
|
|
66
|
+
...chatHistory?.length ? { chat_history: chatHistory } : {},
|
|
67
|
+
...lastCompletedTask ? { last_completed_task: { goal: lastCompletedTask.goal, summary: lastCompletedTask.summary } } : {}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
ctx.chat.state?.setLanguage(result.detected_language);
|
|
71
|
+
const task = result.is_continuation && lastCompletedTask ? ctx.chat.reopenTask(lastCompletedTask.id) : ctx.chat.createTask(result.goal ?? ctx.currentMessage);
|
|
72
|
+
ctx.chat.context.addContext({
|
|
73
|
+
taskId: task.id,
|
|
74
|
+
meta: { name: "strategy", type: "artifact", shortDescription: "High-level strategy for the active task" },
|
|
75
|
+
content: result
|
|
76
|
+
});
|
|
77
|
+
ctx.setNextNode(this.nodes.action_planner);
|
|
78
|
+
}
|
|
79
|
+
async actionPlanner(ctx) {
|
|
80
|
+
ctx.chat.state?.setCurrentActivity("Creating action plan...");
|
|
81
|
+
const task = ctx.task;
|
|
82
|
+
const strategy = ctx.chat.context.lastContext({ taskId: task.id, name: "strategy" })?.content;
|
|
83
|
+
const tools = ctx.searchTools(strategy?.tool_keywords ?? []);
|
|
84
|
+
const result = await actionPlanner.run({
|
|
85
|
+
...ctx.skillParams,
|
|
86
|
+
contextInjection: {
|
|
87
|
+
active_task: {
|
|
88
|
+
user_goal: task.goal,
|
|
89
|
+
strategy: strategy?.hypothesis,
|
|
90
|
+
required_capabilities: strategy?.required_capabilities
|
|
91
|
+
},
|
|
92
|
+
tools
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const enqueueSteps = (steps) => steps.map((step) => task.addAction({
|
|
96
|
+
name: step.tool_name,
|
|
97
|
+
stepId: String(step.step_id),
|
|
98
|
+
args: step.args ?? step.arguments,
|
|
99
|
+
dependsOn: step.depends_on?.map(String),
|
|
100
|
+
author: "action_planner"
|
|
101
|
+
}));
|
|
102
|
+
switch (result.plan_status) {
|
|
103
|
+
case "MISSING_TOOLS":
|
|
104
|
+
ctx.chat.state?.setStatus(AgentStatus.AWAITING_USER_INPUT);
|
|
105
|
+
ctx.chat.failTask(task.id);
|
|
106
|
+
ctx.setNextNode(void 0);
|
|
107
|
+
ctx.reply(result.user_response);
|
|
108
|
+
break;
|
|
109
|
+
case "NEEDS_CLARIFICATION":
|
|
110
|
+
ctx.chat.state?.setStatus(AgentStatus.AWAITING_USER_INPUT);
|
|
111
|
+
ctx.setNextNode(void 0);
|
|
112
|
+
ctx.reply(result.clarification_prompt);
|
|
113
|
+
break;
|
|
114
|
+
case "NEEDS_CONFIRMATION": {
|
|
115
|
+
enqueueSteps(result.steps);
|
|
116
|
+
const actionsList = (result.confirmation_details?.actions ?? []).map((action) => `- ${action.description}`).join("\n");
|
|
117
|
+
ctx.chat.state?.setStatus(AgentStatus.AWAITING_USER_CONFIRMATION);
|
|
118
|
+
ctx.setNextNode(this.nodes.confirmation_gate);
|
|
119
|
+
ctx.reply([
|
|
120
|
+
result.clarification_prompt,
|
|
121
|
+
result.confirmation_details?.impact_summary,
|
|
122
|
+
actionsList,
|
|
123
|
+
result.confirmation_details?.confirm_label
|
|
124
|
+
].filter(Boolean).join("\n\n"));
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "SUCCESS":
|
|
128
|
+
enqueueSteps(result.steps);
|
|
129
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async executionLoop(ctx) {
|
|
134
|
+
const task = ctx.task;
|
|
135
|
+
const [next] = task.readyActions;
|
|
136
|
+
if (!next) {
|
|
137
|
+
ctx.setNextNode(this.nodes.final_responder);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
ctx.chat.state?.setCurrentActivity(`Running ${next.name}...`);
|
|
141
|
+
const tool = ctx.tools.find((t) => t.name === next.name);
|
|
142
|
+
const executed = await task.runReadyAction(next.id, tool, ctx.chat.context, ctx.baseParams);
|
|
143
|
+
if (executed.status === "failed" && (executed.retries ?? 0) < MAX_STEP_RETRIES) {
|
|
144
|
+
executed.incrementRetries();
|
|
145
|
+
executed.resetForRetry();
|
|
146
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
ctx.setNextNode(this.nodes.state_observer);
|
|
150
|
+
}
|
|
151
|
+
async confirmationGate(ctx) {
|
|
152
|
+
const task = ctx.task;
|
|
153
|
+
const result = await confirmationGate.run({
|
|
154
|
+
...ctx.skillParams,
|
|
155
|
+
contextInjection: {
|
|
156
|
+
...ctx.chat.lastAnswer ? { pending_confirmation: ctx.chat.lastAnswer } : {}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
switch (result.decision) {
|
|
160
|
+
case "CONFIRMED":
|
|
161
|
+
ctx.chat.state?.setStatus(AgentStatus.PROCESSING);
|
|
162
|
+
ctx.setNextNode(this.nodes.execution_loop);
|
|
163
|
+
break;
|
|
164
|
+
case "DECLINED":
|
|
165
|
+
ctx.chat.cancelTask(task.id);
|
|
166
|
+
ctx.chat.state?.setStatus(AgentStatus.IDLE);
|
|
167
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
168
|
+
ctx.reply(result.acknowledgement);
|
|
169
|
+
break;
|
|
170
|
+
case "UNCLEAR":
|
|
171
|
+
default:
|
|
172
|
+
ctx.chat.state?.setStatus(AgentStatus.AWAITING_USER_CONFIRMATION);
|
|
173
|
+
ctx.setNextNode(this.nodes.confirmation_gate);
|
|
174
|
+
ctx.reply(result.clarification_prompt);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async executionObserver(ctx) {
|
|
179
|
+
const task = ctx.task;
|
|
180
|
+
const lastAction = task.lastExecutedAction;
|
|
181
|
+
const result = await stateObserver.run({
|
|
182
|
+
...ctx.skillParams,
|
|
183
|
+
contextInjection: {
|
|
184
|
+
user_intent: task.goal,
|
|
185
|
+
executed_step: lastAction?.toJSON(),
|
|
186
|
+
remaining_steps: task.readyActions.map((a) => a.toJSON())
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
ctx.chat.state?.setCurrentActivity(result.reasoning);
|
|
190
|
+
switch (result.action) {
|
|
191
|
+
case "REPLAN":
|
|
192
|
+
ctx.setNextNode(this.nodes.action_planner);
|
|
193
|
+
break;
|
|
194
|
+
case "ASK_USER":
|
|
195
|
+
ctx.chat.state?.setStatus(AgentStatus.AWAITING_USER_INPUT);
|
|
196
|
+
ctx.setNextNode(void 0);
|
|
197
|
+
ctx.reply(result.user_prompt ?? "");
|
|
198
|
+
break;
|
|
199
|
+
case "CONTINUE":
|
|
200
|
+
default: {
|
|
201
|
+
const stillPending = task.actions.some((a) => a.status === "pending");
|
|
202
|
+
ctx.setNextNode(stillPending ? this.nodes.execution_loop : this.nodes.final_responder);
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async finalResponder(ctx) {
|
|
208
|
+
ctx.chat.state?.setCurrentActivity("Generating final response...");
|
|
209
|
+
const task = ctx.task;
|
|
210
|
+
const executionResults = task.actions.map((a) => ({ tool_name: a.name, args: a.args, output: a.output, status: a.status }));
|
|
211
|
+
const result = await finalResponder.run({
|
|
212
|
+
...ctx.skillParams,
|
|
213
|
+
contextInjection: {
|
|
214
|
+
user_goal: task.goal,
|
|
215
|
+
execution_results: executionResults
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
ctx.reply(result.final_response ?? "");
|
|
219
|
+
ctx.chat.completeTask(task.id, result.reasoning);
|
|
220
|
+
ctx.chat.state?.setStatus(AgentStatus.IDLE);
|
|
221
|
+
ctx.setNextNode(this.nodes.fast_responder);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export {
|
|
225
|
+
PlanExecuteLoop
|
|
226
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './skills';
|
|
@@ -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 shared_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(shared_exports);
|
|
18
|
+
__reExport(shared_exports, require("./skills"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./skills")
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./skills";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Skill } from '../../../skills/skill';
|
|
2
|
+
interface PlanStepOutput {
|
|
3
|
+
step_id: number;
|
|
4
|
+
tool_name: string;
|
|
5
|
+
arguments: Record<string, any>;
|
|
6
|
+
expected_outcome: string;
|
|
7
|
+
status: 'READY' | 'MISSING_PARAMS' | 'REQUIRES_CONFIRMATION' | 'COMPLETED' | 'FAILED';
|
|
8
|
+
is_destructive: boolean;
|
|
9
|
+
missing_fields: string[];
|
|
10
|
+
rationale: string;
|
|
11
|
+
depends_on_steps: number[];
|
|
12
|
+
output: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
interface ConfirmationDetails {
|
|
15
|
+
actions: Array<{
|
|
16
|
+
step_id: number;
|
|
17
|
+
description: string;
|
|
18
|
+
}>;
|
|
19
|
+
impact_summary: string;
|
|
20
|
+
confirm_label: string;
|
|
21
|
+
}
|
|
22
|
+
type ResponseSchema = {
|
|
23
|
+
plan_status: 'SUCCESS' | 'MISSING_TOOLS' | 'NEEDS_CLARIFICATION' | 'NEEDS_CONFIRMATION';
|
|
24
|
+
current_step_index: number;
|
|
25
|
+
missing_tools_explanation: string;
|
|
26
|
+
user_response: string;
|
|
27
|
+
steps: PlanStepOutput[];
|
|
28
|
+
needs_clarification: boolean;
|
|
29
|
+
missing_entities: string[];
|
|
30
|
+
clarification_prompt: string;
|
|
31
|
+
confirmation_details: ConfirmationDetails | null;
|
|
32
|
+
reasoning: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const actionPlanner: Skill<ResponseSchema>;
|
|
35
|
+
export {};
|
|
@@ -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 action_planner_exports = {};
|
|
20
|
+
__export(action_planner_exports, {
|
|
21
|
+
actionPlanner: () => actionPlanner
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(action_planner_exports);
|
|
24
|
+
var import_skill = require("../../../skills/skill");
|
|
25
|
+
const actionPlanner = new import_skill.Skill({
|
|
26
|
+
name: "action_planner",
|
|
27
|
+
version: "1.6.2",
|
|
28
|
+
description: "Generates an ordered step-by-step tool execution plan based on IntentContext and candidate tools schema. Flags missing tools, missing required execution parameters, or steps requiring user confirmation for destructive actions.",
|
|
29
|
+
temperature: 0.1,
|
|
30
|
+
systemInstructions: {
|
|
31
|
+
instruction_set: {
|
|
32
|
+
goal: "Evaluate userIntent, extracted_entities, and candidate tools to output a structured execution plan. Detect missing capabilities, missing tool arguments, or destructive tool executions and ask for clarification or confirmation when necessary.",
|
|
33
|
+
role: "Action planning, tool mapping, argument mapping, and execution strategy agent",
|
|
34
|
+
logic_rules: [
|
|
35
|
+
"TOOL_EVALUATION: Analyze available tool schemas against userIntent and extracted_entities in IntentContext. Select only the necessary tools required to achieve the goal.",
|
|
36
|
+
"MISSING_TOOLS_CHECK: If no candidate tools fit the intent, or if essential actions cannot be mapped to any available tool: 1) Set 'plan_status' to 'MISSING_TOOLS', 2) Set 'current_step_index' to 0, 3) Provide a technical explanation in 'missing_tools_explanation' in English, 4) Generate a polite message in 'user_response' written in 'detected_language' explaining that no connected tools/integrations were found to complete the request and suggest checking their active integrations, 5) Set 'steps' to [], 6) Set 'needs_clarification' to false, 'missing_entities' to [], 'clarification_prompt' to '', and 'confirmation_details' to null.",
|
|
37
|
+
"STEP_PLANNING: If tools are available, sequence them logically in 'steps'. Assign incremental 'step_id' starting at 1. Set 'current_step_index' to 0 by default. Explicitly list any prerequisite step IDs in 'depends_on_steps' if a step requires output from a prior step. Define a clear 'expected_outcome' describing the precise expected result or data state after this step runs.",
|
|
38
|
+
"ARGUMENT_MAPPING: Map extracted_entities and execution context (e.g., CONTEXT metadata like 'now_utc', 'now_local', 'timezone', user_details, and session_details) to tool parameters in 'arguments'. For relative time/date expressions (e.g., 'today', 'afternoon', 'yesterday at 4:30pm'), calculate and resolve the precise value (such as ISO 8601 strings) using the provided reference timestamp and timezone. If a parameter value comes from a future step execution output, represent it as a JSON reference string (e.g., '{{step_1.output.id}}').",
|
|
39
|
+
"PARAMETER_AND_SAFETY_VALIDATION: For each step, inspect the candidate tool schema properties and flags:",
|
|
40
|
+
"1) Set 'is_destructive' to match the candidate tool's 'destructive' boolean flag.",
|
|
41
|
+
"2) If any required parameter is MISSING and CANNOT be derived from CONTEXT: Set step 'status' to 'MISSING_PARAMS' and list the missing keys in 'missing_fields'.",
|
|
42
|
+
"3) If ALL required parameters are present BUT 'is_destructive' is true: Set step 'status' to 'REQUIRES_CONFIRMATION' and 'missing_fields' to [].",
|
|
43
|
+
"4) If ALL required parameters are present and 'is_destructive' is false: Set step 'status' to 'READY' and 'missing_fields' to [].",
|
|
44
|
+
"CLARIFICATION_CHECK: If ANY step has status 'MISSING_PARAMS': 1) Set 'plan_status' to 'NEEDS_CLARIFICATION', 2) Set 'needs_clarification' to true, 3) Collect all unresolvable parameters in 'missing_entities' in English, 4) Provide a short, direct, and polite question in 'clarification_prompt' written in 'detected_language', 5) Set 'user_response' to '', and 'confirmation_details' to null.",
|
|
45
|
+
"CONFIRMATION_CHECK: If NO step has 'MISSING_PARAMS' BUT at least one step has status 'REQUIRES_CONFIRMATION': 1) Set 'plan_status' to 'NEEDS_CONFIRMATION', 2) Set 'needs_clarification' to false, 3) Set 'missing_entities' to [], 4) Populate 'confirmation_details' with: 'actions' (one entry per step with status 'REQUIRES_CONFIRMATION', each with that step's 'step_id' and a short natural-language 'description' of exactly what it will do, naming the action and its target \u2014 never the raw tool name or parameter keys), 'impact_summary' summarizing the overall permanent changes in plain terms, and 'confirm_label' \u2014 a short call-to-action asking the user to approve or decline; this will always be shown as the LAST line of the message, so it must stand on its own as the actual yes/no ask, 5) Provide context in 'clarification_prompt' introducing why confirmation is needed \u2014 this field must NOT itself ask a yes/no question, since 'confirm_label' is the only field that does that, 6) Set 'user_response' to ''. CRITICAL: every piece of text produced in this rule ('actions[].description', 'impact_summary', 'confirm_label', 'clarification_prompt') MUST be written in 'detected_language' \u2014 never default to English here regardless of the language used anywhere else in this instruction set.",
|
|
46
|
+
"SUCCESS_STATE: If all steps are 'READY' and no tools are missing or requiring confirmation: 1) Set 'plan_status' to 'SUCCESS', 2) Set 'missing_tools_explanation' to '', 3) Set 'user_response' to '', 4) Set 'needs_clarification' to false, 'missing_entities' to [], 'clarification_prompt' to '', and 'confirmation_details' to null.",
|
|
47
|
+
"LANGUAGE_ENFORCEMENT: ONLY 'clarification_prompt', 'user_response', and every field inside 'confirmation_details' (including each entry's 'description') MUST be written in the user's actual conversation language \u2014 use CONTEXT.detected_language when present; only fall back to CONTEXT.user_details.preferred_language if 'detected_language' is absent. 'preferred_language' is the app's configured display language and does NOT necessarily match the language the user is typing in right now \u2014 never prefer it over 'detected_language' when both exist. These are the only fields the end user actually reads before approving or declining. ALL OTHER fields ('missing_tools_explanation', step 'rationale', step 'expected_outcome', 'missing_entities', and 'reasoning') MUST strictly be written in English.",
|
|
48
|
+
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
49
|
+
],
|
|
50
|
+
response_schema: {
|
|
51
|
+
plan_status: "string (SUCCESS | MISSING_TOOLS | NEEDS_CLARIFICATION | NEEDS_CONFIRMATION)",
|
|
52
|
+
// current_step_index: "number",
|
|
53
|
+
missing_tools_explanation: "string",
|
|
54
|
+
user_response: "string",
|
|
55
|
+
steps: "array of objects with fields 'step_id' (number), 'tool_name' (string), 'arguments' (object), 'expected_outcome' (string), 'status' ('READY' | 'MISSING_PARAMS' | 'REQUIRES_CONFIRMATION'), 'is_destructive' (boolean), 'missing_fields' (array of strings), 'rationale' (string), 'depends_on_steps' (array of numbers)",
|
|
56
|
+
needs_clarification: "boolean",
|
|
57
|
+
missing_entities: "array of strings",
|
|
58
|
+
clarification_prompt: "string",
|
|
59
|
+
confirmation_details: "object containing 'actions' (array of objects with 'step_id' (number) and 'description' (string, natural language, in the user's detected_language)), 'impact_summary' (string, in the user's detected_language), and 'confirm_label' (short string, in the user's detected_language) \u2014 or null",
|
|
60
|
+
reasoning: "string"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
actionPlanner
|
|
68
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "../../../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { Skill } from "../../../skills/skill";
|
|
3
|
+
const actionPlanner = new Skill({
|
|
4
|
+
name: "action_planner",
|
|
5
|
+
version: "1.6.2",
|
|
6
|
+
description: "Generates an ordered step-by-step tool execution plan based on IntentContext and candidate tools schema. Flags missing tools, missing required execution parameters, or steps requiring user confirmation for destructive actions.",
|
|
7
|
+
temperature: 0.1,
|
|
8
|
+
systemInstructions: {
|
|
9
|
+
instruction_set: {
|
|
10
|
+
goal: "Evaluate userIntent, extracted_entities, and candidate tools to output a structured execution plan. Detect missing capabilities, missing tool arguments, or destructive tool executions and ask for clarification or confirmation when necessary.",
|
|
11
|
+
role: "Action planning, tool mapping, argument mapping, and execution strategy agent",
|
|
12
|
+
logic_rules: [
|
|
13
|
+
"TOOL_EVALUATION: Analyze available tool schemas against userIntent and extracted_entities in IntentContext. Select only the necessary tools required to achieve the goal.",
|
|
14
|
+
"MISSING_TOOLS_CHECK: If no candidate tools fit the intent, or if essential actions cannot be mapped to any available tool: 1) Set 'plan_status' to 'MISSING_TOOLS', 2) Set 'current_step_index' to 0, 3) Provide a technical explanation in 'missing_tools_explanation' in English, 4) Generate a polite message in 'user_response' written in 'detected_language' explaining that no connected tools/integrations were found to complete the request and suggest checking their active integrations, 5) Set 'steps' to [], 6) Set 'needs_clarification' to false, 'missing_entities' to [], 'clarification_prompt' to '', and 'confirmation_details' to null.",
|
|
15
|
+
"STEP_PLANNING: If tools are available, sequence them logically in 'steps'. Assign incremental 'step_id' starting at 1. Set 'current_step_index' to 0 by default. Explicitly list any prerequisite step IDs in 'depends_on_steps' if a step requires output from a prior step. Define a clear 'expected_outcome' describing the precise expected result or data state after this step runs.",
|
|
16
|
+
"ARGUMENT_MAPPING: Map extracted_entities and execution context (e.g., CONTEXT metadata like 'now_utc', 'now_local', 'timezone', user_details, and session_details) to tool parameters in 'arguments'. For relative time/date expressions (e.g., 'today', 'afternoon', 'yesterday at 4:30pm'), calculate and resolve the precise value (such as ISO 8601 strings) using the provided reference timestamp and timezone. If a parameter value comes from a future step execution output, represent it as a JSON reference string (e.g., '{{step_1.output.id}}').",
|
|
17
|
+
"PARAMETER_AND_SAFETY_VALIDATION: For each step, inspect the candidate tool schema properties and flags:",
|
|
18
|
+
"1) Set 'is_destructive' to match the candidate tool's 'destructive' boolean flag.",
|
|
19
|
+
"2) If any required parameter is MISSING and CANNOT be derived from CONTEXT: Set step 'status' to 'MISSING_PARAMS' and list the missing keys in 'missing_fields'.",
|
|
20
|
+
"3) If ALL required parameters are present BUT 'is_destructive' is true: Set step 'status' to 'REQUIRES_CONFIRMATION' and 'missing_fields' to [].",
|
|
21
|
+
"4) If ALL required parameters are present and 'is_destructive' is false: Set step 'status' to 'READY' and 'missing_fields' to [].",
|
|
22
|
+
"CLARIFICATION_CHECK: If ANY step has status 'MISSING_PARAMS': 1) Set 'plan_status' to 'NEEDS_CLARIFICATION', 2) Set 'needs_clarification' to true, 3) Collect all unresolvable parameters in 'missing_entities' in English, 4) Provide a short, direct, and polite question in 'clarification_prompt' written in 'detected_language', 5) Set 'user_response' to '', and 'confirmation_details' to null.",
|
|
23
|
+
"CONFIRMATION_CHECK: If NO step has 'MISSING_PARAMS' BUT at least one step has status 'REQUIRES_CONFIRMATION': 1) Set 'plan_status' to 'NEEDS_CONFIRMATION', 2) Set 'needs_clarification' to false, 3) Set 'missing_entities' to [], 4) Populate 'confirmation_details' with: 'actions' (one entry per step with status 'REQUIRES_CONFIRMATION', each with that step's 'step_id' and a short natural-language 'description' of exactly what it will do, naming the action and its target \u2014 never the raw tool name or parameter keys), 'impact_summary' summarizing the overall permanent changes in plain terms, and 'confirm_label' \u2014 a short call-to-action asking the user to approve or decline; this will always be shown as the LAST line of the message, so it must stand on its own as the actual yes/no ask, 5) Provide context in 'clarification_prompt' introducing why confirmation is needed \u2014 this field must NOT itself ask a yes/no question, since 'confirm_label' is the only field that does that, 6) Set 'user_response' to ''. CRITICAL: every piece of text produced in this rule ('actions[].description', 'impact_summary', 'confirm_label', 'clarification_prompt') MUST be written in 'detected_language' \u2014 never default to English here regardless of the language used anywhere else in this instruction set.",
|
|
24
|
+
"SUCCESS_STATE: If all steps are 'READY' and no tools are missing or requiring confirmation: 1) Set 'plan_status' to 'SUCCESS', 2) Set 'missing_tools_explanation' to '', 3) Set 'user_response' to '', 4) Set 'needs_clarification' to false, 'missing_entities' to [], 'clarification_prompt' to '', and 'confirmation_details' to null.",
|
|
25
|
+
"LANGUAGE_ENFORCEMENT: ONLY 'clarification_prompt', 'user_response', and every field inside 'confirmation_details' (including each entry's 'description') MUST be written in the user's actual conversation language \u2014 use CONTEXT.detected_language when present; only fall back to CONTEXT.user_details.preferred_language if 'detected_language' is absent. 'preferred_language' is the app's configured display language and does NOT necessarily match the language the user is typing in right now \u2014 never prefer it over 'detected_language' when both exist. These are the only fields the end user actually reads before approving or declining. ALL OTHER fields ('missing_tools_explanation', step 'rationale', step 'expected_outcome', 'missing_entities', and 'reasoning') MUST strictly be written in English.",
|
|
26
|
+
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
27
|
+
],
|
|
28
|
+
response_schema: {
|
|
29
|
+
plan_status: "string (SUCCESS | MISSING_TOOLS | NEEDS_CLARIFICATION | NEEDS_CONFIRMATION)",
|
|
30
|
+
// current_step_index: "number",
|
|
31
|
+
missing_tools_explanation: "string",
|
|
32
|
+
user_response: "string",
|
|
33
|
+
steps: "array of objects with fields 'step_id' (number), 'tool_name' (string), 'arguments' (object), 'expected_outcome' (string), 'status' ('READY' | 'MISSING_PARAMS' | 'REQUIRES_CONFIRMATION'), 'is_destructive' (boolean), 'missing_fields' (array of strings), 'rationale' (string), 'depends_on_steps' (array of numbers)",
|
|
34
|
+
needs_clarification: "boolean",
|
|
35
|
+
missing_entities: "array of strings",
|
|
36
|
+
clarification_prompt: "string",
|
|
37
|
+
confirmation_details: "object containing 'actions' (array of objects with 'step_id' (number) and 'description' (string, natural language, in the user's detected_language)), 'impact_summary' (string, in the user's detected_language), and 'confirm_label' (short string, in the user's detected_language) \u2014 or null",
|
|
38
|
+
reasoning: "string"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
actionPlanner
|
|
45
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Skill } from '../../../skills/skill';
|
|
2
|
+
type ResponseSchema = {
|
|
3
|
+
decision: 'CONFIRMED' | 'DECLINED' | 'UNCLEAR';
|
|
4
|
+
reasoning: string;
|
|
5
|
+
acknowledgement: string;
|
|
6
|
+
clarification_prompt: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const confirmationGate: Skill<ResponseSchema>;
|
|
9
|
+
export {};
|