@ductape/sdk 0.0.4-v6 → 0.0.4-v60
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/agents/agent-context.d.ts +98 -0
- package/dist/agents/agent-context.js +588 -0
- package/dist/agents/agent-context.js.map +1 -0
- package/dist/agents/agent-executor.d.ts +180 -0
- package/dist/agents/agent-executor.js +715 -0
- package/dist/agents/agent-executor.js.map +1 -0
- package/dist/agents/agents.service.d.ts +310 -0
- package/dist/agents/agents.service.js +1249 -0
- package/dist/agents/agents.service.js.map +1 -0
- package/dist/agents/index.d.ts +55 -0
- package/dist/agents/index.js +110 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/memory-manager.d.ts +182 -0
- package/dist/agents/memory-manager.js +383 -0
- package/dist/agents/memory-manager.js.map +1 -0
- package/dist/agents/tool-registry.d.ts +141 -0
- package/dist/agents/tool-registry.js +355 -0
- package/dist/agents/tool-registry.js.map +1 -0
- package/dist/agents/types/agents.types.d.ts +1227 -0
- package/dist/agents/types/agents.types.js +12 -0
- package/dist/agents/types/agents.types.js.map +1 -0
- package/dist/agents/types/index.d.ts +6 -0
- package/dist/agents/types/index.js +23 -0
- package/dist/agents/types/index.js.map +1 -0
- package/dist/agents/vector-store-adapter.d.ts +108 -0
- package/dist/agents/vector-store-adapter.js +213 -0
- package/dist/agents/vector-store-adapter.js.map +1 -0
- package/dist/api/services/appApi.service.d.ts +51 -5
- package/dist/api/services/appApi.service.js +101 -3
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/pricingApi.service.d.ts +10 -0
- package/dist/api/services/pricingApi.service.js +34 -0
- package/dist/api/services/pricingApi.service.js.map +1 -0
- package/dist/api/services/processorApi.service.d.ts +334 -2
- package/dist/api/services/processorApi.service.js +264 -2
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +108 -1
- package/dist/api/services/productsApi.service.js +150 -3
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/resilienceApi.service.d.ts +106 -0
- package/dist/api/services/resilienceApi.service.js +224 -0
- package/dist/api/services/resilienceApi.service.js.map +1 -0
- package/dist/api/services/secretsApi.service.d.ts +50 -0
- package/dist/api/services/secretsApi.service.js +124 -0
- package/dist/api/services/secretsApi.service.js.map +1 -0
- package/dist/api/services/workflowApi.service.d.ts +199 -0
- package/dist/api/services/workflowApi.service.js +183 -0
- package/dist/api/services/workflowApi.service.js.map +1 -0
- package/dist/api/services/workspaceApi.service.d.ts +8 -0
- package/dist/api/services/workspaceApi.service.js +20 -0
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +65 -1
- package/dist/api/urls.js +90 -18
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/auth.utils.d.ts +1 -3
- package/dist/api/utils/auth.utils.js.map +1 -1
- package/dist/api/utils/cache.utils.d.ts +1 -1
- package/dist/api/utils/cache.utils.js +2 -2
- package/dist/api/utils/cache.utils.js.map +1 -1
- package/dist/api/utils/strings.utils.d.ts +2 -0
- package/dist/api/utils/strings.utils.js +14 -0
- package/dist/api/utils/strings.utils.js.map +1 -1
- package/dist/apps/services/app.service.d.ts +41 -33
- package/dist/apps/services/app.service.js +472 -184
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/utils/auth-context-manager.d.ts +137 -0
- package/dist/apps/utils/auth-context-manager.js +248 -0
- package/dist/apps/utils/auth-context-manager.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +128 -0
- package/dist/apps/utils/credential-manager.js +199 -0
- package/dist/apps/utils/credential-manager.js.map +1 -0
- package/dist/apps/utils/index.d.ts +10 -0
- package/dist/apps/utils/index.js +54 -0
- package/dist/apps/utils/index.js.map +1 -0
- package/dist/apps/utils/input-helpers.d.ts +67 -0
- package/dist/apps/utils/input-helpers.js +185 -0
- package/dist/apps/utils/input-helpers.js.map +1 -0
- package/dist/apps/utils/input-resolver.d.ts +165 -0
- package/dist/apps/utils/input-resolver.js +477 -0
- package/dist/apps/utils/input-resolver.js.map +1 -0
- package/dist/apps/utils/oauth-manager.d.ts +196 -0
- package/dist/apps/utils/oauth-manager.js +429 -0
- package/dist/apps/utils/oauth-manager.js.map +1 -0
- package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
- package/dist/bin.d.ts +26 -0
- package/dist/bin.js +28 -0
- package/dist/bin.js.map +1 -0
- package/dist/brokers/brokers.service.d.ts +289 -0
- package/dist/brokers/brokers.service.js +722 -0
- package/dist/brokers/brokers.service.js.map +1 -0
- package/dist/brokers/index.d.ts +46 -0
- package/dist/brokers/index.js +83 -0
- package/dist/brokers/index.js.map +1 -0
- package/dist/brokers/types/index.d.ts +314 -0
- package/dist/brokers/types/index.js +8 -0
- package/dist/brokers/types/index.js.map +1 -0
- package/dist/brokers/utils/broker.util.d.ts +33 -0
- package/dist/brokers/utils/broker.util.js +125 -0
- package/dist/brokers/utils/broker.util.js.map +1 -0
- package/dist/brokers/utils/providers/aws-sqs.service.d.ts +16 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
- package/dist/brokers/utils/providers/google-pubsub.service.d.ts +16 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js +43 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
- package/dist/brokers/utils/providers/index.d.ts +6 -0
- package/dist/brokers/utils/providers/index.js +16 -0
- package/dist/brokers/utils/providers/index.js.map +1 -0
- package/dist/brokers/utils/providers/kafka.service.d.ts +23 -0
- package/dist/brokers/utils/providers/kafka.service.js +131 -0
- package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
- package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
- package/dist/brokers/utils/providers/nats.service.js +63 -0
- package/dist/brokers/utils/providers/nats.service.js.map +1 -0
- package/dist/brokers/utils/providers/rabbitmq.service.d.ts +15 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js +151 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
- package/dist/brokers/utils/providers/redis.service.d.ts +18 -0
- package/dist/brokers/utils/providers/redis.service.js +93 -0
- package/dist/brokers/utils/providers/redis.service.js.map +1 -0
- package/dist/cache/cache.manager.d.ts +159 -0
- package/dist/cache/cache.manager.js +265 -0
- package/dist/cache/cache.manager.js.map +1 -0
- package/dist/cache/cache.service.d.ts +186 -0
- package/dist/cache/cache.service.js +437 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.js +79 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types/index.d.ts +106 -0
- package/dist/cache/types/index.js +6 -0
- package/dist/cache/types/index.js.map +1 -0
- package/dist/clients/pricing.client.d.ts +3 -0
- package/dist/clients/pricing.client.js +33 -0
- package/dist/clients/pricing.client.js.map +1 -0
- package/dist/database/actions/action-manager.d.ts +170 -0
- package/dist/database/actions/action-manager.js +465 -0
- package/dist/database/actions/action-manager.js.map +1 -0
- package/dist/database/actions/index.d.ts +6 -0
- package/dist/database/actions/index.js +13 -0
- package/dist/database/actions/index.js.map +1 -0
- package/dist/database/adapters/adapter.factory.d.ts +62 -0
- package/dist/database/adapters/adapter.factory.js +97 -0
- package/dist/database/adapters/adapter.factory.js.map +1 -0
- package/dist/database/adapters/base.adapter.d.ts +393 -0
- package/dist/database/adapters/base.adapter.js +150 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/cassandra.adapter.d.ts +91 -0
- package/dist/database/adapters/cassandra.adapter.js +1075 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +109 -0
- package/dist/database/adapters/dynamodb.adapter.js +1534 -0
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
- package/dist/database/adapters/index.d.ts +11 -0
- package/dist/database/adapters/index.js +27 -0
- package/dist/database/adapters/index.js.map +1 -0
- package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
- package/dist/database/adapters/mariadb.adapter.js +247 -0
- package/dist/database/adapters/mariadb.adapter.js.map +1 -0
- package/dist/database/adapters/mongodb.adapter.d.ts +120 -0
- package/dist/database/adapters/mongodb.adapter.js +1253 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +85 -0
- package/dist/database/adapters/mysql.adapter.js +1313 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +88 -0
- package/dist/database/adapters/postgresql.adapter.js +1434 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/databases.service.d.ts +1388 -0
- package/dist/database/databases.service.js +2821 -0
- package/dist/database/databases.service.js.map +1 -0
- package/dist/database/index.d.ts +46 -0
- package/dist/database/index.js +109 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/migrations/index.d.ts +6 -0
- package/dist/database/migrations/index.js +12 -0
- package/dist/database/migrations/index.js.map +1 -0
- package/dist/database/migrations/migration-engine.d.ts +132 -0
- package/dist/database/migrations/migration-engine.js +1356 -0
- package/dist/database/migrations/migration-engine.js.map +1 -0
- package/dist/database/operators/aggregation-builder.d.ts +67 -0
- package/dist/database/operators/aggregation-builder.js +841 -0
- package/dist/database/operators/aggregation-builder.js.map +1 -0
- package/dist/database/operators/index.d.ts +7 -0
- package/dist/database/operators/index.js +15 -0
- package/dist/database/operators/index.js.map +1 -0
- package/dist/database/operators/query-builder.d.ts +59 -0
- package/dist/database/operators/query-builder.js +397 -0
- package/dist/database/operators/query-builder.js.map +1 -0
- package/dist/database/presave/decrypt.d.ts +25 -0
- package/dist/database/presave/decrypt.js +146 -0
- package/dist/database/presave/decrypt.js.map +1 -0
- package/dist/database/presave/index.d.ts +9 -0
- package/dist/database/presave/index.js +18 -0
- package/dist/database/presave/index.js.map +1 -0
- package/dist/database/presave/presave-processor.d.ts +148 -0
- package/dist/database/presave/presave-processor.js +702 -0
- package/dist/database/presave/presave-processor.js.map +1 -0
- package/dist/database/schema/index.d.ts +7 -0
- package/dist/database/schema/index.js +13 -0
- package/dist/database/schema/index.js.map +1 -0
- package/dist/database/schema/schema-manager.d.ts +258 -0
- package/dist/database/schema/schema-manager.js +637 -0
- package/dist/database/schema/schema-manager.js.map +1 -0
- package/dist/database/transactions/index.d.ts +6 -0
- package/dist/database/transactions/index.js +13 -0
- package/dist/database/transactions/index.js.map +1 -0
- package/dist/database/transactions/transaction-manager.d.ts +113 -0
- package/dist/database/transactions/transaction-manager.js +344 -0
- package/dist/database/transactions/transaction-manager.js.map +1 -0
- package/dist/database/triggers/index.d.ts +7 -0
- package/dist/database/triggers/index.js +14 -0
- package/dist/database/triggers/index.js.map +1 -0
- package/dist/database/triggers/trigger-processor.d.ts +239 -0
- package/dist/database/triggers/trigger-processor.js +1034 -0
- package/dist/database/triggers/trigger-processor.js.map +1 -0
- package/dist/database/types/action.interface.d.ts +148 -0
- package/dist/database/types/action.interface.js +6 -0
- package/dist/database/types/action.interface.js.map +1 -0
- package/dist/database/types/aggregation.interface.d.ts +185 -0
- package/dist/database/types/aggregation.interface.js +6 -0
- package/dist/database/types/aggregation.interface.js.map +1 -0
- package/dist/database/types/connection.interface.d.ts +137 -0
- package/dist/database/types/connection.interface.js +6 -0
- package/dist/database/types/connection.interface.js.map +1 -0
- package/dist/database/types/enums.d.ts +195 -0
- package/dist/database/types/enums.js +244 -0
- package/dist/database/types/enums.js.map +1 -0
- package/dist/database/types/index.d.ts +14 -0
- package/dist/database/types/index.js +31 -0
- package/dist/database/types/index.js.map +1 -0
- package/dist/database/types/migration.interface.d.ts +686 -0
- package/dist/database/types/migration.interface.js +9 -0
- package/dist/database/types/migration.interface.js.map +1 -0
- package/dist/database/types/presave.interface.d.ts +292 -0
- package/dist/database/types/presave.interface.js +60 -0
- package/dist/database/types/presave.interface.js.map +1 -0
- package/dist/database/types/query.interface.d.ts +205 -0
- package/dist/database/types/query.interface.js +6 -0
- package/dist/database/types/query.interface.js.map +1 -0
- package/dist/database/types/schema.interface.d.ts +398 -0
- package/dist/database/types/schema.interface.js +6 -0
- package/dist/database/types/schema.interface.js.map +1 -0
- package/dist/database/types/transaction.interface.d.ts +84 -0
- package/dist/database/types/transaction.interface.js +6 -0
- package/dist/database/types/transaction.interface.js.map +1 -0
- package/dist/database/types/trigger.interface.d.ts +612 -0
- package/dist/database/types/trigger.interface.js +121 -0
- package/dist/database/types/trigger.interface.js.map +1 -0
- package/dist/database/types/write.interface.d.ts +216 -0
- package/dist/database/types/write.interface.js +6 -0
- package/dist/database/types/write.interface.js.map +1 -0
- package/dist/database/utils/database-error.d.ts +96 -0
- package/dist/database/utils/database-error.js +221 -0
- package/dist/database/utils/database-error.js.map +1 -0
- package/dist/database/utils/index.d.ts +6 -0
- package/dist/database/utils/index.js +11 -0
- package/dist/database/utils/index.js.map +1 -0
- package/dist/graph/adapters/adapter.factory.d.ts +47 -0
- package/dist/graph/adapters/adapter.factory.js +77 -0
- package/dist/graph/adapters/adapter.factory.js.map +1 -0
- package/dist/graph/adapters/arangodb.adapter.d.ts +86 -0
- package/dist/graph/adapters/arangodb.adapter.js +1522 -0
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
- package/dist/graph/adapters/base.adapter.d.ts +245 -0
- package/dist/graph/adapters/base.adapter.js +64 -0
- package/dist/graph/adapters/base.adapter.js.map +1 -0
- package/dist/graph/adapters/index.d.ts +11 -0
- package/dist/graph/adapters/index.js +21 -0
- package/dist/graph/adapters/index.js.map +1 -0
- package/dist/graph/adapters/memgraph.adapter.d.ts +110 -0
- package/dist/graph/adapters/memgraph.adapter.js +1345 -0
- package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
- package/dist/graph/adapters/neo4j.adapter.d.ts +81 -0
- package/dist/graph/adapters/neo4j.adapter.js +1198 -0
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
- package/dist/graph/adapters/neptune.adapter.d.ts +82 -0
- package/dist/graph/adapters/neptune.adapter.js +1313 -0
- package/dist/graph/adapters/neptune.adapter.js.map +1 -0
- package/dist/graph/graphs.service.d.ts +546 -0
- package/dist/graph/graphs.service.js +1893 -0
- package/dist/graph/graphs.service.js.map +1 -0
- package/dist/graph/index.d.ts +57 -0
- package/dist/graph/index.js +77 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/transactions/index.d.ts +4 -0
- package/dist/graph/transactions/index.js +9 -0
- package/dist/graph/transactions/index.js.map +1 -0
- package/dist/graph/transactions/transaction-manager.d.ts +61 -0
- package/dist/graph/transactions/transaction-manager.js +126 -0
- package/dist/graph/transactions/transaction-manager.js.map +1 -0
- package/dist/graph/types/connection.interface.d.ts +149 -0
- package/dist/graph/types/connection.interface.js +9 -0
- package/dist/graph/types/connection.interface.js.map +1 -0
- package/dist/graph/types/enums.d.ts +101 -0
- package/dist/graph/types/enums.js +114 -0
- package/dist/graph/types/enums.js.map +1 -0
- package/dist/graph/types/index.d.ts +13 -0
- package/dist/graph/types/index.js +20 -0
- package/dist/graph/types/index.js.map +1 -0
- package/dist/graph/types/node.interface.d.ts +248 -0
- package/dist/graph/types/node.interface.js +9 -0
- package/dist/graph/types/node.interface.js.map +1 -0
- package/dist/graph/types/query.interface.d.ts +175 -0
- package/dist/graph/types/query.interface.js +9 -0
- package/dist/graph/types/query.interface.js.map +1 -0
- package/dist/graph/types/relationship.interface.d.ts +207 -0
- package/dist/graph/types/relationship.interface.js +9 -0
- package/dist/graph/types/relationship.interface.js.map +1 -0
- package/dist/graph/types/schema.interface.d.ts +295 -0
- package/dist/graph/types/schema.interface.js +9 -0
- package/dist/graph/types/schema.interface.js.map +1 -0
- package/dist/graph/types/transaction.interface.d.ts +55 -0
- package/dist/graph/types/transaction.interface.js +9 -0
- package/dist/graph/types/transaction.interface.js.map +1 -0
- package/dist/graph/types/traversal.interface.d.ts +181 -0
- package/dist/graph/types/traversal.interface.js +9 -0
- package/dist/graph/types/traversal.interface.js.map +1 -0
- package/dist/graph/utils/graph-error.d.ts +71 -0
- package/dist/graph/utils/graph-error.js +142 -0
- package/dist/graph/utils/graph-error.js.map +1 -0
- package/dist/graph/utils/index.d.ts +4 -0
- package/dist/graph/utils/index.js +9 -0
- package/dist/graph/utils/index.js.map +1 -0
- package/dist/imports/imports.service.d.ts +3 -3
- package/dist/imports/imports.service.js +8 -7
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +8 -0
- package/dist/imports/repos/openApi.repo.d.ts +1 -1
- package/dist/imports/repos/openApi.repo.js +414 -47
- package/dist/imports/repos/openApi.repo.js.map +1 -1
- package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
- package/dist/imports/repos/postmanV21.repo.js +126 -83
- package/dist/imports/repos/postmanV21.repo.js.map +1 -1
- package/dist/index.d.ts +3239 -285
- package/dist/index.js +4705 -687
- package/dist/index.js.map +1 -1
- package/dist/init.interface.d.ts +407 -0
- package/dist/init.interface.js +3 -0
- package/dist/init.interface.js.map +1 -0
- package/dist/inputs/inputs.service.d.ts +1 -1
- package/dist/inputs/inputs.service.js +2 -2
- package/dist/inputs/inputs.service.js.map +1 -1
- package/dist/inputs/utils/inputs.utils.create.js +1 -1
- package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
- package/dist/jobs/index.d.ts +38 -0
- package/dist/jobs/index.js +50 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobs.service.d.ts +154 -0
- package/dist/jobs/jobs.service.js +491 -0
- package/dist/jobs/jobs.service.js.map +1 -0
- package/dist/jobs/jobs.state.d.ts +113 -0
- package/dist/jobs/jobs.state.js +447 -0
- package/dist/jobs/jobs.state.js.map +1 -0
- package/dist/jobs/types.d.ts +449 -0
- package/dist/jobs/types.js +74 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/logs/logs.types.d.ts +16 -1
- package/dist/logs/logs.types.js +5 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/models.service.d.ts +137 -0
- package/dist/models/models.service.js +195 -0
- package/dist/models/models.service.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.js +26 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notifications.service.d.ts +257 -0
- package/dist/notifications/notifications.service.js +656 -0
- package/dist/notifications/notifications.service.js.map +1 -0
- package/dist/notifications/types/index.d.ts +4 -0
- package/dist/notifications/types/index.js +21 -0
- package/dist/notifications/types/index.js.map +1 -0
- package/dist/notifications/types/notifications.types.d.ts +400 -0
- package/dist/notifications/types/notifications.types.js +49 -0
- package/dist/notifications/types/notifications.types.js.map +1 -0
- package/dist/parsers/index.d.ts +3 -0
- package/dist/parsers/index.js +27 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
- package/dist/parsers/pipelines/postman.pipelines.js +103 -0
- package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
- package/dist/parsers/types/postman.types.d.ts +200 -0
- package/dist/parsers/types/postman.types.js +3 -0
- package/dist/parsers/types/postman.types.js.map +1 -0
- package/dist/parsers/utils/postman.utils.d.ts +12 -0
- package/dist/parsers/utils/postman.utils.js +116 -0
- package/dist/parsers/utils/postman.utils.js.map +1 -0
- package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
- package/dist/parsers/validators/postman-auth.validators.js +127 -0
- package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
- package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-request.validators.js +139 -0
- package/dist/parsers/validators/postman-request.validators.js.map +1 -0
- package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-response.validators.js +150 -0
- package/dist/parsers/validators/postman-response.validators.js.map +1 -0
- package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
- package/dist/parsers/validators/postman-variable.validators.js +163 -0
- package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
- package/dist/pricing/pricing.repo.js +1 -0
- package/dist/pricing/pricing.repo.js.map +1 -0
- package/dist/pricing/pricing.service.d.ts +24 -0
- package/dist/pricing/pricing.service.js +51 -0
- package/dist/pricing/pricing.service.js.map +1 -0
- package/dist/pricing/pricing.types.d.ts +76 -0
- package/dist/pricing/pricing.types.js +21 -0
- package/dist/pricing/pricing.types.js.map +1 -0
- package/dist/pricing/utils/string.utils.d.ts +1 -0
- package/dist/pricing/utils/string.utils.js +9 -0
- package/dist/pricing/utils/string.utils.js.map +1 -0
- package/dist/processor/services/processor.service.d.ts +120 -73
- package/dist/processor/services/processor.service.js +1705 -1294
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/services/request.service.d.ts +36 -0
- package/dist/processor/services/request.service.js +304 -0
- package/dist/processor/services/request.service.js.map +1 -0
- package/dist/processor/types/request.types.d.ts +14 -0
- package/dist/processor/types/request.types.js +3 -0
- package/dist/processor/types/request.types.js.map +1 -0
- package/dist/processor/utils/processor.utils.d.ts +3 -0
- package/dist/processor/utils/processor.utils.js +87 -21
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/processor/utils/request.utils.d.ts +20 -0
- package/dist/processor/utils/request.utils.js +113 -0
- package/dist/processor/utils/request.utils.js.map +1 -0
- package/dist/products/services/products.service.d.ts +330 -77
- package/dist/products/services/products.service.js +2586 -397
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/utils/string.utils.d.ts +1 -1
- package/dist/products/utils/string.utils.js +14 -2
- package/dist/products/utils/string.utils.js.map +1 -1
- package/dist/products/validators/index.d.ts +7 -1
- package/dist/products/validators/index.js +16 -1
- package/dist/products/validators/index.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js +266 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productGraph.validator.js +89 -0
- package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +81 -25
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productNotification.validator.js +133 -45
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
- package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js +135 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
- package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productGraph.validator.js +88 -0
- package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -0
- package/dist/resilience/fallback.service.d.ts +140 -0
- package/dist/resilience/fallback.service.js +764 -0
- package/dist/resilience/fallback.service.js.map +1 -0
- package/dist/resilience/healthcheck.service.d.ts +159 -0
- package/dist/resilience/healthcheck.service.js +943 -0
- package/dist/resilience/healthcheck.service.js.map +1 -0
- package/dist/resilience/index.d.ts +104 -0
- package/dist/resilience/index.js +140 -0
- package/dist/resilience/index.js.map +1 -0
- package/dist/resilience/quota.service.d.ts +82 -0
- package/dist/resilience/quota.service.js +516 -0
- package/dist/resilience/quota.service.js.map +1 -0
- package/dist/resilience/resilience.service.d.ts +98 -0
- package/dist/resilience/resilience.service.js +560 -0
- package/dist/resilience/resilience.service.js.map +1 -0
- package/dist/resilience/types/index.d.ts +513 -0
- package/dist/resilience/types/index.js +29 -0
- package/dist/resilience/types/index.js.map +1 -0
- package/dist/secrets/index.d.ts +10 -0
- package/dist/secrets/index.js +33 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/secrets.resolver.d.ts +52 -0
- package/dist/secrets/secrets.resolver.js +233 -0
- package/dist/secrets/secrets.resolver.js.map +1 -0
- package/dist/secrets/secrets.service.d.ts +93 -0
- package/dist/secrets/secrets.service.js +258 -0
- package/dist/secrets/secrets.service.js.map +1 -0
- package/dist/secrets/secrets.types.d.ts +188 -0
- package/dist/secrets/secrets.types.js +87 -0
- package/dist/secrets/secrets.types.js.map +1 -0
- package/dist/sessions/index.d.ts +50 -0
- package/dist/sessions/index.js +93 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/sessions.helper.d.ts +68 -0
- package/dist/sessions/sessions.helper.js +116 -0
- package/dist/sessions/sessions.helper.js.map +1 -0
- package/dist/sessions/sessions.resolver.d.ts +150 -0
- package/dist/sessions/sessions.resolver.js +356 -0
- package/dist/sessions/sessions.resolver.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +170 -0
- package/dist/sessions/sessions.service.js +736 -0
- package/dist/sessions/sessions.service.js.map +1 -0
- package/dist/sessions/types/index.d.ts +290 -0
- package/dist/sessions/types/index.js +6 -0
- package/dist/sessions/types/index.js.map +1 -0
- package/dist/storage/index.d.ts +66 -0
- package/dist/storage/index.js +98 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.service.d.ts +151 -0
- package/dist/storage/storage.service.js +522 -0
- package/dist/storage/storage.service.js.map +1 -0
- package/dist/storage/types/index.d.ts +207 -0
- package/dist/storage/types/index.js +6 -0
- package/dist/storage/types/index.js.map +1 -0
- package/dist/storage/utils/storage.util.d.ts +51 -0
- package/dist/storage/utils/storage.util.js +402 -0
- package/dist/storage/utils/storage.util.js.map +1 -0
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.js +11 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/test.appBuilder.d.ts +0 -1
- package/dist/test/test.appBuilder.js +0 -15
- package/dist/test/test.appBuilder.js.map +1 -1
- package/dist/test/test.broker.kafka.js +172 -0
- package/dist/test/test.broker.kafka.js.map +1 -0
- package/dist/test/test.broker.nats.js +193 -0
- package/dist/test/test.broker.nats.js.map +1 -0
- package/dist/test/test.broker.pubsub.js +171 -0
- package/dist/test/test.broker.pubsub.js.map +1 -0
- package/dist/test/test.broker.rabbitmq.js +164 -0
- package/dist/test/test.broker.rabbitmq.js.map +1 -0
- package/dist/test/test.broker.redis.js +168 -0
- package/dist/test/test.broker.redis.js.map +1 -0
- package/dist/test/test.broker.sqs.d.ts +1 -0
- package/dist/test/test.broker.sqs.js +158 -0
- package/dist/test/test.broker.sqs.js.map +1 -0
- package/dist/test/test.caches.d.ts +1 -0
- package/dist/test/test.caches.js +231 -0
- package/dist/test/test.caches.js.map +1 -0
- package/dist/test/test.database.d.ts +1 -0
- package/dist/test/test.database.dynamo.d.ts +1 -0
- package/dist/test/test.database.dynamo.js +265 -0
- package/dist/test/test.database.dynamo.js.map +1 -0
- package/dist/test/test.database.js +140 -0
- package/dist/test/test.database.js.map +1 -0
- package/dist/test/test.database.mongo.d.ts +1 -0
- package/dist/test/test.database.mongo.js +371 -0
- package/dist/test/test.database.mongo.js.map +1 -0
- package/dist/test/test.database.mysql.d.ts +1 -0
- package/dist/test/test.database.mysql.js +415 -0
- package/dist/test/test.database.mysql.js.map +1 -0
- package/dist/test/test.database.postgres.d.ts +1 -0
- package/dist/test/test.database.postgres.js +412 -0
- package/dist/test/test.database.postgres.js.map +1 -0
- package/dist/test/test.email.brevo.d.ts +1 -0
- package/dist/test/test.email.brevo.js +326 -0
- package/dist/test/test.email.brevo.js.map +1 -0
- package/dist/test/test.email.mailgun.d.ts +1 -0
- package/dist/test/test.email.mailgun.js +352 -0
- package/dist/test/test.email.mailgun.js.map +1 -0
- package/dist/test/test.email.postmark.d.ts +1 -0
- package/dist/test/test.email.postmark.js +316 -0
- package/dist/test/test.email.postmark.js.map +1 -0
- package/dist/test/test.email.sendgrid.d.ts +1 -0
- package/dist/test/test.email.sendgrid.js +365 -0
- package/dist/test/test.email.sendgrid.js.map +1 -0
- package/dist/test/test.email.smtp.d.ts +1 -0
- package/dist/test/test.email.smtp.js +323 -0
- package/dist/test/test.email.smtp.js.map +1 -0
- package/dist/test/test.graph.arangodb.d.ts +1 -0
- package/dist/test/test.graph.arangodb.js +358 -0
- package/dist/test/test.graph.arangodb.js.map +1 -0
- package/dist/test/test.graph.memgraph.d.ts +1 -0
- package/dist/test/test.graph.memgraph.js +320 -0
- package/dist/test/test.graph.memgraph.js.map +1 -0
- package/dist/test/test.graph.neo4j.d.ts +1 -0
- package/dist/test/test.graph.neo4j.js +218 -0
- package/dist/test/test.graph.neo4j.js.map +1 -0
- package/dist/test/test.graph.neptune.d.ts +1 -0
- package/dist/test/test.graph.neptune.js +331 -0
- package/dist/test/test.graph.neptune.js.map +1 -0
- package/dist/test/test.health.js +1 -0
- package/dist/test/test.health.js.map +1 -0
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1459
- package/dist/test/test.import.js.map +1 -1
- package/dist/test/test.import.openapi.d.ts +0 -1
- package/dist/test/test.import.openapi.js +0 -75
- package/dist/test/test.import.openapi.js.map +1 -1
- package/dist/test/test.imports.js +14 -55
- package/dist/test/test.imports.js.map +1 -1
- package/dist/test/test.logs.d.ts +0 -1
- package/dist/test/test.logs.js +0 -17
- package/dist/test/test.logs.js.map +1 -1
- package/dist/test/test.notifications.d.ts +1 -0
- package/dist/test/test.notifications.js +198 -0
- package/dist/test/test.notifications.js.map +1 -0
- package/dist/test/test.notifiers.js +1 -0
- package/dist/test/test.notifiers.js.map +1 -0
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -122
- package/dist/test/test.processor.js.map +1 -1
- package/dist/test/test.productBuilder.d.ts +0 -1
- package/dist/test/test.productBuilder.js +0 -660
- package/dist/test/test.productBuilder.js.map +1 -1
- package/dist/test/test.products.js +1 -0
- package/dist/test/test.products.js.map +1 -0
- package/dist/test/test.push.expo.d.ts +1 -0
- package/dist/test/test.push.expo.js +442 -0
- package/dist/test/test.push.expo.js.map +1 -0
- package/dist/test/test.push.firebase.d.ts +1 -0
- package/dist/test/test.push.firebase.js +409 -0
- package/dist/test/test.push.firebase.js.map +1 -0
- package/dist/test/test.session.d.ts +1 -0
- package/dist/test/test.session.js +299 -0
- package/dist/test/test.session.js.map +1 -0
- package/dist/test/test.sms.nexmo.d.ts +1 -0
- package/dist/test/test.sms.nexmo.js +278 -0
- package/dist/test/test.sms.nexmo.js.map +1 -0
- package/dist/test/test.sms.twilio.d.ts +1 -0
- package/dist/test/test.sms.twilio.js +275 -0
- package/dist/test/test.sms.twilio.js.map +1 -0
- package/dist/test/test.storage.d.ts +1 -0
- package/dist/test/test.storage.js +202 -0
- package/dist/test/test.storage.js.map +1 -0
- package/dist/test/test.triggers.d.ts +1 -0
- package/dist/test/test.triggers.js +314 -0
- package/dist/test/test.triggers.js.map +1 -0
- package/dist/test/test.vector.pinecone.d.ts +1 -0
- package/dist/test/test.vector.pinecone.js +238 -0
- package/dist/test/test.vector.pinecone.js.map +1 -0
- package/dist/test/test.vector.qdrant.d.ts +1 -0
- package/dist/test/test.vector.qdrant.js +307 -0
- package/dist/test/test.vector.qdrant.js.map +1 -0
- package/dist/test/test.vector.weaviate.d.ts +1 -0
- package/dist/test/test.vector.weaviate.js +325 -0
- package/dist/test/test.vector.weaviate.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +10 -13
- package/dist/types/enums.d.ts +11 -1
- package/dist/types/enums.js +10 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +6 -4
- package/dist/types/index.types.js +0 -1
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/pricing.types.d.ts +4 -0
- package/dist/types/pricing.types.js +3 -0
- package/dist/types/pricing.types.js.map +1 -0
- package/dist/types/processor.types.d.ts +245 -20
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +906 -24
- package/dist/types/productsBuilder.types.js +173 -2
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/types/request-tracker.interface.js +1 -0
- package/dist/types/request-tracker.interface.js.map +1 -0
- package/dist/types/requests.types.d.ts +2 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +24 -52
- package/dist/utils/index.js.map +1 -1
- package/dist/vector/adapters/base.adapter.d.ts +152 -0
- package/dist/vector/adapters/base.adapter.js +137 -0
- package/dist/vector/adapters/base.adapter.js.map +1 -0
- package/dist/vector/adapters/index.d.ts +10 -0
- package/dist/vector/adapters/index.js +19 -0
- package/dist/vector/adapters/index.js.map +1 -0
- package/dist/vector/adapters/memory.adapter.d.ts +85 -0
- package/dist/vector/adapters/memory.adapter.js +505 -0
- package/dist/vector/adapters/memory.adapter.js.map +1 -0
- package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
- package/dist/vector/adapters/pinecone.adapter.js +400 -0
- package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
- package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
- package/dist/vector/adapters/qdrant.adapter.js +392 -0
- package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
- package/dist/vector/adapters/weaviate.adapter.d.ts +64 -0
- package/dist/vector/adapters/weaviate.adapter.js +478 -0
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
- package/dist/vector/index.d.ts +47 -0
- package/dist/vector/index.js +72 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/types/connection.interface.d.ts +151 -0
- package/dist/vector/types/connection.interface.js +8 -0
- package/dist/vector/types/connection.interface.js.map +1 -0
- package/dist/vector/types/embedding.interface.d.ts +144 -0
- package/dist/vector/types/embedding.interface.js +8 -0
- package/dist/vector/types/embedding.interface.js.map +1 -0
- package/dist/vector/types/enums.d.ts +104 -0
- package/dist/vector/types/enums.js +113 -0
- package/dist/vector/types/enums.js.map +1 -0
- package/dist/vector/types/index.d.ts +9 -0
- package/dist/vector/types/index.js +16 -0
- package/dist/vector/types/index.js.map +1 -0
- package/dist/vector/types/vector.interface.d.ts +315 -0
- package/dist/vector/types/vector.interface.js +8 -0
- package/dist/vector/types/vector.interface.js.map +1 -0
- package/dist/vector/utils/index.d.ts +6 -0
- package/dist/vector/utils/index.js +11 -0
- package/dist/vector/utils/index.js.map +1 -0
- package/dist/vector/utils/vector-error.d.ts +69 -0
- package/dist/vector/utils/vector-error.js +116 -0
- package/dist/vector/utils/vector-error.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +408 -0
- package/dist/vector/vector-database.service.js +545 -0
- package/dist/vector/vector-database.service.js.map +1 -0
- package/dist/vector/vector.service.d.ts +245 -0
- package/dist/vector/vector.service.js +384 -0
- package/dist/vector/vector.service.js.map +1 -0
- package/dist/workflows/index.d.ts +30 -0
- package/dist/workflows/index.js +64 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/types/index.d.ts +6 -0
- package/dist/workflows/types/index.js +23 -0
- package/dist/workflows/types/index.js.map +1 -0
- package/dist/workflows/types/workflows.types.d.ts +1035 -0
- package/dist/workflows/types/workflows.types.js +13 -0
- package/dist/workflows/types/workflows.types.js.map +1 -0
- package/dist/workflows/workflow-builder.d.ts +70 -0
- package/dist/workflows/workflow-builder.js +338 -0
- package/dist/workflows/workflow-builder.js.map +1 -0
- package/dist/workflows/workflow-executor.d.ts +208 -0
- package/dist/workflows/workflow-executor.js +1194 -0
- package/dist/workflows/workflow-executor.js.map +1 -0
- package/dist/workflows/workflows.service.d.ts +404 -0
- package/dist/workflows/workflows.service.js +1620 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +54 -11
- package/dist/actions/actions.repo.js +0 -13
- package/dist/actions/actions.repo.js.map +0 -1
- package/dist/actions/actions.service.js +0 -24
- package/dist/actions/actions.service.js.map +0 -1
- package/dist/actions/utils/actions.util.read.js +0 -427
- package/dist/actions/utils/actions.util.read.js.map +0 -1
- package/dist/api/services/integrationsApi.service.d.ts +0 -18
- package/dist/api/services/integrationsApi.service.js +0 -80
- package/dist/api/services/integrationsApi.service.js.map +0 -1
- package/dist/appBuilder/services/app.service.d.ts +0 -111
- package/dist/appBuilder/services/app.service.js +0 -737
- package/dist/appBuilder/services/app.service.js.map +0 -1
- package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
- package/dist/appBuilder/services/appBuilder.service.js +0 -662
- package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
- package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
- package/dist/appBuilder/utils/objects.utils.js +0 -9
- package/dist/appBuilder/utils/objects.utils.js.map +0 -1
- package/dist/appBuilder/utils/string.utils.d.ts +0 -2
- package/dist/appBuilder/utils/string.utils.js +0 -57
- package/dist/appBuilder/utils/string.utils.js.map +0 -1
- package/dist/appBuilder/validators/index.d.ts +0 -19
- package/dist/appBuilder/validators/index.js +0 -40
- package/dist/appBuilder/validators/index.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
- package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/clients/integrations.client.d.ts +0 -2
- package/dist/clients/integrations.client.js +0 -26
- package/dist/clients/integrations.client.js.map +0 -1
- package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
- package/dist/integrationsBuilder/services/integration.service.js +0 -1148
- package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
- package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
- package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
- package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
- package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
- package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
- package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
- package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
- package/dist/integrationsBuilder/utils/string.utils.js +0 -9
- package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
- package/dist/integrationsBuilder/validators/index.d.ts +0 -18
- package/dist/integrationsBuilder/validators/index.js +0 -38
- package/dist/integrationsBuilder/validators/index.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
- package/dist/postman.d.ts +0 -1
- package/dist/postman.js +0 -21674
- package/dist/postman.js.map +0 -1
- package/dist/processor/utils/mongo.util.js +0 -152
- package/dist/processor/utils/mongo.util.js.map +0 -1
- package/dist/processor/utils/postgres.util.d.ts +0 -14
- package/dist/processor/utils/postgres.util.js +0 -83
- package/dist/processor/utils/postgres.util.js.map +0 -1
- package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
- package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
- package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
- package/dist/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- package/dist/test.import.js +0 -24
- package/dist/test.import.js.map +0 -1
- package/dist/test.imports.js +0 -28
- package/dist/test.imports.js.map +0 -1
- package/dist/test.integrationBuilder.js +0 -276
- package/dist/test.integrationBuilder.js.map +0 -1
- package/dist/test.processor.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +0 -1
- package/dist/types/integrationsBuilder.types.d.ts +0 -276
- package/dist/types/integrationsBuilder.types.js +0 -51
- package/dist/types/integrationsBuilder.types.js.map +0 -1
- /package/dist/{actions/actions.repo.d.ts → pricing/pricing.repo.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/create.app.validator.d.ts → products/validators/joi-validators/create.productGraph.validator.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts → products/validators/joi-validators/update.productGraph.validator.d.ts} +0 -0
- /package/dist/{test.appBuilder.d.ts → test/test.broker.kafka.d.ts} +0 -0
- /package/dist/{test.imports.d.ts → test/test.broker.nats.d.ts} +0 -0
- /package/dist/{test.integrationBuilder.d.ts → test/test.broker.pubsub.d.ts} +0 -0
- /package/dist/{test.processor.d.ts → test/test.broker.rabbitmq.d.ts} +0 -0
- /package/dist/{test.utils.d.ts → test/test.broker.redis.d.ts} +0 -0
- /package/dist/{actions/actions.service.d.ts → test/test.health.d.ts} +0 -0
- /package/dist/{actions/utils/actions.util.read.d.ts → test/test.notifiers.d.ts} +0 -0
- /package/dist/{processor/utils/mongo.util.d.ts → test/test.products.d.ts} +0 -0
- /package/dist/{test.import.d.ts → types/request-tracker.interface.d.ts} +0 -0
|
@@ -0,0 +1,1249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agents Service
|
|
4
|
+
*
|
|
5
|
+
* Main service class for agentic workflows operations.
|
|
6
|
+
* Provides CRUD operations and execution for Ductape Agents.
|
|
7
|
+
*
|
|
8
|
+
* Agentic workflows extend Ductape's workflow engine to support AI-driven,
|
|
9
|
+
* autonomous multi-step processes where an LLM dynamically decides the
|
|
10
|
+
* next action based on observations and reasoning.
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.agentsService = exports.AgentsService = exports.AgentError = void 0;
|
|
50
|
+
const crypto_1 = require("crypto");
|
|
51
|
+
const products_service_1 = __importDefault(require("../products/services/products.service"));
|
|
52
|
+
const processor_service_1 = __importDefault(require("../processor/services/processor.service"));
|
|
53
|
+
const logs_service_1 = __importDefault(require("../logs/logs.service"));
|
|
54
|
+
const logs_types_1 = require("../logs/logs.types");
|
|
55
|
+
const processor_utils_1 = require("../processor/utils/processor.utils");
|
|
56
|
+
const productsBuilder_types_1 = require("../types/productsBuilder.types");
|
|
57
|
+
const tool_registry_1 = require("./tool-registry");
|
|
58
|
+
const agent_executor_1 = require("./agent-executor");
|
|
59
|
+
const quota_service_1 = require("../resilience/quota.service");
|
|
60
|
+
const fallback_service_1 = require("../resilience/fallback.service");
|
|
61
|
+
const healthcheck_service_1 = require("../resilience/healthcheck.service");
|
|
62
|
+
const secrets_1 = require("../secrets");
|
|
63
|
+
/**
|
|
64
|
+
* Error class for agent-related errors
|
|
65
|
+
*/
|
|
66
|
+
class AgentError extends Error {
|
|
67
|
+
constructor(message, code, details) {
|
|
68
|
+
super(message);
|
|
69
|
+
this.code = code;
|
|
70
|
+
this.details = details;
|
|
71
|
+
this.name = 'AgentError';
|
|
72
|
+
}
|
|
73
|
+
static configurationError(message) {
|
|
74
|
+
return new AgentError(message, 'CONFIGURATION_ERROR');
|
|
75
|
+
}
|
|
76
|
+
static validationError(message, details) {
|
|
77
|
+
return new AgentError(message, 'VALIDATION_ERROR', details);
|
|
78
|
+
}
|
|
79
|
+
static notFoundError(message) {
|
|
80
|
+
return new AgentError(message, 'NOT_FOUND');
|
|
81
|
+
}
|
|
82
|
+
static executionError(message, details) {
|
|
83
|
+
return new AgentError(message, 'EXECUTION_ERROR', details);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.AgentError = AgentError;
|
|
87
|
+
/**
|
|
88
|
+
* Main Agents Service class
|
|
89
|
+
* Provides unified interface for agent management and execution
|
|
90
|
+
*/
|
|
91
|
+
class AgentsService {
|
|
92
|
+
/**
|
|
93
|
+
* Create a new AgentsService instance
|
|
94
|
+
* @param config - Optional configuration for authentication and workspace context
|
|
95
|
+
*/
|
|
96
|
+
constructor(config) {
|
|
97
|
+
/** Service configuration */
|
|
98
|
+
this.config = null;
|
|
99
|
+
/** ProductBuilder instances cache (keyed by product tag) */
|
|
100
|
+
this.productBuilders = new Map();
|
|
101
|
+
/** Local agent definitions */
|
|
102
|
+
this.localAgents = new Map();
|
|
103
|
+
/** Tool registries per agent */
|
|
104
|
+
this.toolRegistries = new Map();
|
|
105
|
+
/** Active executors (for status/signal handling) */
|
|
106
|
+
this.activeExecutors = new Map();
|
|
107
|
+
/** LogService instance for logging operations */
|
|
108
|
+
this.logService = null;
|
|
109
|
+
/** Current product ID for logging */
|
|
110
|
+
this.productId = '';
|
|
111
|
+
this.config = config || null;
|
|
112
|
+
this._privateKey = config ? config.private_key : '';
|
|
113
|
+
}
|
|
114
|
+
// ==================== CONFIGURATION ====================
|
|
115
|
+
/**
|
|
116
|
+
* Update service configuration
|
|
117
|
+
*/
|
|
118
|
+
updateConfig(config) {
|
|
119
|
+
this.config = config;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get service configuration
|
|
123
|
+
*/
|
|
124
|
+
getConfig() {
|
|
125
|
+
return this.config;
|
|
126
|
+
}
|
|
127
|
+
// ==================== PRODUCT BUILDER MANAGEMENT ====================
|
|
128
|
+
/**
|
|
129
|
+
* Create a new ProductBuilder instance
|
|
130
|
+
*/
|
|
131
|
+
createNewProductBuilder() {
|
|
132
|
+
if (!this.config) {
|
|
133
|
+
throw AgentError.configurationError('AgentsService not configured. Please provide config when initializing.');
|
|
134
|
+
}
|
|
135
|
+
return new products_service_1.default({
|
|
136
|
+
workspace_id: this.config.workspace_id,
|
|
137
|
+
public_key: this.config.public_key,
|
|
138
|
+
user_id: this.config.user_id,
|
|
139
|
+
token: this.config.token,
|
|
140
|
+
env_type: this.config.env_type,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get or create a ProductBuilder instance for the given product tag
|
|
145
|
+
*/
|
|
146
|
+
async getProductBuilder(productTag) {
|
|
147
|
+
let builder = this.productBuilders.get(productTag);
|
|
148
|
+
if (!builder) {
|
|
149
|
+
builder = this.createNewProductBuilder();
|
|
150
|
+
await builder.initializeProductByTag(productTag);
|
|
151
|
+
this.productBuilders.set(productTag, builder);
|
|
152
|
+
this.productId = builder.fetchProductId() || '';
|
|
153
|
+
}
|
|
154
|
+
return builder;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Initialize logging service
|
|
158
|
+
*/
|
|
159
|
+
initializeLogService() {
|
|
160
|
+
if (!this.logService && this.config) {
|
|
161
|
+
this.logService = new logs_service_1.default({
|
|
162
|
+
product_id: this.productId,
|
|
163
|
+
workspace_id: this.config.workspace_id,
|
|
164
|
+
public_key: this.config.public_key,
|
|
165
|
+
user_id: this.config.user_id,
|
|
166
|
+
token: this.config.token,
|
|
167
|
+
env_type: this.config.env_type,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create a new ProcessorService instance
|
|
173
|
+
*/
|
|
174
|
+
createNewProcessor() {
|
|
175
|
+
if (!this.config) {
|
|
176
|
+
throw AgentError.configurationError('AgentsService not configured. Please provide config when initializing.');
|
|
177
|
+
}
|
|
178
|
+
return new processor_service_1.default({
|
|
179
|
+
workspace_id: this.config.workspace_id,
|
|
180
|
+
public_key: this.config.public_key,
|
|
181
|
+
user_id: this.config.user_id,
|
|
182
|
+
token: this.config.token,
|
|
183
|
+
env_type: this.config.env_type,
|
|
184
|
+
redis_client: this.config.redis_client,
|
|
185
|
+
private_key: this._privateKey,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Create a resilience service wrapper for agent operations
|
|
190
|
+
*/
|
|
191
|
+
createResilienceService() {
|
|
192
|
+
if (!this.config) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
const serviceConfig = {
|
|
196
|
+
workspace_id: this.config.workspace_id,
|
|
197
|
+
public_key: this.config.public_key,
|
|
198
|
+
user_id: this.config.user_id,
|
|
199
|
+
token: this.config.token,
|
|
200
|
+
env_type: this.config.env_type,
|
|
201
|
+
private_key: this._privateKey,
|
|
202
|
+
access_key: this.config.access_key,
|
|
203
|
+
};
|
|
204
|
+
// Create individual services
|
|
205
|
+
const quotaService = new quota_service_1.QuotaService(serviceConfig);
|
|
206
|
+
const fallbackService = new fallback_service_1.FallbackService(serviceConfig);
|
|
207
|
+
const healthcheckService = new healthcheck_service_1.HealthcheckService(serviceConfig);
|
|
208
|
+
// Return a wrapper that delegates to the appropriate service
|
|
209
|
+
return {
|
|
210
|
+
async runQuota(options) {
|
|
211
|
+
return quotaService.run({
|
|
212
|
+
product: options.product,
|
|
213
|
+
env: options.env,
|
|
214
|
+
tag: options.tag,
|
|
215
|
+
input: options.input,
|
|
216
|
+
session: options.session,
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
async runFallback(options) {
|
|
220
|
+
return fallbackService.run({
|
|
221
|
+
product: options.product,
|
|
222
|
+
env: options.env,
|
|
223
|
+
tag: options.tag,
|
|
224
|
+
input: options.input,
|
|
225
|
+
session: options.session,
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
async checkHealth(options) {
|
|
229
|
+
return healthcheckService.getStatus({
|
|
230
|
+
product: options.product,
|
|
231
|
+
env: options.env,
|
|
232
|
+
tag: options.tag,
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
async getQuotaStatus(options) {
|
|
236
|
+
// This would need to be implemented in QuotaService
|
|
237
|
+
// For now, return basic status
|
|
238
|
+
return {
|
|
239
|
+
tag: options.tag,
|
|
240
|
+
totalQuota: undefined,
|
|
241
|
+
usedQuota: undefined,
|
|
242
|
+
remainingQuota: undefined,
|
|
243
|
+
providers: [],
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get context services for agent execution
|
|
250
|
+
*/
|
|
251
|
+
getContextServices(resilienceConfig) {
|
|
252
|
+
return {
|
|
253
|
+
config: this.config,
|
|
254
|
+
processorService: this.createNewProcessor(),
|
|
255
|
+
resilienceService: this.createResilienceService(),
|
|
256
|
+
resilienceConfig,
|
|
257
|
+
// Note: These services would be injected from the main Ductape class
|
|
258
|
+
// databaseService, graphService, storageService, brokersService
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// ==================== AGENT DEFINITION ====================
|
|
262
|
+
/**
|
|
263
|
+
* Define a new agent and optionally persist to database
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* // Define and persist to database
|
|
268
|
+
* const agent = await ductape.agents.define({
|
|
269
|
+
* product: 'my-product',
|
|
270
|
+
* tag: 'customer-support',
|
|
271
|
+
* name: 'Customer Support Agent',
|
|
272
|
+
* model: { provider: 'anthropic', model: 'claude-sonnet-4-20250514' },
|
|
273
|
+
* systemPrompt: 'You are a helpful customer support agent...',
|
|
274
|
+
* tools: [
|
|
275
|
+
* {
|
|
276
|
+
* tag: 'lookup-order',
|
|
277
|
+
* description: 'Look up order details',
|
|
278
|
+
* parameters: { orderId: { type: 'string', description: 'Order ID' } },
|
|
279
|
+
* handler: async (ctx, params) => ctx.database.query({ ... }),
|
|
280
|
+
* },
|
|
281
|
+
* ],
|
|
282
|
+
* });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
async define(options) {
|
|
286
|
+
var _a;
|
|
287
|
+
// Validate required fields
|
|
288
|
+
if (!options.tag) {
|
|
289
|
+
throw AgentError.validationError('Agent tag is required');
|
|
290
|
+
}
|
|
291
|
+
if (!options.name) {
|
|
292
|
+
throw AgentError.validationError('Agent name is required');
|
|
293
|
+
}
|
|
294
|
+
if (!options.model) {
|
|
295
|
+
throw AgentError.validationError('Agent model configuration is required');
|
|
296
|
+
}
|
|
297
|
+
if (!options.systemPrompt) {
|
|
298
|
+
throw AgentError.validationError('Agent system prompt is required');
|
|
299
|
+
}
|
|
300
|
+
// Create tool registry
|
|
301
|
+
const toolRegistry = new tool_registry_1.ToolRegistry();
|
|
302
|
+
if (options.tools && options.tools.length > 0) {
|
|
303
|
+
toolRegistry.registerMany(options.tools);
|
|
304
|
+
}
|
|
305
|
+
// Store tool registry (with handlers for local execution)
|
|
306
|
+
this.toolRegistries.set(options.tag, toolRegistry);
|
|
307
|
+
// Get tool schemas (without handlers for storage)
|
|
308
|
+
const toolSchemas = toolRegistry.getSchemas();
|
|
309
|
+
// Create defined agent (without handlers for storage)
|
|
310
|
+
const definedAgent = {
|
|
311
|
+
tag: options.tag,
|
|
312
|
+
name: options.name,
|
|
313
|
+
description: options.description,
|
|
314
|
+
model: options.model,
|
|
315
|
+
modelConfig: options.modelConfig,
|
|
316
|
+
systemPrompt: options.systemPrompt,
|
|
317
|
+
toolSchemas,
|
|
318
|
+
termination: options.termination,
|
|
319
|
+
memory: options.memory,
|
|
320
|
+
humanInLoop: options.humanInLoop,
|
|
321
|
+
streaming: options.streaming,
|
|
322
|
+
inputSchema: options.inputSchema,
|
|
323
|
+
envs: options.envs,
|
|
324
|
+
resilience: options.resilience,
|
|
325
|
+
};
|
|
326
|
+
// Store locally
|
|
327
|
+
this.localAgents.set(options.tag, definedAgent);
|
|
328
|
+
// If product is specified, persist to database
|
|
329
|
+
if (options.product) {
|
|
330
|
+
try {
|
|
331
|
+
const productBuilder = await this.getProductBuilder(options.product);
|
|
332
|
+
// Convert to IProductAgent format for storage
|
|
333
|
+
const productAgent = {
|
|
334
|
+
tag: options.tag,
|
|
335
|
+
name: options.name,
|
|
336
|
+
description: options.description,
|
|
337
|
+
model: options.model, // Model is a tag reference to product-level model config
|
|
338
|
+
modelConfig: options.modelConfig,
|
|
339
|
+
systemPrompt: options.systemPrompt,
|
|
340
|
+
tools: toolSchemas.map((schema) => ({
|
|
341
|
+
tag: schema.tag,
|
|
342
|
+
name: schema.name,
|
|
343
|
+
description: schema.description,
|
|
344
|
+
parameters: schema.parameters,
|
|
345
|
+
requiresConfirmation: schema.requiresConfirmation,
|
|
346
|
+
costEstimate: schema.costEstimate,
|
|
347
|
+
timeout: schema.timeout,
|
|
348
|
+
retries: schema.retries,
|
|
349
|
+
})),
|
|
350
|
+
termination: options.termination ? {
|
|
351
|
+
maxIterations: options.termination.maxIterations,
|
|
352
|
+
maxTokens: options.termination.maxTokens,
|
|
353
|
+
timeout: typeof options.termination.timeout === 'string'
|
|
354
|
+
? parseInt(options.termination.timeout)
|
|
355
|
+
: options.termination.timeout,
|
|
356
|
+
allowManualStop: options.termination.allowManualStop,
|
|
357
|
+
} : undefined,
|
|
358
|
+
memory: options.memory ? {
|
|
359
|
+
shortTerm: options.memory.shortTerm,
|
|
360
|
+
longTerm: options.memory.longTerm,
|
|
361
|
+
} : undefined,
|
|
362
|
+
humanInLoop: options.humanInLoop ? {
|
|
363
|
+
enabled: options.humanInLoop.enabled,
|
|
364
|
+
alwaysRequireApproval: options.humanInLoop.alwaysRequireApproval,
|
|
365
|
+
approvalTimeout: typeof options.humanInLoop.approvalTimeout === 'string'
|
|
366
|
+
? parseInt(options.humanInLoop.approvalTimeout)
|
|
367
|
+
: options.humanInLoop.approvalTimeout,
|
|
368
|
+
approvalWebhook: options.humanInLoop.approvalWebhook,
|
|
369
|
+
approvalBroker: options.humanInLoop.approvalBroker,
|
|
370
|
+
} : undefined,
|
|
371
|
+
streaming: options.streaming ? {
|
|
372
|
+
enabled: options.streaming.enabled,
|
|
373
|
+
events: options.streaming.events,
|
|
374
|
+
webhook: options.streaming.webhook,
|
|
375
|
+
broker: options.streaming.broker,
|
|
376
|
+
} : undefined,
|
|
377
|
+
inputSchema: options.inputSchema,
|
|
378
|
+
envs: (_a = options.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
|
|
379
|
+
slug: env.slug,
|
|
380
|
+
active: env.active,
|
|
381
|
+
model: env.model, // Model tag override for this environment
|
|
382
|
+
modelConfig: env.modelConfig,
|
|
383
|
+
toolOverrides: env.toolOverrides,
|
|
384
|
+
})),
|
|
385
|
+
resilience: options.resilience,
|
|
386
|
+
};
|
|
387
|
+
await productBuilder.createAgent(productAgent);
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
// Log but don't fail - agent is still stored locally
|
|
391
|
+
console.warn(`Failed to persist agent to database: ${error}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return definedAgent;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Register a defined agent with a product (persists to database)
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* await ductape.agents.register('my-product', agent);
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
async register(product, agent) {
|
|
405
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
406
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
407
|
+
// Initialize logging
|
|
408
|
+
await this.getProductBuilder(product);
|
|
409
|
+
this.initializeLogService();
|
|
410
|
+
const baseLogs = {
|
|
411
|
+
product_tag: product,
|
|
412
|
+
workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
|
|
413
|
+
env: '',
|
|
414
|
+
process_id,
|
|
415
|
+
type: logs_types_1.LogEventTypes.WORKFLOW,
|
|
416
|
+
parent_tag: agent.tag,
|
|
417
|
+
data: { agent: agent.tag, operation: 'register' },
|
|
418
|
+
};
|
|
419
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
420
|
+
try {
|
|
421
|
+
const productBuilder = await this.getProductBuilder(product);
|
|
422
|
+
// Convert to IProductAgent format and persist to database
|
|
423
|
+
const productAgent = {
|
|
424
|
+
tag: agent.tag,
|
|
425
|
+
name: agent.name,
|
|
426
|
+
description: agent.description,
|
|
427
|
+
model: agent.model, // Model is a tag reference to product-level model config
|
|
428
|
+
modelConfig: agent.modelConfig,
|
|
429
|
+
systemPrompt: agent.systemPrompt,
|
|
430
|
+
tools: agent.toolSchemas.map((schema) => ({
|
|
431
|
+
tag: schema.tag,
|
|
432
|
+
name: schema.name,
|
|
433
|
+
description: schema.description,
|
|
434
|
+
parameters: schema.parameters,
|
|
435
|
+
requiresConfirmation: schema.requiresConfirmation,
|
|
436
|
+
costEstimate: schema.costEstimate,
|
|
437
|
+
timeout: schema.timeout,
|
|
438
|
+
retries: schema.retries,
|
|
439
|
+
})),
|
|
440
|
+
termination: agent.termination ? {
|
|
441
|
+
maxIterations: agent.termination.maxIterations,
|
|
442
|
+
maxTokens: agent.termination.maxTokens,
|
|
443
|
+
timeout: typeof agent.termination.timeout === 'string'
|
|
444
|
+
? parseInt(agent.termination.timeout)
|
|
445
|
+
: agent.termination.timeout,
|
|
446
|
+
allowManualStop: agent.termination.allowManualStop,
|
|
447
|
+
} : undefined,
|
|
448
|
+
memory: agent.memory ? {
|
|
449
|
+
shortTerm: agent.memory.shortTerm,
|
|
450
|
+
longTerm: agent.memory.longTerm,
|
|
451
|
+
} : undefined,
|
|
452
|
+
humanInLoop: agent.humanInLoop ? {
|
|
453
|
+
enabled: agent.humanInLoop.enabled,
|
|
454
|
+
alwaysRequireApproval: agent.humanInLoop.alwaysRequireApproval,
|
|
455
|
+
approvalTimeout: typeof agent.humanInLoop.approvalTimeout === 'string'
|
|
456
|
+
? parseInt(agent.humanInLoop.approvalTimeout)
|
|
457
|
+
: agent.humanInLoop.approvalTimeout,
|
|
458
|
+
approvalWebhook: agent.humanInLoop.approvalWebhook,
|
|
459
|
+
approvalBroker: agent.humanInLoop.approvalBroker,
|
|
460
|
+
} : undefined,
|
|
461
|
+
streaming: agent.streaming ? {
|
|
462
|
+
enabled: agent.streaming.enabled,
|
|
463
|
+
events: agent.streaming.events,
|
|
464
|
+
webhook: agent.streaming.webhook,
|
|
465
|
+
broker: agent.streaming.broker,
|
|
466
|
+
} : undefined,
|
|
467
|
+
inputSchema: agent.inputSchema,
|
|
468
|
+
envs: (_c = agent.envs) === null || _c === void 0 ? void 0 : _c.map((env) => ({
|
|
469
|
+
slug: env.slug,
|
|
470
|
+
active: env.active,
|
|
471
|
+
model: env.model, // Model tag override for this environment
|
|
472
|
+
modelConfig: env.modelConfig,
|
|
473
|
+
toolOverrides: env.toolOverrides,
|
|
474
|
+
})),
|
|
475
|
+
resilience: agent.resilience,
|
|
476
|
+
};
|
|
477
|
+
await productBuilder.createAgent(productAgent);
|
|
478
|
+
// Also store locally for immediate execution
|
|
479
|
+
this.localAgents.set(agent.tag, agent);
|
|
480
|
+
(_d = this.logService) === null || _d === void 0 ? void 0 : _d.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
481
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.publish();
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent register - failed', failed_execution: true, data: { agent: agent.tag, operation: 'register', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
485
|
+
await ((_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish());
|
|
486
|
+
throw AgentError.executionError(`Failed to register agent: ${error}`, { agent: agent.tag });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
// ==================== AGENT EXECUTION ====================
|
|
490
|
+
/**
|
|
491
|
+
* Run an agent
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```ts
|
|
495
|
+
* const result = await ductape.agents.run({
|
|
496
|
+
* product: 'my-product',
|
|
497
|
+
* env: 'production',
|
|
498
|
+
* tag: 'customer-support',
|
|
499
|
+
* input: {
|
|
500
|
+
* ticketId: 'TICKET-123',
|
|
501
|
+
* message: 'I need help with my order',
|
|
502
|
+
* },
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
async run(options) {
|
|
507
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
508
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
509
|
+
const startTime = Date.now();
|
|
510
|
+
// Session log fields (will be populated if session is provided)
|
|
511
|
+
let sessionLogFields = {};
|
|
512
|
+
let resolvedOptions = options;
|
|
513
|
+
// Initialize logging
|
|
514
|
+
const productBuilder = await this.getProductBuilder(options.product);
|
|
515
|
+
this.initializeLogService();
|
|
516
|
+
// Process session if provided - verify and resolve $Session{} references
|
|
517
|
+
if (options.session) {
|
|
518
|
+
const privateKey = productBuilder.fetchPrivateKey();
|
|
519
|
+
if (privateKey) {
|
|
520
|
+
const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
|
|
521
|
+
const sessionResult = await processSessionForExecution(options.session, privateKey, options, options.env);
|
|
522
|
+
if (sessionResult.error) {
|
|
523
|
+
throw AgentError.executionError(`Session validation failed: ${sessionResult.error}`);
|
|
524
|
+
}
|
|
525
|
+
resolvedOptions = sessionResult.input;
|
|
526
|
+
sessionLogFields = sessionResult.logFields;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
const baseLogs = Object.assign({ product_tag: options.product, workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '', env: options.env, process_id, type: logs_types_1.LogEventTypes.WORKFLOW, parent_tag: options.tag, data: { agent: options.tag, operation: 'run' } }, sessionLogFields);
|
|
530
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
531
|
+
try {
|
|
532
|
+
// Get agent definition - first check local, then fetch from database
|
|
533
|
+
let agent = this.localAgents.get(resolvedOptions.tag);
|
|
534
|
+
let toolRegistry = this.toolRegistries.get(resolvedOptions.tag);
|
|
535
|
+
if (!agent) {
|
|
536
|
+
// Try to fetch from database
|
|
537
|
+
const storedAgent = await productBuilder.fetchAgent(resolvedOptions.tag);
|
|
538
|
+
if (!storedAgent) {
|
|
539
|
+
throw AgentError.notFoundError(`Agent '${resolvedOptions.tag}' not found`);
|
|
540
|
+
}
|
|
541
|
+
// Convert IProductAgent to IDefinedAgent
|
|
542
|
+
agent = this.convertProductAgentToDefinedAgent(storedAgent);
|
|
543
|
+
// Store locally for future use
|
|
544
|
+
this.localAgents.set(resolvedOptions.tag, agent);
|
|
545
|
+
// Create tool registry from stored schemas (without handlers)
|
|
546
|
+
toolRegistry = new tool_registry_1.ToolRegistry();
|
|
547
|
+
// Note: Tools from database won't have handlers - they need handlerRef or runtime registration
|
|
548
|
+
for (const tool of storedAgent.tools || []) {
|
|
549
|
+
toolRegistry.register({
|
|
550
|
+
tag: tool.tag,
|
|
551
|
+
name: tool.name,
|
|
552
|
+
description: tool.description,
|
|
553
|
+
parameters: tool.parameters,
|
|
554
|
+
requiresConfirmation: tool.requiresConfirmation,
|
|
555
|
+
costEstimate: tool.costEstimate,
|
|
556
|
+
timeout: tool.timeout,
|
|
557
|
+
retries: tool.retries,
|
|
558
|
+
// Handler will need to be resolved from handlerRef or provided at runtime
|
|
559
|
+
handler: tool.handlerRef
|
|
560
|
+
? this.createHandlerFromRef(tool.handlerRef, resolvedOptions.product, resolvedOptions.env)
|
|
561
|
+
: async () => { throw new Error(`No handler for tool '${tool.tag}'. Provide handlerRef or register handler at runtime.`); },
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
this.toolRegistries.set(resolvedOptions.tag, toolRegistry);
|
|
565
|
+
}
|
|
566
|
+
if (!toolRegistry) {
|
|
567
|
+
throw AgentError.notFoundError(`Tool registry for agent '${resolvedOptions.tag}' not found`);
|
|
568
|
+
}
|
|
569
|
+
// Resolve model config from the model tag
|
|
570
|
+
const modelConfig = await productBuilder.fetchModel(agent.model);
|
|
571
|
+
if (!modelConfig) {
|
|
572
|
+
throw AgentError.notFoundError(`Model '${agent.model}' not found`);
|
|
573
|
+
}
|
|
574
|
+
// Find the env-specific config
|
|
575
|
+
const envConfig = modelConfig.envs.find(e => e.slug === resolvedOptions.env);
|
|
576
|
+
if (!envConfig) {
|
|
577
|
+
throw AgentError.configurationError(`Model '${agent.model}' has no configuration for environment '${resolvedOptions.env}'`);
|
|
578
|
+
}
|
|
579
|
+
// Decrypt API key using product private key, or resolve secret reference
|
|
580
|
+
const privateKey = productBuilder.fetchPrivateKey();
|
|
581
|
+
let apiKey = envConfig.apiKey;
|
|
582
|
+
if (apiKey) {
|
|
583
|
+
// Check if it's a secret reference
|
|
584
|
+
if ((0, secrets_1.isSecretReference)(apiKey).isSecret) {
|
|
585
|
+
const secretsService = (0, secrets_1.getSecretsService)();
|
|
586
|
+
if (secretsService) {
|
|
587
|
+
const resolved = await secretsService.resolve(apiKey, { env: resolvedOptions.env });
|
|
588
|
+
apiKey = resolved.value;
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
throw AgentError.configurationError(`Model API key contains secret reference '${apiKey}' but secrets service is not initialized. ` +
|
|
592
|
+
`Please ensure the Ductape client is properly initialized.`);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else if (privateKey) {
|
|
596
|
+
// Try to decrypt if it's not a secret reference
|
|
597
|
+
try {
|
|
598
|
+
const { decrypt } = await Promise.resolve().then(() => __importStar(require('../processor/utils/processor.utils')));
|
|
599
|
+
apiKey = decrypt(apiKey, privateKey);
|
|
600
|
+
}
|
|
601
|
+
catch (e) {
|
|
602
|
+
// If decryption fails, try using the key as-is (might be unencrypted in dev)
|
|
603
|
+
console.warn('Failed to decrypt model API key, using as-is');
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
// Also resolve any secret references in baseUrl
|
|
608
|
+
let baseUrl = envConfig.baseUrl;
|
|
609
|
+
if (baseUrl && (0, secrets_1.isSecretReference)(baseUrl).isSecret) {
|
|
610
|
+
const secretsService = (0, secrets_1.getSecretsService)();
|
|
611
|
+
if (secretsService) {
|
|
612
|
+
const resolved = await secretsService.resolve(baseUrl, { env: resolvedOptions.env });
|
|
613
|
+
baseUrl = resolved.value;
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
throw AgentError.configurationError(`Model baseUrl contains secret reference but secrets service is not initialized.`);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
// Get environment-specific agent config if available
|
|
620
|
+
const agentEnvConfig = (_c = agent.envs) === null || _c === void 0 ? void 0 : _c.find(e => e.slug === resolvedOptions.env);
|
|
621
|
+
// Build the resolved LLM config with overrides
|
|
622
|
+
// Precedence: model entity < agent.modelConfig < agentEnvConfig.modelConfig < resolvedOptions.modelConfig
|
|
623
|
+
const resolvedModelConfig = {
|
|
624
|
+
provider: modelConfig.provider,
|
|
625
|
+
model: modelConfig.model,
|
|
626
|
+
// Start with model entity values, then apply overrides
|
|
627
|
+
temperature: (_j = (_g = (_e = (_d = resolvedOptions.modelConfig) === null || _d === void 0 ? void 0 : _d.temperature) !== null && _e !== void 0 ? _e : (_f = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _f === void 0 ? void 0 : _f.temperature) !== null && _g !== void 0 ? _g : (_h = agent.modelConfig) === null || _h === void 0 ? void 0 : _h.temperature) !== null && _j !== void 0 ? _j : modelConfig.temperature,
|
|
628
|
+
maxTokens: (_q = (_o = (_l = (_k = resolvedOptions.modelConfig) === null || _k === void 0 ? void 0 : _k.maxTokens) !== null && _l !== void 0 ? _l : (_m = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _m === void 0 ? void 0 : _m.maxTokens) !== null && _o !== void 0 ? _o : (_p = agent.modelConfig) === null || _p === void 0 ? void 0 : _p.maxTokens) !== null && _q !== void 0 ? _q : modelConfig.maxTokens,
|
|
629
|
+
topP: (_w = (_u = (_s = (_r = resolvedOptions.modelConfig) === null || _r === void 0 ? void 0 : _r.topP) !== null && _s !== void 0 ? _s : (_t = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _t === void 0 ? void 0 : _t.topP) !== null && _u !== void 0 ? _u : (_v = agent.modelConfig) === null || _v === void 0 ? void 0 : _v.topP) !== null && _w !== void 0 ? _w : modelConfig.topP,
|
|
630
|
+
stopSequences: (_2 = (_0 = (_y = (_x = resolvedOptions.modelConfig) === null || _x === void 0 ? void 0 : _x.stopSequences) !== null && _y !== void 0 ? _y : (_z = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _z === void 0 ? void 0 : _z.stopSequences) !== null && _0 !== void 0 ? _0 : (_1 = agent.modelConfig) === null || _1 === void 0 ? void 0 : _1.stopSequences) !== null && _2 !== void 0 ? _2 : modelConfig.stopSequences,
|
|
631
|
+
timeout: (_8 = (_6 = (_4 = (_3 = resolvedOptions.modelConfig) === null || _3 === void 0 ? void 0 : _3.timeout) !== null && _4 !== void 0 ? _4 : (_5 = agentEnvConfig === null || agentEnvConfig === void 0 ? void 0 : agentEnvConfig.modelConfig) === null || _5 === void 0 ? void 0 : _5.timeout) !== null && _6 !== void 0 ? _6 : (_7 = agent.modelConfig) === null || _7 === void 0 ? void 0 : _7.timeout) !== null && _8 !== void 0 ? _8 : modelConfig.timeout,
|
|
632
|
+
apiKey,
|
|
633
|
+
baseUrl,
|
|
634
|
+
};
|
|
635
|
+
// Create executor with resolved model config
|
|
636
|
+
const executor = new agent_executor_1.AgentExecutor(agent, toolRegistry, this.getContextServices(agent.resilience), resolvedOptions, (0, agent_executor_1.createLLMProvider)(resolvedModelConfig), resolvedModelConfig);
|
|
637
|
+
// Store executor for signal handling
|
|
638
|
+
const executionId = executor.getState().execution_id;
|
|
639
|
+
this.activeExecutors.set(executionId, executor);
|
|
640
|
+
// Execute agent
|
|
641
|
+
const result = await executor.execute();
|
|
642
|
+
// Cleanup
|
|
643
|
+
this.activeExecutors.delete(executionId);
|
|
644
|
+
(_9 = this.logService) === null || _9 === void 0 ? void 0 : _9.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - success', successful_execution: result.status === 'completed', failed_execution: result.status === 'failed', data: {
|
|
645
|
+
agent: resolvedOptions.tag,
|
|
646
|
+
operation: 'run',
|
|
647
|
+
execution_id: result.execution_id,
|
|
648
|
+
iterations: result.iterations,
|
|
649
|
+
status: result.status,
|
|
650
|
+
}, status: result.status === 'completed' ? logs_types_1.LogEventStatus.SUCCESS : logs_types_1.LogEventStatus.FAIL }));
|
|
651
|
+
(_10 = this.logService) === null || _10 === void 0 ? void 0 : _10.publish();
|
|
652
|
+
return result;
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
(_11 = this.logService) === null || _11 === void 0 ? void 0 : _11.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent run - failed', failed_execution: true, data: { agent: resolvedOptions.tag, operation: 'run', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
656
|
+
await ((_12 = this.logService) === null || _12 === void 0 ? void 0 : _12.publish());
|
|
657
|
+
throw AgentError.executionError(`Failed to run agent: ${error}`, { agent: resolvedOptions.tag });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
// ==================== DISPATCH (SCHEDULED EXECUTION) ====================
|
|
661
|
+
/**
|
|
662
|
+
* Dispatch an agent for scheduled or deferred execution
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* ```ts
|
|
666
|
+
* const job = await ductape.agents.dispatch({
|
|
667
|
+
* product: 'my-product',
|
|
668
|
+
* env: 'production',
|
|
669
|
+
* agent: 'daily-report-agent',
|
|
670
|
+
* input: { reportType: 'daily' },
|
|
671
|
+
* schedule: { cron: '0 9 * * *' }, // Daily at 9 AM
|
|
672
|
+
* });
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
async dispatch(options) {
|
|
676
|
+
var _a, _b, _c, _d, _e, _f;
|
|
677
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
678
|
+
const processorService = this.createNewProcessor();
|
|
679
|
+
const productBuilder = await this.getProductBuilder(options.product);
|
|
680
|
+
const schedule = options.schedule || {};
|
|
681
|
+
const startAt = typeof schedule.start_at === 'string'
|
|
682
|
+
? new Date(schedule.start_at).getTime()
|
|
683
|
+
: schedule.start_at || Date.now();
|
|
684
|
+
const jobTag = `agent:${options.agent}`;
|
|
685
|
+
// Initialize logging
|
|
686
|
+
this.initializeLogService();
|
|
687
|
+
const baseLogs = {
|
|
688
|
+
product_tag: options.product,
|
|
689
|
+
workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
|
|
690
|
+
env: options.env,
|
|
691
|
+
process_id,
|
|
692
|
+
type: logs_types_1.LogEventTypes.WORKFLOW,
|
|
693
|
+
parent_tag: options.agent,
|
|
694
|
+
data: { agent: options.agent, operation: 'dispatch' },
|
|
695
|
+
};
|
|
696
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
697
|
+
try {
|
|
698
|
+
// Check if job exists, if not create it
|
|
699
|
+
const existingJob = await productBuilder.fetchJob(jobTag);
|
|
700
|
+
if (!existingJob) {
|
|
701
|
+
await productBuilder.createJob({
|
|
702
|
+
tag: jobTag,
|
|
703
|
+
name: `Agent: ${options.agent}`,
|
|
704
|
+
description: `Auto-created job for agent ${options.agent}`,
|
|
705
|
+
type: productsBuilder_types_1.JobEventTypes.ACTION, // Agent executions are actions
|
|
706
|
+
app: options.agent,
|
|
707
|
+
event: 'execute',
|
|
708
|
+
executions: 0,
|
|
709
|
+
intervals: schedule.every || 0,
|
|
710
|
+
start_at: startAt,
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
const jobInput = {
|
|
714
|
+
product: options.product,
|
|
715
|
+
env: options.env,
|
|
716
|
+
event: jobTag,
|
|
717
|
+
input: options.input,
|
|
718
|
+
retries: options.retries || 0,
|
|
719
|
+
start_at: startAt,
|
|
720
|
+
session: options.session,
|
|
721
|
+
cache: options.cache,
|
|
722
|
+
repeat: schedule.cron || schedule.every
|
|
723
|
+
? {
|
|
724
|
+
cron: schedule.cron,
|
|
725
|
+
every: schedule.every,
|
|
726
|
+
limit: schedule.limit,
|
|
727
|
+
endDate: schedule.endDate,
|
|
728
|
+
tz: schedule.tz,
|
|
729
|
+
}
|
|
730
|
+
: undefined,
|
|
731
|
+
};
|
|
732
|
+
await processorService.processJob(jobInput);
|
|
733
|
+
const isRecurring = !!(schedule.cron || schedule.every);
|
|
734
|
+
let nextRunAt;
|
|
735
|
+
if (isRecurring && schedule.every) {
|
|
736
|
+
nextRunAt = startAt + schedule.every;
|
|
737
|
+
}
|
|
738
|
+
const job_id = (0, crypto_1.randomUUID)();
|
|
739
|
+
(_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - success', successful_execution: true, data: { agent: options.agent, operation: 'dispatch', job_id }, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
740
|
+
(_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish();
|
|
741
|
+
return {
|
|
742
|
+
job_id,
|
|
743
|
+
status: startAt > Date.now() ? 'scheduled' : 'queued',
|
|
744
|
+
scheduled_at: startAt,
|
|
745
|
+
recurring: isRecurring,
|
|
746
|
+
next_run_at: nextRunAt,
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
catch (error) {
|
|
750
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Agent dispatch - failed', failed_execution: true, data: { agent: options.agent, operation: 'dispatch', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
751
|
+
await ((_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish());
|
|
752
|
+
throw error;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
// ==================== SIGNALS ====================
|
|
756
|
+
/**
|
|
757
|
+
* Send a signal to a running agent
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* // Stop an agent
|
|
762
|
+
* await ductape.agents.signal({
|
|
763
|
+
* product: 'my-product',
|
|
764
|
+
* env: 'production',
|
|
765
|
+
* execution_id: 'exec-123',
|
|
766
|
+
* signal: 'stop',
|
|
767
|
+
* });
|
|
768
|
+
*
|
|
769
|
+
* // Approve a tool call
|
|
770
|
+
* await ductape.agents.signal({
|
|
771
|
+
* product: 'my-product',
|
|
772
|
+
* env: 'production',
|
|
773
|
+
* execution_id: 'exec-123',
|
|
774
|
+
* signal: 'approve',
|
|
775
|
+
* payload: { toolCallId: 'tc-456' },
|
|
776
|
+
* });
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
779
|
+
async signal(options) {
|
|
780
|
+
const executor = this.activeExecutors.get(options.execution_id);
|
|
781
|
+
if (!executor) {
|
|
782
|
+
throw AgentError.notFoundError(`Agent execution '${options.execution_id}' not found or not active`);
|
|
783
|
+
}
|
|
784
|
+
switch (options.signal) {
|
|
785
|
+
case 'stop':
|
|
786
|
+
executor.handleStop();
|
|
787
|
+
break;
|
|
788
|
+
case 'pause':
|
|
789
|
+
executor.handlePause();
|
|
790
|
+
break;
|
|
791
|
+
case 'resume':
|
|
792
|
+
executor.handleResume();
|
|
793
|
+
break;
|
|
794
|
+
case 'approve':
|
|
795
|
+
executor.handleApproval(true, options.payload);
|
|
796
|
+
break;
|
|
797
|
+
case 'reject':
|
|
798
|
+
executor.handleApproval(false);
|
|
799
|
+
break;
|
|
800
|
+
default:
|
|
801
|
+
throw AgentError.validationError(`Unknown signal: ${options.signal}`);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
// ==================== STATUS ====================
|
|
805
|
+
/**
|
|
806
|
+
* Get the status of an agent execution
|
|
807
|
+
*
|
|
808
|
+
* @example
|
|
809
|
+
* ```ts
|
|
810
|
+
* const status = await ductape.agents.status({
|
|
811
|
+
* product: 'my-product',
|
|
812
|
+
* env: 'production',
|
|
813
|
+
* execution_id: 'exec-123',
|
|
814
|
+
* });
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
async status(options) {
|
|
818
|
+
const executor = this.activeExecutors.get(options.execution_id);
|
|
819
|
+
if (!executor) {
|
|
820
|
+
// Could query from database for completed executions
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
return executor.getState();
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* List agent executions
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* ```ts
|
|
830
|
+
* const executions = await ductape.agents.list({
|
|
831
|
+
* product: 'my-product',
|
|
832
|
+
* env: 'production',
|
|
833
|
+
* agent: 'customer-support',
|
|
834
|
+
* status: 'completed',
|
|
835
|
+
* limit: 10,
|
|
836
|
+
* });
|
|
837
|
+
* ```
|
|
838
|
+
*/
|
|
839
|
+
async list(options) {
|
|
840
|
+
// For now, return active executions
|
|
841
|
+
// In production, would query from database
|
|
842
|
+
const executions = [];
|
|
843
|
+
for (const [executionId, executor] of this.activeExecutors) {
|
|
844
|
+
const state = executor.getState();
|
|
845
|
+
// Apply filters
|
|
846
|
+
if (options.agent && state.agent_tag !== options.agent) {
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
if (options.status) {
|
|
850
|
+
const statuses = Array.isArray(options.status) ? options.status : [options.status];
|
|
851
|
+
if (!statuses.includes(state.status)) {
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
executions.push({
|
|
856
|
+
execution_id: state.execution_id,
|
|
857
|
+
agent_tag: state.agent_tag,
|
|
858
|
+
status: state.status,
|
|
859
|
+
startedAt: state.startedAt,
|
|
860
|
+
completedAt: state.status !== 'running' ? state.updatedAt : undefined,
|
|
861
|
+
iterations: state.iteration,
|
|
862
|
+
usage: state.usage,
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
// Pagination
|
|
866
|
+
const page = options.page || 1;
|
|
867
|
+
const limit = options.limit || 10;
|
|
868
|
+
const start = (page - 1) * limit;
|
|
869
|
+
const paginatedExecutions = executions.slice(start, start + limit);
|
|
870
|
+
return {
|
|
871
|
+
executions: paginatedExecutions,
|
|
872
|
+
total: executions.length,
|
|
873
|
+
page,
|
|
874
|
+
limit,
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
// ==================== TOOL MANAGEMENT ====================
|
|
878
|
+
/**
|
|
879
|
+
* Add a tool to an agent
|
|
880
|
+
*
|
|
881
|
+
* @example
|
|
882
|
+
* ```ts
|
|
883
|
+
* await ductape.agents.addTool('customer-support', {
|
|
884
|
+
* tag: 'new-tool',
|
|
885
|
+
* description: 'A new tool',
|
|
886
|
+
* parameters: { ... },
|
|
887
|
+
* handler: async (ctx, params) => { ... },
|
|
888
|
+
* });
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
891
|
+
addTool(agentTag, tool) {
|
|
892
|
+
const registry = this.toolRegistries.get(agentTag);
|
|
893
|
+
if (!registry) {
|
|
894
|
+
throw AgentError.notFoundError(`Agent '${agentTag}' not found`);
|
|
895
|
+
}
|
|
896
|
+
registry.register(tool);
|
|
897
|
+
// Update agent definition
|
|
898
|
+
const agent = this.localAgents.get(agentTag);
|
|
899
|
+
if (agent) {
|
|
900
|
+
agent.toolSchemas = registry.getSchemas();
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Remove a tool from an agent
|
|
905
|
+
*/
|
|
906
|
+
removeTool(agentTag, toolTag) {
|
|
907
|
+
const registry = this.toolRegistries.get(agentTag);
|
|
908
|
+
if (!registry) {
|
|
909
|
+
return false;
|
|
910
|
+
}
|
|
911
|
+
const removed = registry.unregister(toolTag);
|
|
912
|
+
// Update agent definition
|
|
913
|
+
if (removed) {
|
|
914
|
+
const agent = this.localAgents.get(agentTag);
|
|
915
|
+
if (agent) {
|
|
916
|
+
agent.toolSchemas = registry.getSchemas();
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return removed;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Get tools for an agent
|
|
923
|
+
*/
|
|
924
|
+
getTools(agentTag) {
|
|
925
|
+
const registry = this.toolRegistries.get(agentTag);
|
|
926
|
+
if (!registry) {
|
|
927
|
+
return [];
|
|
928
|
+
}
|
|
929
|
+
return registry.getSchemas();
|
|
930
|
+
}
|
|
931
|
+
// ==================== AGENT AS TOOL ====================
|
|
932
|
+
/**
|
|
933
|
+
* Convert an agent into a tool that can be used by another agent
|
|
934
|
+
*
|
|
935
|
+
* This enables multi-agent orchestration where a "manager" agent can
|
|
936
|
+
* delegate tasks to specialized agents.
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```ts
|
|
940
|
+
* // Define specialized agents
|
|
941
|
+
* const researchAgent = await ductape.agents.define({
|
|
942
|
+
* tag: 'research-agent',
|
|
943
|
+
* name: 'Research Agent',
|
|
944
|
+
* // ...
|
|
945
|
+
* });
|
|
946
|
+
*
|
|
947
|
+
* const writerAgent = await ductape.agents.define({
|
|
948
|
+
* tag: 'writer-agent',
|
|
949
|
+
* name: 'Writer Agent',
|
|
950
|
+
* // ...
|
|
951
|
+
* });
|
|
952
|
+
*
|
|
953
|
+
* // Create a manager agent that can delegate to specialists
|
|
954
|
+
* const managerAgent = await ductape.agents.define({
|
|
955
|
+
* tag: 'manager-agent',
|
|
956
|
+
* name: 'Project Manager',
|
|
957
|
+
* tools: [
|
|
958
|
+
* ductape.agents.asTool({
|
|
959
|
+
* agentTag: 'research-agent',
|
|
960
|
+
* product: 'my-product',
|
|
961
|
+
* options: {
|
|
962
|
+
* toolDescription: 'Delegate research tasks to the research specialist',
|
|
963
|
+
* },
|
|
964
|
+
* }),
|
|
965
|
+
* ductape.agents.asTool({
|
|
966
|
+
* agentTag: 'writer-agent',
|
|
967
|
+
* product: 'my-product',
|
|
968
|
+
* options: {
|
|
969
|
+
* toolDescription: 'Delegate writing tasks to the writing specialist',
|
|
970
|
+
* },
|
|
971
|
+
* }),
|
|
972
|
+
* ],
|
|
973
|
+
* });
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
asTool(definition) {
|
|
977
|
+
const { agentTag, product, env, options = {} } = definition;
|
|
978
|
+
// Get the agent definition to extract metadata
|
|
979
|
+
const agent = this.localAgents.get(agentTag);
|
|
980
|
+
// Build input schema - either from options or use a generic input schema
|
|
981
|
+
const inputSchema = options.inputSchema || {
|
|
982
|
+
task: {
|
|
983
|
+
type: 'string',
|
|
984
|
+
description: 'The task or instruction to give to the agent',
|
|
985
|
+
required: true,
|
|
986
|
+
},
|
|
987
|
+
context: {
|
|
988
|
+
type: 'object',
|
|
989
|
+
description: 'Additional context or data to pass to the agent',
|
|
990
|
+
},
|
|
991
|
+
};
|
|
992
|
+
// Create the tool
|
|
993
|
+
const tool = {
|
|
994
|
+
tag: options.toolTag || `agent:${agentTag}`,
|
|
995
|
+
name: options.toolName || (agent === null || agent === void 0 ? void 0 : agent.name) || agentTag,
|
|
996
|
+
description: options.toolDescription ||
|
|
997
|
+
(agent === null || agent === void 0 ? void 0 : agent.description) ||
|
|
998
|
+
`Delegate task to the ${agentTag} agent`,
|
|
999
|
+
parameters: inputSchema,
|
|
1000
|
+
requiresConfirmation: options.requiresConfirmation,
|
|
1001
|
+
timeout: options.timeout,
|
|
1002
|
+
retries: options.retries,
|
|
1003
|
+
handler: async (ctx, params) => {
|
|
1004
|
+
var _a;
|
|
1005
|
+
// Transform input if transformer provided
|
|
1006
|
+
const input = options.inputTransform
|
|
1007
|
+
? options.inputTransform(params)
|
|
1008
|
+
: params;
|
|
1009
|
+
// Build the input message for the sub-agent
|
|
1010
|
+
const inputMessage = typeof input === 'string'
|
|
1011
|
+
? input
|
|
1012
|
+
: input.task ||
|
|
1013
|
+
JSON.stringify(input);
|
|
1014
|
+
// Run the sub-agent
|
|
1015
|
+
// When delegating to sub-agent, append agent tag to session for traceability
|
|
1016
|
+
const subAgentSession = ctx.session ? `${ctx.session}:${agentTag}` : undefined;
|
|
1017
|
+
const result = await this.run({
|
|
1018
|
+
product,
|
|
1019
|
+
env: env || ctx.env,
|
|
1020
|
+
tag: agentTag,
|
|
1021
|
+
input: typeof inputMessage === 'string' ? { message: inputMessage } : inputMessage,
|
|
1022
|
+
session: subAgentSession,
|
|
1023
|
+
});
|
|
1024
|
+
// Transform output if transformer provided
|
|
1025
|
+
if (options.outputTransform) {
|
|
1026
|
+
return options.outputTransform(result);
|
|
1027
|
+
}
|
|
1028
|
+
// Return full details or just output based on options
|
|
1029
|
+
if (options.includeDetails) {
|
|
1030
|
+
return {
|
|
1031
|
+
agent: agentTag,
|
|
1032
|
+
status: result.status,
|
|
1033
|
+
output: result.output,
|
|
1034
|
+
iterations: result.iterations,
|
|
1035
|
+
toolCalls: (_a = result.toolCalls) === null || _a === void 0 ? void 0 : _a.map((tc) => ({
|
|
1036
|
+
tool: tc.tool,
|
|
1037
|
+
success: tc.success,
|
|
1038
|
+
})),
|
|
1039
|
+
executionTime: result.executionTime,
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
// Default: return just the output
|
|
1043
|
+
return result.output;
|
|
1044
|
+
},
|
|
1045
|
+
};
|
|
1046
|
+
return tool;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Create an agent tool from a handlerRef string
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* // In tool definition
|
|
1054
|
+
* {
|
|
1055
|
+
* tag: 'delegate-research',
|
|
1056
|
+
* handlerRef: 'agent:research-agent',
|
|
1057
|
+
* }
|
|
1058
|
+
* ```
|
|
1059
|
+
*/
|
|
1060
|
+
createAgentToolFromRef(handlerRef, product, env) {
|
|
1061
|
+
// Parse handlerRef: "agent:agent-tag" or "agent:agent-tag:options"
|
|
1062
|
+
const parts = handlerRef.split(':');
|
|
1063
|
+
if (parts[0] !== 'agent') {
|
|
1064
|
+
throw AgentError.validationError(`Invalid agent handlerRef format: ${handlerRef}. Expected "agent:agent-tag"`);
|
|
1065
|
+
}
|
|
1066
|
+
const agentTag = parts[1];
|
|
1067
|
+
return async (ctx, params) => {
|
|
1068
|
+
const input = typeof params === 'string'
|
|
1069
|
+
? params
|
|
1070
|
+
: params.task || JSON.stringify(params);
|
|
1071
|
+
// When delegating to sub-agent, append agent tag to session for traceability
|
|
1072
|
+
const subAgentSession = ctx.session ? `${ctx.session}:${agentTag}` : undefined;
|
|
1073
|
+
const result = await this.run({
|
|
1074
|
+
product,
|
|
1075
|
+
env,
|
|
1076
|
+
tag: agentTag,
|
|
1077
|
+
input: typeof input === 'string' ? { message: input } : input,
|
|
1078
|
+
session: subAgentSession,
|
|
1079
|
+
});
|
|
1080
|
+
return result.output;
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
// ==================== UTILITIES ====================
|
|
1084
|
+
/**
|
|
1085
|
+
* Get a defined agent by tag
|
|
1086
|
+
*/
|
|
1087
|
+
getAgent(tag) {
|
|
1088
|
+
return this.localAgents.get(tag);
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* List all defined agents
|
|
1092
|
+
*/
|
|
1093
|
+
listAgents() {
|
|
1094
|
+
return Array.from(this.localAgents.values());
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Delete an agent definition
|
|
1098
|
+
*/
|
|
1099
|
+
deleteAgent(tag) {
|
|
1100
|
+
this.toolRegistries.delete(tag);
|
|
1101
|
+
return this.localAgents.delete(tag);
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Clear all agent definitions
|
|
1105
|
+
*/
|
|
1106
|
+
clearAll() {
|
|
1107
|
+
this.localAgents.clear();
|
|
1108
|
+
this.toolRegistries.clear();
|
|
1109
|
+
this.activeExecutors.clear();
|
|
1110
|
+
}
|
|
1111
|
+
// ==================== PRIVATE HELPERS ====================
|
|
1112
|
+
/**
|
|
1113
|
+
* Convert a stored IProductAgent to IDefinedAgent format
|
|
1114
|
+
*/
|
|
1115
|
+
convertProductAgentToDefinedAgent(storedAgent) {
|
|
1116
|
+
var _a;
|
|
1117
|
+
return {
|
|
1118
|
+
tag: storedAgent.tag,
|
|
1119
|
+
name: storedAgent.name,
|
|
1120
|
+
description: storedAgent.description,
|
|
1121
|
+
model: storedAgent.model, // Model tag reference - resolved at runtime
|
|
1122
|
+
modelConfig: storedAgent.modelConfig,
|
|
1123
|
+
systemPrompt: storedAgent.systemPrompt,
|
|
1124
|
+
toolSchemas: (storedAgent.tools || []).map((tool) => ({
|
|
1125
|
+
tag: tool.tag,
|
|
1126
|
+
name: tool.name,
|
|
1127
|
+
description: tool.description,
|
|
1128
|
+
parameters: tool.parameters,
|
|
1129
|
+
requiresConfirmation: tool.requiresConfirmation,
|
|
1130
|
+
costEstimate: tool.costEstimate,
|
|
1131
|
+
timeout: tool.timeout,
|
|
1132
|
+
retries: tool.retries,
|
|
1133
|
+
})),
|
|
1134
|
+
termination: storedAgent.termination ? {
|
|
1135
|
+
maxIterations: storedAgent.termination.maxIterations,
|
|
1136
|
+
maxTokens: storedAgent.termination.maxTokens,
|
|
1137
|
+
timeout: storedAgent.termination.timeout,
|
|
1138
|
+
allowManualStop: storedAgent.termination.allowManualStop,
|
|
1139
|
+
} : undefined,
|
|
1140
|
+
memory: storedAgent.memory ? {
|
|
1141
|
+
shortTerm: storedAgent.memory.shortTerm,
|
|
1142
|
+
longTerm: storedAgent.memory.longTerm,
|
|
1143
|
+
} : undefined,
|
|
1144
|
+
humanInLoop: storedAgent.humanInLoop ? {
|
|
1145
|
+
enabled: storedAgent.humanInLoop.enabled,
|
|
1146
|
+
alwaysRequireApproval: storedAgent.humanInLoop.alwaysRequireApproval,
|
|
1147
|
+
approvalTimeout: storedAgent.humanInLoop.approvalTimeout,
|
|
1148
|
+
approvalWebhook: storedAgent.humanInLoop.approvalWebhook,
|
|
1149
|
+
approvalBroker: storedAgent.humanInLoop.approvalBroker,
|
|
1150
|
+
} : undefined,
|
|
1151
|
+
streaming: storedAgent.streaming ? {
|
|
1152
|
+
enabled: storedAgent.streaming.enabled,
|
|
1153
|
+
events: storedAgent.streaming.events,
|
|
1154
|
+
webhook: storedAgent.streaming.webhook,
|
|
1155
|
+
broker: storedAgent.streaming.broker,
|
|
1156
|
+
} : undefined,
|
|
1157
|
+
inputSchema: storedAgent.inputSchema,
|
|
1158
|
+
envs: (_a = storedAgent.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
|
|
1159
|
+
slug: env.slug,
|
|
1160
|
+
active: env.active,
|
|
1161
|
+
model: env.model, // Model tag override - resolved at runtime
|
|
1162
|
+
modelConfig: env.modelConfig,
|
|
1163
|
+
toolOverrides: env.toolOverrides,
|
|
1164
|
+
})),
|
|
1165
|
+
resilience: storedAgent.resilience,
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Create a handler function from a handlerRef string
|
|
1170
|
+
* Format: "type:tag:event" (e.g., "action:payment-app:process-payment", "feature:checkout-flow")
|
|
1171
|
+
*/
|
|
1172
|
+
createHandlerFromRef(handlerRef, product, env) {
|
|
1173
|
+
const parts = handlerRef.split(':');
|
|
1174
|
+
const type = parts[0];
|
|
1175
|
+
const tag = parts[1];
|
|
1176
|
+
const event = parts[2];
|
|
1177
|
+
return async (ctx, params) => {
|
|
1178
|
+
switch (type) {
|
|
1179
|
+
case 'action':
|
|
1180
|
+
return ctx.action.run({
|
|
1181
|
+
app: tag,
|
|
1182
|
+
event,
|
|
1183
|
+
input: params,
|
|
1184
|
+
});
|
|
1185
|
+
case 'feature':
|
|
1186
|
+
return ctx.feature.run({
|
|
1187
|
+
feature: tag,
|
|
1188
|
+
input: params,
|
|
1189
|
+
});
|
|
1190
|
+
case 'database':
|
|
1191
|
+
return ctx.database.execute({
|
|
1192
|
+
database: tag,
|
|
1193
|
+
event,
|
|
1194
|
+
input: params,
|
|
1195
|
+
});
|
|
1196
|
+
case 'graph':
|
|
1197
|
+
return ctx.graph.execute({
|
|
1198
|
+
graph: tag,
|
|
1199
|
+
action: event,
|
|
1200
|
+
input: params,
|
|
1201
|
+
});
|
|
1202
|
+
case 'storage':
|
|
1203
|
+
return ctx.storage.upload({
|
|
1204
|
+
storage: tag,
|
|
1205
|
+
event,
|
|
1206
|
+
input: params,
|
|
1207
|
+
});
|
|
1208
|
+
case 'notification':
|
|
1209
|
+
await ctx.notification.send({
|
|
1210
|
+
notification: tag,
|
|
1211
|
+
event,
|
|
1212
|
+
input: params,
|
|
1213
|
+
});
|
|
1214
|
+
return { success: true };
|
|
1215
|
+
case 'publish':
|
|
1216
|
+
await ctx.publish.send({
|
|
1217
|
+
broker: tag,
|
|
1218
|
+
event,
|
|
1219
|
+
input: { message: params },
|
|
1220
|
+
});
|
|
1221
|
+
return { success: true };
|
|
1222
|
+
case 'agent':
|
|
1223
|
+
// Delegate to another agent
|
|
1224
|
+
// Format: "agent:agent-tag"
|
|
1225
|
+
const input = typeof params === 'string'
|
|
1226
|
+
? params
|
|
1227
|
+
: params.task || JSON.stringify(params);
|
|
1228
|
+
// When delegating to sub-agent, append agent tag to session for traceability
|
|
1229
|
+
const subAgentSession = ctx.session ? `${ctx.session}:${tag}` : undefined;
|
|
1230
|
+
const result = await this.run({
|
|
1231
|
+
product,
|
|
1232
|
+
env,
|
|
1233
|
+
tag,
|
|
1234
|
+
input: typeof input === 'string' ? { message: input } : input,
|
|
1235
|
+
session: subAgentSession,
|
|
1236
|
+
});
|
|
1237
|
+
return result.output;
|
|
1238
|
+
default:
|
|
1239
|
+
throw new Error(`Unknown handler type: ${type}`);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
exports.AgentsService = AgentsService;
|
|
1245
|
+
// Export singleton instance for convenience
|
|
1246
|
+
exports.agentsService = new AgentsService();
|
|
1247
|
+
// Default export
|
|
1248
|
+
exports.default = AgentsService;
|
|
1249
|
+
//# sourceMappingURL=agents.service.js.map
|