@botpress/adk 2.0.2 → 3.0.0-beta.0
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/agent-project/agent-project.d.ts +5 -0
- package/dist/agent-project/agent-project.d.ts.map +1 -1
- package/dist/agent-project/agent-resolver.d.ts.map +1 -1
- package/dist/agent-project/types.d.ts +4 -0
- package/dist/agent-project/types.d.ts.map +1 -1
- package/dist/agent0/capabilities/commands/adk-ship.md +2 -1
- package/dist/agent0/capabilities/commands/adk-validate.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/agent-config.md +35 -4
- package/dist/agent0/capabilities/skills/adk/references/cli.md +6 -3
- package/dist/agent0/capabilities/skills/adk/references/explain-config.md +2 -2
- package/dist/agent0/capabilities/skills/adk/references/files.md +6 -1
- package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +7 -3
- package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +6 -4
- package/dist/agent0/index.js +279 -62
- package/dist/agent0/index.js.map +16 -13
- package/dist/agent0/providers/source.d.ts.map +1 -1
- package/dist/agent0/runtime/client.d.ts +2 -1
- package/dist/agent0/runtime/client.d.ts.map +1 -1
- package/dist/agent0/runtime/engine.d.ts +2 -0
- package/dist/agent0/runtime/engine.d.ts.map +1 -1
- package/dist/agent0/runtime/manager.d.ts +2 -1
- package/dist/agent0/runtime/manager.d.ts.map +1 -1
- package/dist/agent0/types.d.ts +41 -1
- package/dist/agent0/types.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/bot-generator/dev-id-manager.d.ts +6 -0
- package/dist/bot-generator/dev-id-manager.d.ts.map +1 -1
- package/dist/bot-generator/generator.d.ts +1 -1
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/bot-generator/install-package.d.ts +17 -0
- package/dist/bot-generator/install-package.d.ts.map +1 -0
- package/dist/bot-generator/integration-sync.d.ts +6 -20
- package/dist/bot-generator/integration-sync.d.ts.map +1 -1
- package/dist/bot-generator/interface-sync.d.ts +6 -20
- package/dist/bot-generator/interface-sync.d.ts.map +1 -1
- package/dist/bot-generator/plugin-sync.d.ts +6 -20
- package/dist/bot-generator/plugin-sync.d.ts.map +1 -1
- package/dist/build/__fixtures__/generated-import-bot/bot.definition.d.ts +14 -0
- package/dist/build/__fixtures__/generated-import-bot/bot.definition.d.ts.map +1 -0
- package/dist/build/__fixtures__/generated-import-bot/src/index.d.ts +3 -0
- package/dist/build/__fixtures__/generated-import-bot/src/index.d.ts.map +1 -0
- package/dist/build/__fixtures__/minimal-bot/bot.definition.d.ts +38 -0
- package/dist/build/__fixtures__/minimal-bot/bot.definition.d.ts.map +1 -0
- package/dist/build/__fixtures__/minimal-bot/src/index.d.ts +6 -0
- package/dist/build/__fixtures__/minimal-bot/src/index.d.ts.map +1 -0
- package/dist/build/bot-builder.d.ts +48 -0
- package/dist/build/bot-builder.d.ts.map +1 -0
- package/dist/build/definition-inputs.d.ts +21 -0
- package/dist/build/definition-inputs.d.ts.map +1 -0
- package/dist/build/definition-loader.d.ts +14 -0
- package/dist/build/definition-loader.d.ts.map +1 -0
- package/dist/chat-bundle.cjs +19 -19
- package/dist/codegen/bot-implementation/bot-implementation.d.ts +9 -0
- package/dist/codegen/bot-implementation/bot-implementation.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-plugins/index.d.ts +8 -0
- package/dist/codegen/bot-implementation/bot-plugins/index.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-plugins/plugin-module.d.ts +14 -0
- package/dist/codegen/bot-implementation/bot-plugins/plugin-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/actions-module.d.ts +22 -0
- package/dist/codegen/bot-implementation/bot-typings/actions-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/events-module.d.ts +11 -0
- package/dist/codegen/bot-implementation/bot-typings/events-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/index.d.ts +8 -0
- package/dist/codegen/bot-implementation/bot-typings/index.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/states-module.d.ts +18 -0
- package/dist/codegen/bot-implementation/bot-typings/states-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/tables-module.d.ts +11 -0
- package/dist/codegen/bot-implementation/bot-typings/tables-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/bot-typings/workflows-module.d.ts +28 -0
- package/dist/codegen/bot-implementation/bot-typings/workflows-module.d.ts.map +1 -0
- package/dist/codegen/bot-implementation/index.d.ts +4 -0
- package/dist/codegen/bot-implementation/index.d.ts.map +1 -0
- package/dist/codegen/casing.d.ts +11 -0
- package/dist/codegen/casing.d.ts.map +1 -0
- package/dist/codegen/consts.d.ts +19 -0
- package/dist/codegen/consts.d.ts.map +1 -0
- package/dist/codegen/generators.d.ts +16 -0
- package/dist/codegen/generators.d.ts.map +1 -0
- package/dist/codegen/index.d.ts +9 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/index.d.ts +4 -0
- package/dist/codegen/integration-implementation/index.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-implementation.d.ts +8 -0
- package/dist/codegen/integration-implementation/integration-implementation.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/actions-module.d.ts +22 -0
- package/dist/codegen/integration-implementation/integration-typings/actions-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/channels-module.d.ts +6 -0
- package/dist/codegen/integration-implementation/integration-typings/channels-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/configuration-module.d.ts +8 -0
- package/dist/codegen/integration-implementation/integration-typings/configuration-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/configurations-module.d.ts +11 -0
- package/dist/codegen/integration-implementation/integration-typings/configurations-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/entities-module.d.ts +11 -0
- package/dist/codegen/integration-implementation/integration-typings/entities-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/events-module.d.ts +11 -0
- package/dist/codegen/integration-implementation/integration-typings/events-module.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/index.d.ts +9 -0
- package/dist/codegen/integration-implementation/integration-typings/index.d.ts.map +1 -0
- package/dist/codegen/integration-implementation/integration-typings/states-module.d.ts +18 -0
- package/dist/codegen/integration-implementation/integration-typings/states-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/index.d.ts +3 -0
- package/dist/codegen/integration-package/index.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/actions-module.d.ts +22 -0
- package/dist/codegen/integration-package/integration-package-definition/actions-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/channels-module.d.ts +6 -0
- package/dist/codegen/integration-package/integration-package-definition/channels-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/configuration-module.d.ts +8 -0
- package/dist/codegen/integration-package/integration-package-definition/configuration-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/configurations-module.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/configurations-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/entities-module.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/entities-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/events-module.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/events-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/index.d.ts +9 -0
- package/dist/codegen/integration-package/integration-package-definition/index.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/interfaces-module.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/interfaces-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/states-module.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/states-module.d.ts.map +1 -0
- package/dist/codegen/integration-package/integration-package-definition/typings.d.ts +11 -0
- package/dist/codegen/integration-package/integration-package-definition/typings.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/index.d.ts +5 -0
- package/dist/codegen/interface-implementation/index.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/integration-typings/actions-module.d.ts +22 -0
- package/dist/codegen/interface-implementation/integration-typings/actions-module.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/integration-typings/channels-module.d.ts +6 -0
- package/dist/codegen/interface-implementation/integration-typings/channels-module.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/integration-typings/entities-module.d.ts +11 -0
- package/dist/codegen/interface-implementation/integration-typings/entities-module.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/integration-typings/events-module.d.ts +11 -0
- package/dist/codegen/interface-implementation/integration-typings/events-module.d.ts.map +1 -0
- package/dist/codegen/interface-implementation/integration-typings/index.d.ts +9 -0
- package/dist/codegen/interface-implementation/integration-typings/index.d.ts.map +1 -0
- package/dist/codegen/interface-package/index.d.ts +3 -0
- package/dist/codegen/interface-package/index.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/actions-module.d.ts +22 -0
- package/dist/codegen/interface-package/interface-package-definition/actions-module.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/channels-module.d.ts +6 -0
- package/dist/codegen/interface-package/interface-package-definition/channels-module.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/entities-module.d.ts +11 -0
- package/dist/codegen/interface-package/interface-package-definition/entities-module.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/events-module.d.ts +11 -0
- package/dist/codegen/interface-package/interface-package-definition/events-module.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/index.d.ts +9 -0
- package/dist/codegen/interface-package/interface-package-definition/index.d.ts.map +1 -0
- package/dist/codegen/interface-package/interface-package-definition/typings.d.ts +8 -0
- package/dist/codegen/interface-package/interface-package-definition/typings.d.ts.map +1 -0
- package/dist/codegen/module.d.ts +54 -0
- package/dist/codegen/module.d.ts.map +1 -0
- package/dist/codegen/paths.d.ts +8 -0
- package/dist/codegen/paths.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/index.d.ts +4 -0
- package/dist/codegen/plugin-implementation/index.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-implementation.d.ts +8 -0
- package/dist/codegen/plugin-implementation/plugin-implementation.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/actions-module.d.ts +22 -0
- package/dist/codegen/plugin-implementation/plugin-typings/actions-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/configuration-module.d.ts +8 -0
- package/dist/codegen/plugin-implementation/plugin-typings/configuration-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/conversation-module.d.ts +8 -0
- package/dist/codegen/plugin-implementation/plugin-typings/conversation-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/events-module.d.ts +11 -0
- package/dist/codegen/plugin-implementation/plugin-typings/events-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/index.d.ts +9 -0
- package/dist/codegen/plugin-implementation/plugin-typings/index.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/message-module.d.ts +8 -0
- package/dist/codegen/plugin-implementation/plugin-typings/message-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/states-module.d.ts +18 -0
- package/dist/codegen/plugin-implementation/plugin-typings/states-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/tables-module.d.ts +11 -0
- package/dist/codegen/plugin-implementation/plugin-typings/tables-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/user-module.d.ts +8 -0
- package/dist/codegen/plugin-implementation/plugin-typings/user-module.d.ts.map +1 -0
- package/dist/codegen/plugin-implementation/plugin-typings/workflows-module.d.ts +28 -0
- package/dist/codegen/plugin-implementation/plugin-typings/workflows-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/index.d.ts +3 -0
- package/dist/codegen/plugin-package/index.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/actions-module.d.ts +22 -0
- package/dist/codegen/plugin-package/plugin-package-definition/actions-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/configuration-module.d.ts +8 -0
- package/dist/codegen/plugin-package/plugin-package-definition/configuration-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/events-module.d.ts +11 -0
- package/dist/codegen/plugin-package/plugin-package-definition/events-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/index.d.ts +9 -0
- package/dist/codegen/plugin-package/plugin-package-definition/index.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/interfaces-module.d.ts +8 -0
- package/dist/codegen/plugin-package/plugin-package-definition/interfaces-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/recurring-events-module.d.ts +6 -0
- package/dist/codegen/plugin-package/plugin-package-definition/recurring-events-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/states-module.d.ts +11 -0
- package/dist/codegen/plugin-package/plugin-package-definition/states-module.d.ts.map +1 -0
- package/dist/codegen/plugin-package/plugin-package-definition/typings.d.ts +8 -0
- package/dist/codegen/plugin-package/plugin-package-definition/typings.d.ts.map +1 -0
- package/dist/codegen/schema.d.ts +8 -0
- package/dist/codegen/schema.d.ts.map +1 -0
- package/dist/codegen/secret-module.d.ts +17 -0
- package/dist/codegen/secret-module.d.ts.map +1 -0
- package/dist/codegen/strings.d.ts +6 -0
- package/dist/codegen/strings.d.ts.map +1 -0
- package/dist/codegen/type-utils.d.ts +9 -0
- package/dist/codegen/type-utils.d.ts.map +1 -0
- package/dist/codegen/typings.d.ts +167 -0
- package/dist/codegen/typings.d.ts.map +1 -0
- package/dist/codegen/utils.d.ts +12 -0
- package/dist/codegen/utils.d.ts.map +1 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/index.d.ts +1 -12
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/native-command.d.ts +39 -0
- package/dist/commands/native-command.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/dependencies/catalog/client-factory.d.ts +4 -10
- package/dist/dependencies/catalog/client-factory.d.ts.map +1 -1
- package/dist/dependencies/catalog/plugin-source.d.ts +6 -0
- package/dist/dependencies/catalog/plugin-source.d.ts.map +1 -1
- package/dist/dependencies/dependency-manager.d.ts +13 -0
- package/dist/dependencies/dependency-manager.d.ts.map +1 -1
- package/dist/dependencies/index.js +456 -246
- package/dist/dependencies/index.js.map +20 -20
- package/dist/dependencies/resolvers/plugin-resolver.d.ts.map +1 -1
- package/dist/dependencies/snapshot-store.d.ts.map +1 -1
- package/dist/dependencies/types.d.ts +27 -0
- package/dist/dependencies/types.d.ts.map +1 -1
- package/dist/deploy/attributes.d.ts +16 -0
- package/dist/deploy/attributes.d.ts.map +1 -0
- package/dist/deploy/bot-body.d.ts +26 -0
- package/dist/deploy/bot-body.d.ts.map +1 -0
- package/dist/deploy/errors.d.ts +9 -0
- package/dist/deploy/errors.d.ts.map +1 -0
- package/dist/deploy/integration-utils.d.ts +11 -0
- package/dist/deploy/integration-utils.d.ts.map +1 -0
- package/dist/deploy/records.d.ts +14 -0
- package/dist/deploy/records.d.ts.map +1 -0
- package/dist/deploy/schema-utils.d.ts +16 -0
- package/dist/deploy/schema-utils.d.ts.map +1 -0
- package/dist/deploy-manifest/index.d.ts +8 -8
- package/dist/file-watcher/watcher.d.ts +18 -4
- package/dist/file-watcher/watcher.d.ts.map +1 -1
- package/dist/generators/tests.d.ts.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10115 -6035
- package/dist/index.js.map +122 -42
- package/dist/native-deploy/deploy-bot.d.ts +32 -0
- package/dist/native-deploy/deploy-bot.d.ts.map +1 -0
- package/dist/native-deploy/prepare-dependencies.d.ts +13 -0
- package/dist/native-deploy/prepare-dependencies.d.ts.map +1 -0
- package/dist/native-dev/dev-runtime.d.ts +159 -0
- package/dist/native-dev/dev-runtime.d.ts.map +1 -0
- package/dist/native-dev/event-emitter.d.ts +8 -0
- package/dist/native-dev/event-emitter.d.ts.map +1 -0
- package/dist/native-dev/tunnel.d.ts +56 -0
- package/dist/native-dev/tunnel.d.ts.map +1 -0
- package/dist/native-dev/worker/child-wrapper.d.ts +24 -0
- package/dist/native-dev/worker/child-wrapper.d.ts.map +1 -0
- package/dist/native-dev/worker/config.d.ts +21 -0
- package/dist/native-dev/worker/config.d.ts.map +1 -0
- package/dist/native-dev/worker/worker-state.d.ts +31 -0
- package/dist/native-dev/worker/worker-state.d.ts.map +1 -0
- package/dist/native-dev/worker/worker.d.ts +32 -0
- package/dist/native-dev/worker/worker.d.ts.map +1 -0
- package/dist/{commands/bp-dev-worker-env.d.ts → native-dev/worker-env.d.ts} +1 -1
- package/dist/native-dev/worker-env.d.ts.map +1 -0
- package/dist/plugins/manager.d.ts +6 -0
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/preflight/checker.d.ts +1 -1
- package/dist/preflight/checker.d.ts.map +1 -1
- package/dist/preflight/types.d.ts +1 -1
- package/dist/preflight/types.d.ts.map +1 -1
- package/dist/runner/script-runner.d.ts +0 -4
- package/dist/runner/script-runner.d.ts.map +1 -1
- package/dist/secrets/index.d.ts +5 -2
- package/dist/secrets/index.d.ts.map +1 -1
- package/dist/secrets/local.d.ts +28 -0
- package/dist/secrets/local.d.ts.map +1 -0
- package/dist/secrets/remote.d.ts +22 -0
- package/dist/secrets/remote.d.ts.map +1 -0
- package/dist/secrets/status.d.ts +24 -0
- package/dist/secrets/status.d.ts.map +1 -0
- package/dist/secrets/validation.d.ts +11 -0
- package/dist/secrets/validation.d.ts.map +1 -0
- package/dist/templates/README.md +6 -1
- package/dist/templates/blank/README.md +5 -0
- package/dist/templates/botpress-desk/README.md +5 -0
- package/dist/templates/crm-enrichment/README.md +5 -0
- package/dist/templates/hello-world/README.md +5 -0
- package/dist/templates/knowledge-assistant/README.md +5 -0
- package/dist/templates/slack-triage/README.md +5 -0
- package/dist/utils/adk-ignore.d.ts +17 -0
- package/dist/utils/adk-ignore.d.ts.map +1 -0
- package/dist/utils/json-ordering.d.ts +1 -1
- package/dist/utils/json-ordering.d.ts.map +1 -1
- package/dist/utils/ref-parser.d.ts +17 -0
- package/dist/utils/ref-parser.d.ts.map +1 -0
- package/dist/utils/source-map-optimizer.d.ts +4 -4
- package/package.json +9 -10
- package/dist/auth/bp-cli-import.d.ts +0 -16
- package/dist/auth/bp-cli-import.d.ts.map +0 -1
- package/dist/commands/bp-add-command.d.ts +0 -19
- package/dist/commands/bp-add-command.d.ts.map +0 -1
- package/dist/commands/bp-build-command.d.ts +0 -14
- package/dist/commands/bp-build-command.d.ts.map +0 -1
- package/dist/commands/bp-chat-command.d.ts +0 -18
- package/dist/commands/bp-chat-command.d.ts.map +0 -1
- package/dist/commands/bp-cli.d.ts +0 -14
- package/dist/commands/bp-cli.d.ts.map +0 -1
- package/dist/commands/bp-cli.js +0 -147
- package/dist/commands/bp-cli.js.map +0 -12
- package/dist/commands/bp-deploy-command.d.ts +0 -21
- package/dist/commands/bp-deploy-command.d.ts.map +0 -1
- package/dist/commands/bp-dev-command.d.ts +0 -89
- package/dist/commands/bp-dev-command.d.ts.map +0 -1
- package/dist/commands/bp-dev-stderr.d.ts +0 -30
- package/dist/commands/bp-dev-stderr.d.ts.map +0 -1
- package/dist/commands/bp-dev-worker-env.d.ts.map +0 -1
- package/dist/secrets/manager.d.ts +0 -44
- package/dist/secrets/manager.d.ts.map +0 -1
|
@@ -78,7 +78,8 @@ var init_types = __esm(() => {
|
|
|
78
78
|
authorizationPending: z.boolean().optional()
|
|
79
79
|
});
|
|
80
80
|
pluginDependencyMappingSchema = z.object({
|
|
81
|
-
integrationAlias: z.string()
|
|
81
|
+
integrationAlias: z.string(),
|
|
82
|
+
integrationInterfaceAlias: z.string().optional()
|
|
82
83
|
});
|
|
83
84
|
pluginDependencyEntrySchema = z.object({
|
|
84
85
|
name: z.string(),
|
|
@@ -131,6 +132,9 @@ function isAdkError(error) {
|
|
|
131
132
|
return false;
|
|
132
133
|
return error.constructor?.__IS_ADK_BASE_ERROR === true;
|
|
133
134
|
}
|
|
135
|
+
function isExpectedError(error) {
|
|
136
|
+
return isAdkError(error) && error.expected;
|
|
137
|
+
}
|
|
134
138
|
var AdkError;
|
|
135
139
|
var init_errors = __esm(() => {
|
|
136
140
|
AdkError = class AdkError extends Error {
|
|
@@ -143,7 +147,7 @@ var init_errors = __esm(() => {
|
|
|
143
147
|
super(opts.message, opts.cause !== undefined ? { cause: opts.cause } : undefined);
|
|
144
148
|
this.name = this.constructor.name;
|
|
145
149
|
this.code = opts.code;
|
|
146
|
-
this.expected = opts.expected ??
|
|
150
|
+
this.expected = opts.expected ?? true;
|
|
147
151
|
if (opts.details !== undefined) {
|
|
148
152
|
this.details = opts.details;
|
|
149
153
|
}
|
|
@@ -400,7 +404,8 @@ var init_types2 = __esm(() => {
|
|
|
400
404
|
botId: z2.string().optional().describe("The bot ID (overrides agent.json for local development)"),
|
|
401
405
|
workspaceId: z2.string().optional().describe("The workspace ID (overrides agent.json for local development)"),
|
|
402
406
|
apiUrl: z2.string().optional().describe("The Botpress API URL (overrides agent.json for local development)"),
|
|
403
|
-
devId: z2.string().optional().describe("The development bot ID used during local development")
|
|
407
|
+
devId: z2.string().optional().describe("The development bot ID used during local development"),
|
|
408
|
+
tunnelId: z2.string().optional().describe("The dev tunnel ID, reused across local dev sessions")
|
|
404
409
|
});
|
|
405
410
|
((ValidationErrorCode2) => {
|
|
406
411
|
ValidationErrorCode2["DIRECTORY_NOT_FOUND"] = "DIRECTORY_NOT_FOUND";
|
|
@@ -1056,7 +1061,7 @@ var init_dependencies_parser = __esm(() => {
|
|
|
1056
1061
|
});
|
|
1057
1062
|
|
|
1058
1063
|
// src/constants.ts
|
|
1059
|
-
var DEFAULT_API_URL = "https://api.botpress.cloud", BUILTIN_INTERFACES, MAX_TABLE_COLUMNS = 20;
|
|
1064
|
+
var DEFAULT_API_URL = "https://api.botpress.cloud", BUILTIN_INTERFACES, MAX_TABLE_COLUMNS = 20, MAX_ACTION_DESCRIPTION_LENGTH = 256;
|
|
1060
1065
|
var init_constants = __esm(() => {
|
|
1061
1066
|
BUILTIN_INTERFACES = {
|
|
1062
1067
|
"typing-indicator": "typing-indicator@0.0.3",
|
|
@@ -1102,6 +1107,9 @@ function applyLocalOverrides(agentInfo, localInfo) {
|
|
|
1102
1107
|
if (localInfo.devId) {
|
|
1103
1108
|
agentInfo.devId = localInfo.devId;
|
|
1104
1109
|
}
|
|
1110
|
+
if (localInfo.tunnelId) {
|
|
1111
|
+
agentInfo.tunnelId = localInfo.tunnelId;
|
|
1112
|
+
}
|
|
1105
1113
|
}
|
|
1106
1114
|
async function resolveAgent(agentPath, options = {}) {
|
|
1107
1115
|
const { required = false, requireWorkspace = false, requireBot = false } = options;
|
|
@@ -1140,7 +1148,8 @@ async function resolveAgent(agentPath, options = {}) {
|
|
|
1140
1148
|
botId: localInfo.botId,
|
|
1141
1149
|
workspaceId: localInfo.workspaceId,
|
|
1142
1150
|
apiUrl: localInfo.apiUrl,
|
|
1143
|
-
devId: localInfo.devId
|
|
1151
|
+
devId: localInfo.devId,
|
|
1152
|
+
tunnelId: localInfo.tunnelId
|
|
1144
1153
|
};
|
|
1145
1154
|
} else if (required || requireWorkspace || requireBot) {
|
|
1146
1155
|
throw ValidationErrors.requiredFileMissing("agent.json or agent.local.json");
|
|
@@ -1170,10 +1179,6 @@ var init_agent_resolver = __esm(() => {
|
|
|
1170
1179
|
});
|
|
1171
1180
|
|
|
1172
1181
|
// src/auth/credentials.ts
|
|
1173
|
-
var exports_credentials = {};
|
|
1174
|
-
__export(exports_credentials, {
|
|
1175
|
-
CredentialsManager: () => CredentialsManager
|
|
1176
|
-
});
|
|
1177
1182
|
import fs2 from "fs/promises";
|
|
1178
1183
|
import path2 from "path";
|
|
1179
1184
|
import os from "os";
|
|
@@ -1450,67 +1455,6 @@ var init_service = __esm(() => {
|
|
|
1450
1455
|
init_src();
|
|
1451
1456
|
});
|
|
1452
1457
|
|
|
1453
|
-
// src/auth/bp-cli-import.ts
|
|
1454
|
-
import fs3 from "fs/promises";
|
|
1455
|
-
import path3 from "path";
|
|
1456
|
-
import os2 from "os";
|
|
1457
|
-
|
|
1458
|
-
class BpCliImporter {
|
|
1459
|
-
bpCachePath;
|
|
1460
|
-
constructor() {
|
|
1461
|
-
this.bpCachePath = path3.join(os2.homedir(), ".botpress", "global.cache.json");
|
|
1462
|
-
}
|
|
1463
|
-
async hasBpCliCredentials() {
|
|
1464
|
-
try {
|
|
1465
|
-
await fs3.access(this.bpCachePath);
|
|
1466
|
-
return true;
|
|
1467
|
-
} catch {
|
|
1468
|
-
return false;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
async getBpCliCredentials() {
|
|
1472
|
-
try {
|
|
1473
|
-
const data = await fs3.readFile(this.bpCachePath, "utf-8");
|
|
1474
|
-
const credentials = JSON.parse(data);
|
|
1475
|
-
if (!credentials.token || !credentials.workspaceId || !credentials.apiUrl) {
|
|
1476
|
-
return null;
|
|
1477
|
-
}
|
|
1478
|
-
return credentials;
|
|
1479
|
-
} catch {
|
|
1480
|
-
return null;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
async importFromBpCli(profileName = "default") {
|
|
1484
|
-
const bpCredentials = await this.getBpCliCredentials();
|
|
1485
|
-
if (!bpCredentials) {
|
|
1486
|
-
return false;
|
|
1487
|
-
}
|
|
1488
|
-
try {
|
|
1489
|
-
await auth.login(bpCredentials.token, {
|
|
1490
|
-
profile: profileName,
|
|
1491
|
-
apiUrl: bpCredentials.apiUrl
|
|
1492
|
-
});
|
|
1493
|
-
const credentialsManager = new (await Promise.resolve().then(() => (init_credentials(), exports_credentials))).CredentialsManager;
|
|
1494
|
-
const store = await credentialsManager["readCredentials"]();
|
|
1495
|
-
if (store.profiles[profileName]) {
|
|
1496
|
-
store.profiles[profileName].workspaceId = bpCredentials.workspaceId;
|
|
1497
|
-
if (bpCredentials.botId) {
|
|
1498
|
-
store.profiles[profileName].botId = bpCredentials.botId;
|
|
1499
|
-
}
|
|
1500
|
-
await credentialsManager["writeCredentials"](store);
|
|
1501
|
-
}
|
|
1502
|
-
return true;
|
|
1503
|
-
} catch {
|
|
1504
|
-
return false;
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
var bpCliImporter;
|
|
1509
|
-
var init_bp_cli_import = __esm(() => {
|
|
1510
|
-
init_auth();
|
|
1511
|
-
bpCliImporter = new BpCliImporter;
|
|
1512
|
-
});
|
|
1513
|
-
|
|
1514
1458
|
// src/auth/index.ts
|
|
1515
1459
|
import { Client as Client2 } from "@botpress/client";
|
|
1516
1460
|
|
|
@@ -1658,7 +1602,7 @@ async function resolveBotCredentials(options = {}) {
|
|
|
1658
1602
|
}
|
|
1659
1603
|
async function getProjectClient(options = {}) {
|
|
1660
1604
|
const credentials = await resolveWorkspaceCredentials(options);
|
|
1661
|
-
const botId = options.botId;
|
|
1605
|
+
const botId = options.botId ?? credentials.botId;
|
|
1662
1606
|
const headers = {
|
|
1663
1607
|
"x-multiple-integrations": "true",
|
|
1664
1608
|
...options.headers ?? {}
|
|
@@ -1670,7 +1614,8 @@ async function getProjectClient(options = {}) {
|
|
|
1670
1614
|
botId,
|
|
1671
1615
|
integrationId: options.integrationId,
|
|
1672
1616
|
integrationAlias: options.integrationAlias,
|
|
1673
|
-
headers
|
|
1617
|
+
headers,
|
|
1618
|
+
timeoutMs: options.timeoutMs
|
|
1674
1619
|
});
|
|
1675
1620
|
const cached = projectClientCache.get(cacheKey);
|
|
1676
1621
|
if (cached) {
|
|
@@ -1685,6 +1630,7 @@ async function getProjectClient(options = {}) {
|
|
|
1685
1630
|
...botId ? { botId } : {},
|
|
1686
1631
|
...options.integrationId ? { integrationId: options.integrationId } : {},
|
|
1687
1632
|
...options.integrationAlias ? { integrationAlias: options.integrationAlias } : {},
|
|
1633
|
+
...options.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {},
|
|
1688
1634
|
headers
|
|
1689
1635
|
});
|
|
1690
1636
|
if (projectClientCache.size >= MAX_PROJECT_CLIENT_CACHE_ENTRIES) {
|
|
@@ -1718,7 +1664,6 @@ var init_auth = __esm(() => {
|
|
|
1718
1664
|
init_service();
|
|
1719
1665
|
init_agent_resolver();
|
|
1720
1666
|
init_credentials();
|
|
1721
|
-
init_bp_cli_import();
|
|
1722
1667
|
auth = new Auth;
|
|
1723
1668
|
projectClientCache = new Map;
|
|
1724
1669
|
});
|
|
@@ -1736,25 +1681,18 @@ class CatalogClientFactory {
|
|
|
1736
1681
|
if (this.client)
|
|
1737
1682
|
return this.client;
|
|
1738
1683
|
const { project, workspaceId, credentials, apiUrl } = this.options;
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
apiUrl: apiUrl || credentials.apiUrl,
|
|
1752
|
-
...credentials.workspaceId ? { workspaceId: credentials.workspaceId } : {},
|
|
1753
|
-
headers: { ...CATALOG_HEADERS }
|
|
1754
|
-
});
|
|
1755
|
-
} else {
|
|
1756
|
-
this.client = await getProjectClient({ headers: { ...CATALOG_HEADERS } });
|
|
1757
|
-
}
|
|
1684
|
+
const resolved = await resolveWorkspaceCredentials({
|
|
1685
|
+
project,
|
|
1686
|
+
credentials,
|
|
1687
|
+
apiUrl,
|
|
1688
|
+
workspaceId
|
|
1689
|
+
});
|
|
1690
|
+
this.client = new Client3({
|
|
1691
|
+
token: resolved.token,
|
|
1692
|
+
apiUrl: resolved.apiUrl,
|
|
1693
|
+
workspaceId: resolved.workspaceId,
|
|
1694
|
+
headers: { ...CATALOG_HEADERS }
|
|
1695
|
+
});
|
|
1758
1696
|
return this.client;
|
|
1759
1697
|
}
|
|
1760
1698
|
}
|
|
@@ -1765,9 +1703,9 @@ var init_client_factory = __esm(() => {
|
|
|
1765
1703
|
});
|
|
1766
1704
|
|
|
1767
1705
|
// src/dependencies/catalog/resolution-cache.ts
|
|
1768
|
-
import
|
|
1769
|
-
import
|
|
1770
|
-
import
|
|
1706
|
+
import fs3 from "fs/promises";
|
|
1707
|
+
import path3 from "path";
|
|
1708
|
+
import os2 from "os";
|
|
1771
1709
|
|
|
1772
1710
|
class ResolutionCache {
|
|
1773
1711
|
cacheDir;
|
|
@@ -1778,14 +1716,14 @@ class ResolutionCache {
|
|
|
1778
1716
|
constructor(config, noCache = false) {
|
|
1779
1717
|
this.idField = config.idField;
|
|
1780
1718
|
this.noCache = noCache;
|
|
1781
|
-
const cacheRoot = config.cacheRoot ??
|
|
1782
|
-
this.cacheDir =
|
|
1783
|
-
this.resolutionsDir =
|
|
1784
|
-
this.definitionsDir =
|
|
1719
|
+
const cacheRoot = config.cacheRoot ?? path3.join(os2.homedir(), ".adk", "cache");
|
|
1720
|
+
this.cacheDir = path3.join(cacheRoot, config.cacheType);
|
|
1721
|
+
this.resolutionsDir = path3.join(this.cacheDir, "resolutions");
|
|
1722
|
+
this.definitionsDir = path3.join(this.cacheDir, "definitions");
|
|
1785
1723
|
}
|
|
1786
1724
|
async ensureCacheDirs() {
|
|
1787
|
-
await
|
|
1788
|
-
await
|
|
1725
|
+
await fs3.mkdir(this.resolutionsDir, { recursive: true });
|
|
1726
|
+
await fs3.mkdir(this.definitionsDir, { recursive: true });
|
|
1789
1727
|
}
|
|
1790
1728
|
async getResolution(name, version, workspace, options) {
|
|
1791
1729
|
if (this.noCache) {
|
|
@@ -1793,8 +1731,8 @@ class ResolutionCache {
|
|
|
1793
1731
|
}
|
|
1794
1732
|
try {
|
|
1795
1733
|
const key = this.getResolutionKey(name, version, workspace);
|
|
1796
|
-
const cachePath =
|
|
1797
|
-
const data = await
|
|
1734
|
+
const cachePath = path3.join(this.resolutionsDir, `${key}.json`);
|
|
1735
|
+
const data = await fs3.readFile(cachePath, "utf-8");
|
|
1798
1736
|
const raw = JSON.parse(data);
|
|
1799
1737
|
if (!options?.allowStale) {
|
|
1800
1738
|
const cachedAt = new Date(raw.cachedAt);
|
|
@@ -1815,13 +1753,13 @@ class ResolutionCache {
|
|
|
1815
1753
|
async setResolution(name, version, workspace, id, updatedAt) {
|
|
1816
1754
|
await this.ensureCacheDirs();
|
|
1817
1755
|
const key = this.getResolutionKey(name, version, workspace);
|
|
1818
|
-
const cachePath =
|
|
1756
|
+
const cachePath = path3.join(this.resolutionsDir, `${key}.json`);
|
|
1819
1757
|
const resolution = {
|
|
1820
1758
|
[this.idField]: id,
|
|
1821
1759
|
updatedAt,
|
|
1822
1760
|
cachedAt: new Date().toISOString()
|
|
1823
1761
|
};
|
|
1824
|
-
await
|
|
1762
|
+
await fs3.writeFile(cachePath, JSON.stringify(resolution));
|
|
1825
1763
|
}
|
|
1826
1764
|
async getDefinition(id, updatedAt) {
|
|
1827
1765
|
if (this.noCache) {
|
|
@@ -1829,8 +1767,8 @@ class ResolutionCache {
|
|
|
1829
1767
|
}
|
|
1830
1768
|
try {
|
|
1831
1769
|
const key = this.getDefinitionKey(id, updatedAt);
|
|
1832
|
-
const cachePath =
|
|
1833
|
-
const data = await
|
|
1770
|
+
const cachePath = path3.join(this.definitionsDir, `${key}.json`);
|
|
1771
|
+
const data = await fs3.readFile(cachePath, "utf-8");
|
|
1834
1772
|
const cached = JSON.parse(data);
|
|
1835
1773
|
return cached.definition;
|
|
1836
1774
|
} catch {
|
|
@@ -1840,28 +1778,28 @@ class ResolutionCache {
|
|
|
1840
1778
|
async setDefinition(id, updatedAt, definition) {
|
|
1841
1779
|
await this.ensureCacheDirs();
|
|
1842
1780
|
const key = this.getDefinitionKey(id, updatedAt);
|
|
1843
|
-
const cachePath =
|
|
1781
|
+
const cachePath = path3.join(this.definitionsDir, `${key}.json`);
|
|
1844
1782
|
const cached = {
|
|
1845
1783
|
definition,
|
|
1846
1784
|
cachedAt: new Date().toISOString()
|
|
1847
1785
|
};
|
|
1848
|
-
await
|
|
1786
|
+
await fs3.writeFile(cachePath, JSON.stringify(cached));
|
|
1849
1787
|
}
|
|
1850
1788
|
async clear() {
|
|
1851
1789
|
try {
|
|
1852
|
-
const resolutionFiles = await
|
|
1853
|
-
await Promise.all(resolutionFiles.map((file) =>
|
|
1854
|
-
const definitionFiles = await
|
|
1855
|
-
await Promise.all(definitionFiles.map((file) =>
|
|
1790
|
+
const resolutionFiles = await fs3.readdir(this.resolutionsDir);
|
|
1791
|
+
await Promise.all(resolutionFiles.map((file) => fs3.unlink(path3.join(this.resolutionsDir, file))));
|
|
1792
|
+
const definitionFiles = await fs3.readdir(this.definitionsDir);
|
|
1793
|
+
await Promise.all(definitionFiles.map((file) => fs3.unlink(path3.join(this.definitionsDir, file))));
|
|
1856
1794
|
} catch {}
|
|
1857
1795
|
}
|
|
1858
1796
|
async getStats() {
|
|
1859
1797
|
const getDirectoryStats = async (dir) => {
|
|
1860
1798
|
try {
|
|
1861
|
-
const files = await
|
|
1799
|
+
const files = await fs3.readdir(dir);
|
|
1862
1800
|
let totalSize = 0;
|
|
1863
1801
|
for (const file of files) {
|
|
1864
|
-
const stats = await
|
|
1802
|
+
const stats = await fs3.stat(path3.join(dir, file));
|
|
1865
1803
|
totalSize += stats.size;
|
|
1866
1804
|
}
|
|
1867
1805
|
return { count: files.length, sizeBytes: totalSize };
|
|
@@ -2311,8 +2249,8 @@ var init_types3 = () => {};
|
|
|
2311
2249
|
var defaultAdkFolder = ".adk";
|
|
2312
2250
|
|
|
2313
2251
|
// src/assets/cache.ts
|
|
2314
|
-
import
|
|
2315
|
-
import
|
|
2252
|
+
import fs4 from "fs/promises";
|
|
2253
|
+
import path4 from "path";
|
|
2316
2254
|
|
|
2317
2255
|
class AssetsCacheManager {
|
|
2318
2256
|
projectPath;
|
|
@@ -2320,14 +2258,14 @@ class AssetsCacheManager {
|
|
|
2320
2258
|
cache = null;
|
|
2321
2259
|
constructor(projectPath) {
|
|
2322
2260
|
this.projectPath = projectPath;
|
|
2323
|
-
this.cachePath =
|
|
2261
|
+
this.cachePath = path4.join(projectPath, defaultAdkFolder, "assets-cache.json");
|
|
2324
2262
|
}
|
|
2325
2263
|
async load() {
|
|
2326
2264
|
if (this.cache) {
|
|
2327
2265
|
return this.cache;
|
|
2328
2266
|
}
|
|
2329
2267
|
try {
|
|
2330
|
-
const content = await
|
|
2268
|
+
const content = await fs4.readFile(this.cachePath, "utf-8");
|
|
2331
2269
|
this.cache = JSON.parse(content);
|
|
2332
2270
|
return this.cache;
|
|
2333
2271
|
} catch {
|
|
@@ -2342,9 +2280,9 @@ class AssetsCacheManager {
|
|
|
2342
2280
|
if (!this.cache) {
|
|
2343
2281
|
return;
|
|
2344
2282
|
}
|
|
2345
|
-
const cacheDir =
|
|
2346
|
-
await
|
|
2347
|
-
await
|
|
2283
|
+
const cacheDir = path4.dirname(this.cachePath);
|
|
2284
|
+
await fs4.mkdir(cacheDir, { recursive: true });
|
|
2285
|
+
await fs4.writeFile(this.cachePath, JSON.stringify(this.cache, null, 2), "utf-8");
|
|
2348
2286
|
}
|
|
2349
2287
|
async getEntry(assetPath) {
|
|
2350
2288
|
const cache = await this.load();
|
|
@@ -2387,8 +2325,8 @@ class AssetsCacheManager {
|
|
|
2387
2325
|
var init_cache = () => {};
|
|
2388
2326
|
|
|
2389
2327
|
// src/assets/manager.ts
|
|
2390
|
-
import
|
|
2391
|
-
import
|
|
2328
|
+
import fs5 from "fs/promises";
|
|
2329
|
+
import path5 from "path";
|
|
2392
2330
|
import crypto from "crypto";
|
|
2393
2331
|
|
|
2394
2332
|
class AssetsManager {
|
|
@@ -2400,7 +2338,7 @@ class AssetsManager {
|
|
|
2400
2338
|
cacheManager;
|
|
2401
2339
|
constructor(options) {
|
|
2402
2340
|
this.projectPath = options.projectPath;
|
|
2403
|
-
this.assetsPath =
|
|
2341
|
+
this.assetsPath = path5.join(this.projectPath, "assets");
|
|
2404
2342
|
this.botId = options.botId;
|
|
2405
2343
|
this.credentials = options.credentials;
|
|
2406
2344
|
this.cacheManager = new AssetsCacheManager(this.projectPath);
|
|
@@ -2438,7 +2376,7 @@ class AssetsManager {
|
|
|
2438
2376
|
}
|
|
2439
2377
|
async hasAssetsDirectory() {
|
|
2440
2378
|
try {
|
|
2441
|
-
const stats = await
|
|
2379
|
+
const stats = await fs5.stat(this.assetsPath);
|
|
2442
2380
|
return stats.isDirectory();
|
|
2443
2381
|
} catch {
|
|
2444
2382
|
return false;
|
|
@@ -2452,16 +2390,16 @@ class AssetsManager {
|
|
|
2452
2390
|
const assets = [];
|
|
2453
2391
|
for (const filePath of files) {
|
|
2454
2392
|
try {
|
|
2455
|
-
const stats = await
|
|
2393
|
+
const stats = await fs5.stat(filePath);
|
|
2456
2394
|
if (stats.isFile()) {
|
|
2457
|
-
const relativePath =
|
|
2458
|
-
const content = await
|
|
2395
|
+
const relativePath = path5.relative(this.assetsPath, filePath);
|
|
2396
|
+
const content = await fs5.readFile(filePath);
|
|
2459
2397
|
const hash = this.calculateHash(content);
|
|
2460
2398
|
const mime = this.getMimeType(filePath);
|
|
2461
2399
|
assets.push({
|
|
2462
2400
|
relativePath,
|
|
2463
2401
|
absolutePath: filePath,
|
|
2464
|
-
name:
|
|
2402
|
+
name: path5.basename(filePath),
|
|
2465
2403
|
size: stats.size,
|
|
2466
2404
|
mime,
|
|
2467
2405
|
hash,
|
|
@@ -2489,7 +2427,7 @@ class AssetsManager {
|
|
|
2489
2427
|
});
|
|
2490
2428
|
return response.files.map((file) => ({
|
|
2491
2429
|
path: file.tags?.path || file.key,
|
|
2492
|
-
name:
|
|
2430
|
+
name: path5.basename(file.tags?.path || file.key),
|
|
2493
2431
|
size: file.size || 0,
|
|
2494
2432
|
mime: file.contentType,
|
|
2495
2433
|
hash: file.tags?.hash || "",
|
|
@@ -2627,7 +2565,7 @@ class AssetsManager {
|
|
|
2627
2565
|
};
|
|
2628
2566
|
}
|
|
2629
2567
|
async uploadAsset(client, localFile) {
|
|
2630
|
-
const content = await
|
|
2568
|
+
const content = await fs5.readFile(localFile.absolutePath);
|
|
2631
2569
|
await client.uploadFile({
|
|
2632
2570
|
key: localFile.relativePath,
|
|
2633
2571
|
content,
|
|
@@ -2720,10 +2658,10 @@ declare global {
|
|
|
2720
2658
|
return enrichedAssets;
|
|
2721
2659
|
}
|
|
2722
2660
|
async scanDirectory(dir, files = []) {
|
|
2723
|
-
const items = await
|
|
2661
|
+
const items = await fs5.readdir(dir);
|
|
2724
2662
|
for (const item of items) {
|
|
2725
|
-
const fullPath =
|
|
2726
|
-
const stats = await
|
|
2663
|
+
const fullPath = path5.join(dir, item);
|
|
2664
|
+
const stats = await fs5.stat(fullPath);
|
|
2727
2665
|
if (stats.isDirectory()) {
|
|
2728
2666
|
await this.scanDirectory(fullPath, files);
|
|
2729
2667
|
} else {
|
|
@@ -2736,7 +2674,7 @@ declare global {
|
|
|
2736
2674
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
2737
2675
|
}
|
|
2738
2676
|
getMimeType(filePath) {
|
|
2739
|
-
const ext =
|
|
2677
|
+
const ext = path5.extname(filePath).toLowerCase();
|
|
2740
2678
|
const mimeTypes = {
|
|
2741
2679
|
".png": "image/png",
|
|
2742
2680
|
".jpg": "image/jpeg",
|
|
@@ -2772,10 +2710,10 @@ var init_manager2 = __esm(() => {
|
|
|
2772
2710
|
// src/utils/fs.ts
|
|
2773
2711
|
import { mkdir, writeFile } from "fs/promises";
|
|
2774
2712
|
import { parse } from "path";
|
|
2775
|
-
var createFile = async (
|
|
2776
|
-
const file = parse(
|
|
2713
|
+
var createFile = async (path6, content) => {
|
|
2714
|
+
const file = parse(path6);
|
|
2777
2715
|
await mkdir(file.dir, { recursive: true });
|
|
2778
|
-
await writeFile(
|
|
2716
|
+
await writeFile(path6, content);
|
|
2779
2717
|
};
|
|
2780
2718
|
var init_fs = () => {};
|
|
2781
2719
|
|
|
@@ -2793,19 +2731,19 @@ var init_assets = __esm(() => {
|
|
|
2793
2731
|
});
|
|
2794
2732
|
|
|
2795
2733
|
// src/integrations/cache.ts
|
|
2796
|
-
import
|
|
2797
|
-
import
|
|
2798
|
-
import
|
|
2734
|
+
import fs6 from "fs/promises";
|
|
2735
|
+
import path6 from "path";
|
|
2736
|
+
import os3 from "os";
|
|
2799
2737
|
|
|
2800
2738
|
class IntegrationCache {
|
|
2801
2739
|
cacheDir;
|
|
2802
2740
|
integrationsDir;
|
|
2803
2741
|
constructor() {
|
|
2804
|
-
this.cacheDir =
|
|
2805
|
-
this.integrationsDir =
|
|
2742
|
+
this.cacheDir = path6.join(os3.homedir(), ".adk", "cache");
|
|
2743
|
+
this.integrationsDir = path6.join(this.cacheDir, "integrations");
|
|
2806
2744
|
}
|
|
2807
2745
|
async ensureCacheDir() {
|
|
2808
|
-
await
|
|
2746
|
+
await fs6.mkdir(this.integrationsDir, { recursive: true });
|
|
2809
2747
|
}
|
|
2810
2748
|
getCacheKey(integrationId, updatedAt) {
|
|
2811
2749
|
const sanitizedId = integrationId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -2815,8 +2753,8 @@ class IntegrationCache {
|
|
|
2815
2753
|
async get(integrationId, updatedAt) {
|
|
2816
2754
|
try {
|
|
2817
2755
|
const cacheKey = this.getCacheKey(integrationId, updatedAt);
|
|
2818
|
-
const cachePath =
|
|
2819
|
-
const data = await
|
|
2756
|
+
const cachePath = path6.join(this.integrationsDir, cacheKey);
|
|
2757
|
+
const data = await fs6.readFile(cachePath, "utf-8");
|
|
2820
2758
|
const cached = JSON.parse(data);
|
|
2821
2759
|
if (cached.expiresAt) {
|
|
2822
2760
|
const expiryDate = new Date(cached.expiresAt);
|
|
@@ -2833,7 +2771,7 @@ class IntegrationCache {
|
|
|
2833
2771
|
async set(integrationId, updatedAt, definition, ttlHours = 24 * 7) {
|
|
2834
2772
|
await this.ensureCacheDir();
|
|
2835
2773
|
const cacheKey = this.getCacheKey(integrationId, updatedAt);
|
|
2836
|
-
const cachePath =
|
|
2774
|
+
const cachePath = path6.join(this.integrationsDir, cacheKey);
|
|
2837
2775
|
const expiresAt = new Date;
|
|
2838
2776
|
expiresAt.setHours(expiresAt.getHours() + ttlHours);
|
|
2839
2777
|
const cacheEntry = {
|
|
@@ -2841,27 +2779,27 @@ class IntegrationCache {
|
|
|
2841
2779
|
cachedAt: new Date().toISOString(),
|
|
2842
2780
|
expiresAt: expiresAt.toISOString()
|
|
2843
2781
|
};
|
|
2844
|
-
await
|
|
2782
|
+
await fs6.writeFile(cachePath, JSON.stringify(cacheEntry, null, 2));
|
|
2845
2783
|
}
|
|
2846
2784
|
async remove(integrationId, updatedAt) {
|
|
2847
2785
|
try {
|
|
2848
2786
|
const cacheKey = this.getCacheKey(integrationId, updatedAt);
|
|
2849
|
-
const cachePath =
|
|
2850
|
-
await
|
|
2787
|
+
const cachePath = path6.join(this.integrationsDir, cacheKey);
|
|
2788
|
+
await fs6.unlink(cachePath);
|
|
2851
2789
|
} catch {}
|
|
2852
2790
|
}
|
|
2853
2791
|
async clear() {
|
|
2854
2792
|
try {
|
|
2855
|
-
const files = await
|
|
2856
|
-
await Promise.all(files.map((file) =>
|
|
2793
|
+
const files = await fs6.readdir(this.integrationsDir);
|
|
2794
|
+
await Promise.all(files.map((file) => fs6.unlink(path6.join(this.integrationsDir, file))));
|
|
2857
2795
|
} catch {}
|
|
2858
2796
|
}
|
|
2859
2797
|
async getStats() {
|
|
2860
2798
|
try {
|
|
2861
|
-
const files = await
|
|
2799
|
+
const files = await fs6.readdir(this.integrationsDir);
|
|
2862
2800
|
let totalSize = 0;
|
|
2863
2801
|
for (const file of files) {
|
|
2864
|
-
const stats = await
|
|
2802
|
+
const stats = await fs6.stat(path6.join(this.integrationsDir, file));
|
|
2865
2803
|
totalSize += stats.size;
|
|
2866
2804
|
}
|
|
2867
2805
|
return {
|
|
@@ -3241,7 +3179,7 @@ function stringifyWithOrder(obj, keyOrder, space = 2) {
|
|
|
3241
3179
|
var agentInfoKeyOrder, agentLocalInfoKeyOrder, dependenciesKeyOrder, integrationKeyOrder;
|
|
3242
3180
|
var init_json_ordering = __esm(() => {
|
|
3243
3181
|
agentInfoKeyOrder = ["botId", "workspaceId", "apiUrl"];
|
|
3244
|
-
agentLocalInfoKeyOrder = ["botId", "workspaceId", "apiUrl", "devId"];
|
|
3182
|
+
agentLocalInfoKeyOrder = ["botId", "workspaceId", "apiUrl", "devId", "tunnelId"];
|
|
3245
3183
|
dependenciesKeyOrder = ["integrations"];
|
|
3246
3184
|
integrationKeyOrder = ["version", "enabled", "configurationType", "config"];
|
|
3247
3185
|
});
|
|
@@ -3350,7 +3288,7 @@ var init_component_files = __esm(() => {
|
|
|
3350
3288
|
// src/agent-project/component-source-resolver.ts
|
|
3351
3289
|
import { Project, SyntaxKind } from "ts-morph";
|
|
3352
3290
|
import { readFileSync } from "fs";
|
|
3353
|
-
import * as
|
|
3291
|
+
import * as path7 from "path";
|
|
3354
3292
|
function resolveComponentSources(absolutePath) {
|
|
3355
3293
|
const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
|
|
3356
3294
|
const sourceFile = project.createSourceFile(absolutePath, readFileSync(absolutePath, "utf-8"), { overwrite: true });
|
|
@@ -3363,12 +3301,12 @@ function resolveComponentSources(absolutePath) {
|
|
|
3363
3301
|
}
|
|
3364
3302
|
function collectBpTsxImports(sourceFile, absolutePath) {
|
|
3365
3303
|
const imports = new Map;
|
|
3366
|
-
const dir =
|
|
3304
|
+
const dir = path7.dirname(absolutePath);
|
|
3367
3305
|
for (const decl of sourceFile.getImportDeclarations()) {
|
|
3368
3306
|
const specifier = decl.getModuleSpecifierValue();
|
|
3369
3307
|
if (!specifier.endsWith(BP_TSX_SUFFIX))
|
|
3370
3308
|
continue;
|
|
3371
|
-
const resolved =
|
|
3309
|
+
const resolved = path7.resolve(dir, specifier);
|
|
3372
3310
|
const defaultImport = decl.getDefaultImport();
|
|
3373
3311
|
if (defaultImport) {
|
|
3374
3312
|
imports.set(defaultImport.getText(), resolved);
|
|
@@ -3495,25 +3433,25 @@ var init_alias_utils = __esm(() => {
|
|
|
3495
3433
|
});
|
|
3496
3434
|
|
|
3497
3435
|
// src/dependencies/snapshot-store.ts
|
|
3498
|
-
import * as
|
|
3499
|
-
import * as
|
|
3436
|
+
import * as fs7 from "fs/promises";
|
|
3437
|
+
import * as path8 from "path";
|
|
3500
3438
|
|
|
3501
3439
|
class DependencySnapshotStore {
|
|
3502
3440
|
projectPath;
|
|
3503
3441
|
dirPath;
|
|
3504
3442
|
constructor(opts) {
|
|
3505
3443
|
this.projectPath = opts.projectPath;
|
|
3506
|
-
this.dirPath =
|
|
3444
|
+
this.dirPath = path8.join(opts.projectPath, ".adk", "dependencies");
|
|
3507
3445
|
}
|
|
3508
3446
|
getSnapshotPath(env) {
|
|
3509
|
-
return
|
|
3447
|
+
return path8.join(this.dirPath, `${env}.json`);
|
|
3510
3448
|
}
|
|
3511
3449
|
getMigrationMarkerPath() {
|
|
3512
|
-
return
|
|
3450
|
+
return path8.join(this.dirPath, "migration.json");
|
|
3513
3451
|
}
|
|
3514
3452
|
async exists(env) {
|
|
3515
3453
|
try {
|
|
3516
|
-
await
|
|
3454
|
+
await fs7.access(this.getSnapshotPath(env));
|
|
3517
3455
|
return true;
|
|
3518
3456
|
} catch {
|
|
3519
3457
|
return false;
|
|
@@ -3523,9 +3461,10 @@ class DependencySnapshotStore {
|
|
|
3523
3461
|
const filePath = this.getSnapshotPath(env);
|
|
3524
3462
|
let raw;
|
|
3525
3463
|
try {
|
|
3526
|
-
raw = await
|
|
3464
|
+
raw = await fs7.readFile(filePath, "utf8");
|
|
3527
3465
|
} catch (err) {
|
|
3528
|
-
|
|
3466
|
+
const code = err.code;
|
|
3467
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
3529
3468
|
return null;
|
|
3530
3469
|
throw err;
|
|
3531
3470
|
}
|
|
@@ -3547,16 +3486,16 @@ class DependencySnapshotStore {
|
|
|
3547
3486
|
}
|
|
3548
3487
|
async write(snapshot) {
|
|
3549
3488
|
const validated = dependencySnapshotSchema.parse(snapshot);
|
|
3550
|
-
await
|
|
3489
|
+
await fs7.mkdir(this.dirPath, { recursive: true });
|
|
3551
3490
|
const filePath = this.getSnapshotPath(validated.env);
|
|
3552
3491
|
const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
3553
|
-
await
|
|
3492
|
+
await fs7.writeFile(tmp, JSON.stringify(sortKeysDeep(validated), null, 2) + `
|
|
3554
3493
|
`, "utf8");
|
|
3555
|
-
await
|
|
3494
|
+
await fs7.rename(tmp, filePath);
|
|
3556
3495
|
}
|
|
3557
3496
|
async delete(env) {
|
|
3558
3497
|
try {
|
|
3559
|
-
await
|
|
3498
|
+
await fs7.unlink(this.getSnapshotPath(env));
|
|
3560
3499
|
} catch (err) {
|
|
3561
3500
|
if (err.code !== "ENOENT")
|
|
3562
3501
|
throw err;
|
|
@@ -3564,7 +3503,7 @@ class DependencySnapshotStore {
|
|
|
3564
3503
|
}
|
|
3565
3504
|
async hasMigrationMarker() {
|
|
3566
3505
|
try {
|
|
3567
|
-
await
|
|
3506
|
+
await fs7.access(this.getMigrationMarkerPath());
|
|
3568
3507
|
return true;
|
|
3569
3508
|
} catch {
|
|
3570
3509
|
return false;
|
|
@@ -3572,12 +3511,12 @@ class DependencySnapshotStore {
|
|
|
3572
3511
|
}
|
|
3573
3512
|
async writeMigrationMarker(marker) {
|
|
3574
3513
|
const validated = dependencyMigrationMarkerSchema.parse(marker);
|
|
3575
|
-
await
|
|
3514
|
+
await fs7.mkdir(this.dirPath, { recursive: true });
|
|
3576
3515
|
const filePath = this.getMigrationMarkerPath();
|
|
3577
3516
|
const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
3578
|
-
await
|
|
3517
|
+
await fs7.writeFile(tmp, JSON.stringify(sortKeysDeep(validated), null, 2) + `
|
|
3579
3518
|
`, "utf8");
|
|
3580
|
-
await
|
|
3519
|
+
await fs7.rename(tmp, filePath);
|
|
3581
3520
|
}
|
|
3582
3521
|
async refreshFromCloud(opts) {
|
|
3583
3522
|
const previous = await this.readForRefresh(opts.env, opts.onWarning);
|
|
@@ -3710,7 +3649,10 @@ function dependencySnapshotFromBot(opts) {
|
|
|
3710
3649
|
const dependencies = {};
|
|
3711
3650
|
for (const [ifaceAlias, dep] of Object.entries(cloud.interfaces ?? {})) {
|
|
3712
3651
|
if (typeof dep.integrationAlias === "string") {
|
|
3713
|
-
dependencies[ifaceAlias] = {
|
|
3652
|
+
dependencies[ifaceAlias] = {
|
|
3653
|
+
integrationAlias: dep.integrationAlias,
|
|
3654
|
+
...typeof dep.integrationInterfaceAlias === "string" && dep.integrationInterfaceAlias ? { integrationInterfaceAlias: dep.integrationInterfaceAlias } : {}
|
|
3655
|
+
};
|
|
3714
3656
|
}
|
|
3715
3657
|
}
|
|
3716
3658
|
const alias = chooseCloudAlias({
|
|
@@ -3767,6 +3709,152 @@ var init_snapshot_store = __esm(() => {
|
|
|
3767
3709
|
init_types();
|
|
3768
3710
|
});
|
|
3769
3711
|
|
|
3712
|
+
// src/utils/adk-ignore.ts
|
|
3713
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
3714
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
3715
|
+
import { join as join2 } from "path";
|
|
3716
|
+
async function loadAdkIgnoreMatcher(projectPath) {
|
|
3717
|
+
try {
|
|
3718
|
+
return parseAdkIgnore(await readFile2(join2(projectPath, ADK_IGNORE_FILE), "utf-8"));
|
|
3719
|
+
} catch {
|
|
3720
|
+
return EMPTY_MATCHER;
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
function loadAdkIgnoreMatcherSync(projectPath) {
|
|
3724
|
+
try {
|
|
3725
|
+
return parseAdkIgnore(readFileSync2(join2(projectPath, ADK_IGNORE_FILE), "utf-8"));
|
|
3726
|
+
} catch {
|
|
3727
|
+
return EMPTY_MATCHER;
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3730
|
+
function parseAdkIgnore(contents) {
|
|
3731
|
+
const rules = contents.split(/\r?\n/).map(parseIgnoreRule).filter((rule) => rule !== null);
|
|
3732
|
+
if (rules.length === 0) {
|
|
3733
|
+
return EMPTY_MATCHER;
|
|
3734
|
+
}
|
|
3735
|
+
return {
|
|
3736
|
+
hasRules: true,
|
|
3737
|
+
ignores: (relativePath) => {
|
|
3738
|
+
const normalized = normalizePath(relativePath);
|
|
3739
|
+
if (!normalized)
|
|
3740
|
+
return false;
|
|
3741
|
+
let ignored = false;
|
|
3742
|
+
for (const rule of rules) {
|
|
3743
|
+
if (matchesRule(rule, normalized)) {
|
|
3744
|
+
ignored = !rule.negated;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
return ignored;
|
|
3748
|
+
},
|
|
3749
|
+
canReincludeDescendant: (relativeDirectoryPath) => {
|
|
3750
|
+
const normalized = normalizePath(relativeDirectoryPath).replace(/\/+$/, "");
|
|
3751
|
+
if (!normalized)
|
|
3752
|
+
return false;
|
|
3753
|
+
return rules.some((rule) => {
|
|
3754
|
+
if (!rule.negated) {
|
|
3755
|
+
return false;
|
|
3756
|
+
}
|
|
3757
|
+
if (!rule.hasSlash || rule.literalPrefix === "") {
|
|
3758
|
+
return true;
|
|
3759
|
+
}
|
|
3760
|
+
return normalized.startsWith(rule.literalPrefix) || rule.literalPrefix.startsWith(`${normalized}/`);
|
|
3761
|
+
});
|
|
3762
|
+
}
|
|
3763
|
+
};
|
|
3764
|
+
}
|
|
3765
|
+
function parseIgnoreRule(rawLine) {
|
|
3766
|
+
let line = rawLine.trim();
|
|
3767
|
+
if (!line || line.startsWith("#")) {
|
|
3768
|
+
return null;
|
|
3769
|
+
}
|
|
3770
|
+
if (line.startsWith("\\#") || line.startsWith("\\!")) {
|
|
3771
|
+
line = line.slice(1);
|
|
3772
|
+
}
|
|
3773
|
+
let negated = false;
|
|
3774
|
+
if (line.startsWith("!")) {
|
|
3775
|
+
negated = true;
|
|
3776
|
+
line = line.slice(1).trim();
|
|
3777
|
+
if (!line)
|
|
3778
|
+
return null;
|
|
3779
|
+
}
|
|
3780
|
+
const { pattern: normalized, anchored } = normalizePattern(line);
|
|
3781
|
+
let pattern = normalized;
|
|
3782
|
+
if (!pattern)
|
|
3783
|
+
return null;
|
|
3784
|
+
while (pattern.endsWith("/")) {
|
|
3785
|
+
pattern = pattern.slice(0, -1);
|
|
3786
|
+
}
|
|
3787
|
+
if (!pattern)
|
|
3788
|
+
return null;
|
|
3789
|
+
const hasSlash = anchored || pattern.includes("/");
|
|
3790
|
+
const regexSource = globToRegexSource(pattern);
|
|
3791
|
+
return {
|
|
3792
|
+
negated,
|
|
3793
|
+
hasSlash,
|
|
3794
|
+
literalPrefix: getLiteralPrefix(pattern),
|
|
3795
|
+
fullPathRegex: new RegExp(`^${regexSource}(?:/.*)?$`),
|
|
3796
|
+
segmentRegex: new RegExp(`^${regexSource}$`)
|
|
3797
|
+
};
|
|
3798
|
+
}
|
|
3799
|
+
function matchesRule(rule, relativePath) {
|
|
3800
|
+
if (rule.hasSlash) {
|
|
3801
|
+
return rule.fullPathRegex.test(relativePath);
|
|
3802
|
+
}
|
|
3803
|
+
return relativePath.split("/").some((segment) => rule.segmentRegex.test(segment));
|
|
3804
|
+
}
|
|
3805
|
+
function normalizePath(value) {
|
|
3806
|
+
return value.replace(/\\/g, "/").replace(/^\.\/+/, "").replace(/^\/+/, "");
|
|
3807
|
+
}
|
|
3808
|
+
function normalizePattern(value) {
|
|
3809
|
+
const normalized = value.replace(/\\/g, "/").replace(/^\.\/+/, "");
|
|
3810
|
+
return {
|
|
3811
|
+
anchored: normalized.startsWith("/"),
|
|
3812
|
+
pattern: normalized.replace(/^\/+/, "")
|
|
3813
|
+
};
|
|
3814
|
+
}
|
|
3815
|
+
function globToRegexSource(pattern) {
|
|
3816
|
+
let out = "";
|
|
3817
|
+
for (let i = 0;i < pattern.length; i++) {
|
|
3818
|
+
const char = pattern[i];
|
|
3819
|
+
if (char === "*") {
|
|
3820
|
+
if (pattern[i + 1] === "*") {
|
|
3821
|
+
while (pattern[i + 1] === "*")
|
|
3822
|
+
i++;
|
|
3823
|
+
if (pattern[i + 1] === "/") {
|
|
3824
|
+
out += "(?:.*/)?";
|
|
3825
|
+
i++;
|
|
3826
|
+
} else {
|
|
3827
|
+
out += ".*";
|
|
3828
|
+
}
|
|
3829
|
+
} else {
|
|
3830
|
+
out += "[^/]*";
|
|
3831
|
+
}
|
|
3832
|
+
continue;
|
|
3833
|
+
}
|
|
3834
|
+
if (char === "?") {
|
|
3835
|
+
out += "[^/]";
|
|
3836
|
+
continue;
|
|
3837
|
+
}
|
|
3838
|
+
out += escapeRegex(char);
|
|
3839
|
+
}
|
|
3840
|
+
return out;
|
|
3841
|
+
}
|
|
3842
|
+
function getLiteralPrefix(pattern) {
|
|
3843
|
+
const globIndex = pattern.search(/[*?]/);
|
|
3844
|
+
return globIndex === -1 ? pattern : pattern.slice(0, globIndex);
|
|
3845
|
+
}
|
|
3846
|
+
function escapeRegex(value) {
|
|
3847
|
+
return value.replace(/[|\\{}()[\]^$+?.]/g, "\\$&");
|
|
3848
|
+
}
|
|
3849
|
+
var ADK_IGNORE_FILE = ".adkignore", EMPTY_MATCHER;
|
|
3850
|
+
var init_adk_ignore = __esm(() => {
|
|
3851
|
+
EMPTY_MATCHER = {
|
|
3852
|
+
hasRules: false,
|
|
3853
|
+
ignores: () => false,
|
|
3854
|
+
canReincludeDescendant: () => false
|
|
3855
|
+
};
|
|
3856
|
+
});
|
|
3857
|
+
|
|
3770
3858
|
// src/agent-project/dependency-state-to-dependencies.ts
|
|
3771
3859
|
function dependencyStateToDependencies(state) {
|
|
3772
3860
|
const integrations = {};
|
|
@@ -3795,8 +3883,8 @@ import { BuiltInActions, BuiltInWorkflows, Errors as Errors2, Primitives as Prim
|
|
|
3795
3883
|
import { Autonomous } from "@botpress/runtime";
|
|
3796
3884
|
import createDebug from "debug";
|
|
3797
3885
|
import { createRequire as createRequire2 } from "module";
|
|
3798
|
-
import
|
|
3799
|
-
import
|
|
3886
|
+
import fs8 from "fs/promises";
|
|
3887
|
+
import path9 from "path";
|
|
3800
3888
|
function getToolDefinition(value) {
|
|
3801
3889
|
if (typeof value !== "object" || value === null) {
|
|
3802
3890
|
return;
|
|
@@ -3828,6 +3916,7 @@ var init_agent_project = __esm(() => {
|
|
|
3828
3916
|
init_table_validation();
|
|
3829
3917
|
init_constants();
|
|
3830
3918
|
init_snapshot_store();
|
|
3919
|
+
init_adk_ignore();
|
|
3831
3920
|
debug = createDebug("adk:agent-project");
|
|
3832
3921
|
AgentProject = class AgentProject {
|
|
3833
3922
|
static _projectCache = new Map;
|
|
@@ -3855,7 +3944,7 @@ var init_agent_project = __esm(() => {
|
|
|
3855
3944
|
_tools = [];
|
|
3856
3945
|
constructor(projectPath, options = {}) {
|
|
3857
3946
|
this._options = options;
|
|
3858
|
-
this._path =
|
|
3947
|
+
this._path = path9.resolve(projectPath);
|
|
3859
3948
|
this._integrationManager = new IntegrationManager({
|
|
3860
3949
|
noCache: options.noCache
|
|
3861
3950
|
});
|
|
@@ -3867,7 +3956,7 @@ var init_agent_project = __esm(() => {
|
|
|
3867
3956
|
});
|
|
3868
3957
|
}
|
|
3869
3958
|
static async load(projectPath, options = {}) {
|
|
3870
|
-
const resolvedPath =
|
|
3959
|
+
const resolvedPath = path9.resolve(projectPath);
|
|
3871
3960
|
const cacheKey = AgentProject._getCacheKey(resolvedPath, options);
|
|
3872
3961
|
if (!options.noCache) {
|
|
3873
3962
|
const cached = AgentProject._projectCache.get(cacheKey);
|
|
@@ -3891,7 +3980,7 @@ var init_agent_project = __esm(() => {
|
|
|
3891
3980
|
AgentProject._projectCache.clear();
|
|
3892
3981
|
}
|
|
3893
3982
|
static clearCacheForPath(projectPath) {
|
|
3894
|
-
const resolvedPath =
|
|
3983
|
+
const resolvedPath = path9.resolve(projectPath);
|
|
3895
3984
|
const prefix = `${resolvedPath}\x00`;
|
|
3896
3985
|
for (const key of AgentProject._projectCache.keys()) {
|
|
3897
3986
|
if (key.startsWith(prefix)) {
|
|
@@ -4012,17 +4101,17 @@ var init_agent_project = __esm(() => {
|
|
|
4012
4101
|
const warnings = [];
|
|
4013
4102
|
const info = [];
|
|
4014
4103
|
try {
|
|
4015
|
-
await
|
|
4104
|
+
await fs8.access(this._path);
|
|
4016
4105
|
const requiredFiles = ["agent.config.ts"];
|
|
4017
4106
|
for (const file of requiredFiles) {
|
|
4018
4107
|
try {
|
|
4019
|
-
await
|
|
4108
|
+
await fs8.access(path9.join(this._path, file));
|
|
4020
4109
|
} catch {
|
|
4021
4110
|
errors.push(ValidationErrors.requiredFileMissing(file));
|
|
4022
4111
|
}
|
|
4023
4112
|
}
|
|
4024
4113
|
try {
|
|
4025
|
-
await
|
|
4114
|
+
await fs8.access(path9.join(this._path, "agent.json"));
|
|
4026
4115
|
} catch {
|
|
4027
4116
|
info.push({
|
|
4028
4117
|
$type: "ValidationError",
|
|
@@ -4036,7 +4125,7 @@ var init_agent_project = __esm(() => {
|
|
|
4036
4125
|
const expectedDirs = ["actions", "workflows", "conversations", "assets"];
|
|
4037
4126
|
for (const dir of expectedDirs) {
|
|
4038
4127
|
try {
|
|
4039
|
-
const stats = await
|
|
4128
|
+
const stats = await fs8.stat(path9.join(this._path, dir));
|
|
4040
4129
|
if (!stats.isDirectory()) {
|
|
4041
4130
|
warnings.push(ValidationErrors.invalidStructure(dir, "directory"));
|
|
4042
4131
|
}
|
|
@@ -4048,6 +4137,12 @@ var init_agent_project = __esm(() => {
|
|
|
4048
4137
|
for (const violation of findTableColumnViolations(this._tables)) {
|
|
4049
4138
|
errors.push(ValidationErrors.tableTooManyColumns(violation.name, violation.path, violation.columnCount, MAX_TABLE_COLUMNS));
|
|
4050
4139
|
}
|
|
4140
|
+
for (const action of this._actions) {
|
|
4141
|
+
const description = action.definition.description;
|
|
4142
|
+
if (description && description.length > MAX_ACTION_DESCRIPTION_LENGTH) {
|
|
4143
|
+
warnings.push(ValidationErrors.warning(`Action '${action.definition.name}' description is ${description.length} characters; ADK truncates it to ${MAX_ACTION_DESCRIPTION_LENGTH} at deploy (platform limit).`, action.path, `Shorten the description to ${MAX_ACTION_DESCRIPTION_LENGTH} characters or fewer to control what is kept.`));
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4051
4146
|
const errorsBySeverity = {
|
|
4052
4147
|
errors: errors.filter((e) => e.severity === "error" /* ERROR */),
|
|
4053
4148
|
warnings: [...warnings, ...errors.filter((e) => e.severity === "warning" /* WARNING */)],
|
|
@@ -4124,9 +4219,9 @@ var init_agent_project = __esm(() => {
|
|
|
4124
4219
|
workspaceId: info.workspaceId,
|
|
4125
4220
|
apiUrl: info.apiUrl
|
|
4126
4221
|
};
|
|
4127
|
-
const agentPath =
|
|
4222
|
+
const agentPath = path9.join(this._path, "agent.json");
|
|
4128
4223
|
const agentContent = stringifyWithOrder(agentJsonData, agentInfoKeyOrder);
|
|
4129
|
-
await
|
|
4224
|
+
await fs8.writeFile(agentPath, agentContent);
|
|
4130
4225
|
this._agentInfo = agentJsonData;
|
|
4131
4226
|
}
|
|
4132
4227
|
async updateAgentInfo(updates) {
|
|
@@ -4148,21 +4243,21 @@ var init_agent_project = __esm(() => {
|
|
|
4148
4243
|
workspaceId: updatedInfo.workspaceId,
|
|
4149
4244
|
apiUrl: updatedInfo.apiUrl
|
|
4150
4245
|
};
|
|
4151
|
-
const agentPath =
|
|
4246
|
+
const agentPath = path9.join(this._path, "agent.json");
|
|
4152
4247
|
const agentContent = stringifyWithOrder(agentJsonData, agentInfoKeyOrder);
|
|
4153
|
-
await
|
|
4248
|
+
await fs8.writeFile(agentPath, agentContent);
|
|
4154
4249
|
this._agentInfo = updatedInfo;
|
|
4155
4250
|
}
|
|
4156
4251
|
async createAgentLocalInfo(info) {
|
|
4157
|
-
const localPath =
|
|
4252
|
+
const localPath = path9.join(this._path, "agent.local.json");
|
|
4158
4253
|
let existing = {};
|
|
4159
4254
|
try {
|
|
4160
|
-
const content2 = await
|
|
4255
|
+
const content2 = await fs8.readFile(localPath, "utf-8");
|
|
4161
4256
|
existing = JSON.parse(content2);
|
|
4162
4257
|
} catch {}
|
|
4163
4258
|
const merged = { ...existing, ...info };
|
|
4164
4259
|
const content = stringifyWithOrder(merged, agentLocalInfoKeyOrder);
|
|
4165
|
-
await
|
|
4260
|
+
await fs8.writeFile(localPath, content);
|
|
4166
4261
|
if (this._agentInfo) {
|
|
4167
4262
|
if (merged.botId)
|
|
4168
4263
|
this._agentInfo.botId = merged.botId;
|
|
@@ -4172,20 +4267,23 @@ var init_agent_project = __esm(() => {
|
|
|
4172
4267
|
this._agentInfo.apiUrl = merged.apiUrl;
|
|
4173
4268
|
if (merged.devId)
|
|
4174
4269
|
this._agentInfo.devId = merged.devId;
|
|
4270
|
+
if (merged.tunnelId)
|
|
4271
|
+
this._agentInfo.tunnelId = merged.tunnelId;
|
|
4175
4272
|
} else if (merged.botId && merged.workspaceId) {
|
|
4176
4273
|
this._agentInfo = {
|
|
4177
4274
|
botId: merged.botId,
|
|
4178
4275
|
workspaceId: merged.workspaceId,
|
|
4179
4276
|
apiUrl: merged.apiUrl,
|
|
4180
|
-
devId: merged.devId
|
|
4277
|
+
devId: merged.devId,
|
|
4278
|
+
tunnelId: merged.tunnelId
|
|
4181
4279
|
};
|
|
4182
4280
|
}
|
|
4183
4281
|
}
|
|
4184
4282
|
async updateAgentLocalInfo(updates) {
|
|
4185
|
-
const localPath =
|
|
4283
|
+
const localPath = path9.join(this._path, "agent.local.json");
|
|
4186
4284
|
let existing = {};
|
|
4187
4285
|
try {
|
|
4188
|
-
const content = await
|
|
4286
|
+
const content = await fs8.readFile(localPath, "utf-8");
|
|
4189
4287
|
existing = JSON.parse(content);
|
|
4190
4288
|
} catch {}
|
|
4191
4289
|
const updated = { ...existing, ...updates };
|
|
@@ -4196,21 +4294,21 @@ var init_agent_project = __esm(() => {
|
|
|
4196
4294
|
}
|
|
4197
4295
|
if (Object.keys(updated).length === 0) {
|
|
4198
4296
|
try {
|
|
4199
|
-
await
|
|
4297
|
+
await fs8.unlink(localPath);
|
|
4200
4298
|
} catch {}
|
|
4201
4299
|
} else {
|
|
4202
4300
|
const content = stringifyWithOrder(updated, agentLocalInfoKeyOrder);
|
|
4203
|
-
await
|
|
4301
|
+
await fs8.writeFile(localPath, content);
|
|
4204
4302
|
}
|
|
4205
4303
|
if (this._agentInfo) {
|
|
4206
|
-
const agentJsonPath =
|
|
4304
|
+
const agentJsonPath = path9.join(this._path, "agent.json");
|
|
4207
4305
|
let base = {
|
|
4208
4306
|
botId: this._agentInfo.botId,
|
|
4209
4307
|
workspaceId: this._agentInfo.workspaceId,
|
|
4210
4308
|
apiUrl: this._agentInfo.apiUrl
|
|
4211
4309
|
};
|
|
4212
4310
|
try {
|
|
4213
|
-
const agentJsonContent = await
|
|
4311
|
+
const agentJsonContent = await fs8.readFile(agentJsonPath, "utf-8");
|
|
4214
4312
|
const parsed = agentInfoSchema.parse(JSON.parse(agentJsonContent));
|
|
4215
4313
|
base = {
|
|
4216
4314
|
botId: parsed.botId,
|
|
@@ -4223,7 +4321,8 @@ var init_agent_project = __esm(() => {
|
|
|
4223
4321
|
botId: local.botId ?? base.botId,
|
|
4224
4322
|
workspaceId: local.workspaceId ?? base.workspaceId,
|
|
4225
4323
|
apiUrl: local.apiUrl ?? base.apiUrl,
|
|
4226
|
-
devId: local.devId
|
|
4324
|
+
devId: local.devId,
|
|
4325
|
+
tunnelId: local.tunnelId
|
|
4227
4326
|
};
|
|
4228
4327
|
}
|
|
4229
4328
|
}
|
|
@@ -4242,10 +4341,10 @@ var init_agent_project = __esm(() => {
|
|
|
4242
4341
|
this._integrations = [];
|
|
4243
4342
|
this._interfaces = [];
|
|
4244
4343
|
try {
|
|
4245
|
-
const configPath =
|
|
4344
|
+
const configPath = path9.join(this._path, "agent.config.ts");
|
|
4246
4345
|
debug("loading agent.config.ts from %s", configPath);
|
|
4247
|
-
const projectRequire = createRequire2(
|
|
4248
|
-
debug("created projectRequire from %s",
|
|
4346
|
+
const projectRequire = createRequire2(path9.join(this._path, "package.json"));
|
|
4347
|
+
debug("created projectRequire from %s", path9.join(this._path, "package.json"));
|
|
4249
4348
|
try {
|
|
4250
4349
|
const resolvedPath = projectRequire.resolve(configPath);
|
|
4251
4350
|
debug("resolved config path: %s", resolvedPath);
|
|
@@ -4292,7 +4391,6 @@ var init_agent_project = __esm(() => {
|
|
|
4292
4391
|
const dependencyEnv = this._options.adkCommand === "adk-deploy" ? "prod" : "dev";
|
|
4293
4392
|
const snapshotStore = new DependencySnapshotStore({ projectPath: this._path });
|
|
4294
4393
|
let snapshotBasedDependencies;
|
|
4295
|
-
let dependencySnapshotReadFailed = false;
|
|
4296
4394
|
try {
|
|
4297
4395
|
const snapshot = await snapshotStore.read(dependencyEnv);
|
|
4298
4396
|
const state = snapshot ?? { version: 1, env: dependencyEnv, integrations: {}, plugins: {} };
|
|
@@ -4308,7 +4406,6 @@ var init_agent_project = __esm(() => {
|
|
|
4308
4406
|
message: `Could not read .adk/dependencies/${dependencyEnv}.json: ${err.message}. Refresh dependencies from Cloud; agent.config.ts dependencies is not used when a snapshot exists but is invalid.`,
|
|
4309
4407
|
file: `.adk/dependencies/${dependencyEnv}.json`
|
|
4310
4408
|
});
|
|
4311
|
-
dependencySnapshotReadFailed = true;
|
|
4312
4409
|
}
|
|
4313
4410
|
if (snapshotBasedDependencies) {
|
|
4314
4411
|
this._dependencies = snapshotBasedDependencies;
|
|
@@ -4422,8 +4519,8 @@ ${err.stack?.split(`
|
|
|
4422
4519
|
}
|
|
4423
4520
|
}
|
|
4424
4521
|
isBarrelReexport(existing, newPath, newExport, newDefinition) {
|
|
4425
|
-
const isNewBarrel = /^index\.[tj]s$/i.test(
|
|
4426
|
-
const isExistingBarrel = /^index\.[tj]s$/i.test(
|
|
4522
|
+
const isNewBarrel = /^index\.[tj]s$/i.test(path9.basename(newPath));
|
|
4523
|
+
const isExistingBarrel = /^index\.[tj]s$/i.test(path9.basename(existing.path));
|
|
4427
4524
|
if (!isNewBarrel && !isExistingBarrel) {
|
|
4428
4525
|
return false;
|
|
4429
4526
|
}
|
|
@@ -4435,16 +4532,16 @@ ${err.stack?.split(`
|
|
|
4435
4532
|
return true;
|
|
4436
4533
|
}
|
|
4437
4534
|
isToolBarrelReexport(existingPath, newPath) {
|
|
4438
|
-
const isNewBarrel = /^index\.[tj]s$/i.test(
|
|
4439
|
-
const isExistingBarrel = /^index\.[tj]s$/i.test(
|
|
4535
|
+
const isNewBarrel = /^index\.[tj]s$/i.test(path9.basename(newPath));
|
|
4536
|
+
const isExistingBarrel = /^index\.[tj]s$/i.test(path9.basename(existingPath));
|
|
4440
4537
|
if (!isNewBarrel && !isExistingBarrel) {
|
|
4441
4538
|
return false;
|
|
4442
4539
|
}
|
|
4443
4540
|
return true;
|
|
4444
4541
|
}
|
|
4445
4542
|
shouldPreferToolDefinition(existingPath, newPath) {
|
|
4446
|
-
const isNewBarrel = /^index\.[tj]s$/i.test(
|
|
4447
|
-
const isExistingBarrel = /^index\.[tj]s$/i.test(
|
|
4543
|
+
const isNewBarrel = /^index\.[tj]s$/i.test(path9.basename(newPath));
|
|
4544
|
+
const isExistingBarrel = /^index\.[tj]s$/i.test(path9.basename(existingPath));
|
|
4448
4545
|
return isExistingBarrel && !isNewBarrel;
|
|
4449
4546
|
}
|
|
4450
4547
|
getChannelsList(channelSpec) {
|
|
@@ -4457,11 +4554,83 @@ ${err.stack?.split(`
|
|
|
4457
4554
|
}
|
|
4458
4555
|
}
|
|
4459
4556
|
async loadAgentPrimitives() {
|
|
4557
|
+
const before = this.snapshotPrimitiveState();
|
|
4558
|
+
await this.scanPrimitivesInto(path9.join(this._path, "src"), this._path);
|
|
4559
|
+
if (!this.scanRaisedLoadFailure(before.warnings)) {
|
|
4560
|
+
return;
|
|
4561
|
+
}
|
|
4562
|
+
const freshRoot = await this.makeFreshScanCopy().catch(() => null);
|
|
4563
|
+
if (!freshRoot) {
|
|
4564
|
+
return;
|
|
4565
|
+
}
|
|
4566
|
+
try {
|
|
4567
|
+
this.restorePrimitiveState(before);
|
|
4568
|
+
await this.scanPrimitivesInto(path9.join(freshRoot, "src"), freshRoot);
|
|
4569
|
+
for (const component of this._customComponents.slice(before.customComponents)) {
|
|
4570
|
+
if (component.source && component.source.startsWith(freshRoot)) {
|
|
4571
|
+
component.source = this._path + component.source.slice(freshRoot.length);
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
} finally {
|
|
4575
|
+
await fs8.rm(freshRoot, { recursive: true, force: true }).catch(() => {});
|
|
4576
|
+
}
|
|
4577
|
+
}
|
|
4578
|
+
snapshotPrimitiveState() {
|
|
4579
|
+
return {
|
|
4580
|
+
conversations: this._conversations.length,
|
|
4581
|
+
knowledge: this._knowledge.length,
|
|
4582
|
+
triggers: this._triggers.length,
|
|
4583
|
+
workflows: this._workflows.length,
|
|
4584
|
+
actions: this._actions.length,
|
|
4585
|
+
tables: this._tables.length,
|
|
4586
|
+
customComponents: this._customComponents.length,
|
|
4587
|
+
tools: this._tools.length,
|
|
4588
|
+
warnings: this._warnings.length,
|
|
4589
|
+
errors: this._errors.length
|
|
4590
|
+
};
|
|
4591
|
+
}
|
|
4592
|
+
restorePrimitiveState(state) {
|
|
4593
|
+
this._conversations.length = state.conversations;
|
|
4594
|
+
this._knowledge.length = state.knowledge;
|
|
4595
|
+
this._triggers.length = state.triggers;
|
|
4596
|
+
this._workflows.length = state.workflows;
|
|
4597
|
+
this._actions.length = state.actions;
|
|
4598
|
+
this._tables.length = state.tables;
|
|
4599
|
+
this._customComponents.length = state.customComponents;
|
|
4600
|
+
this._tools.length = state.tools;
|
|
4601
|
+
this._warnings.length = state.warnings;
|
|
4602
|
+
this._errors.length = state.errors;
|
|
4603
|
+
}
|
|
4604
|
+
scanRaisedLoadFailure(warningsBefore) {
|
|
4605
|
+
return this._warnings.slice(warningsBefore).some((w) => w.code === "INVALID_PRIMITIVE_DEFINITION" /* INVALID_PRIMITIVE_DEFINITION */ || w.code === "IMPORT_ERROR" /* IMPORT_ERROR */);
|
|
4606
|
+
}
|
|
4607
|
+
async makeFreshScanCopy() {
|
|
4608
|
+
const realSrc = path9.join(this._path, "src");
|
|
4609
|
+
if (!await fs8.stat(realSrc).catch(() => false)) {
|
|
4610
|
+
return null;
|
|
4611
|
+
}
|
|
4612
|
+
const scanParent = path9.join(this._path, ".adk");
|
|
4613
|
+
await fs8.mkdir(scanParent, { recursive: true });
|
|
4614
|
+
const freshRoot = await fs8.mkdtemp(path9.join(scanParent, "scan-"));
|
|
4615
|
+
await fs8.cp(realSrc, path9.join(freshRoot, "src"), { recursive: true });
|
|
4616
|
+
const excluded = new Set(["src", "node_modules", ".adk", ".botpress", ".git", "dist"]);
|
|
4617
|
+
const entries = await fs8.readdir(this._path, { withFileTypes: true }).catch(() => []);
|
|
4618
|
+
for (const entry of entries) {
|
|
4619
|
+
if (excluded.has(entry.name)) {
|
|
4620
|
+
continue;
|
|
4621
|
+
}
|
|
4622
|
+
const target = path9.join(this._path, entry.name);
|
|
4623
|
+
const isDir = entry.isSymbolicLink() ? (await fs8.stat(target).catch(() => null))?.isDirectory() ?? false : entry.isDirectory();
|
|
4624
|
+
await fs8.symlink(target, path9.join(freshRoot, entry.name), isDir ? "junction" : "file").catch(() => {});
|
|
4625
|
+
}
|
|
4626
|
+
return freshRoot;
|
|
4627
|
+
}
|
|
4628
|
+
async scanPrimitivesInto(scanSrcDir, relBase) {
|
|
4460
4629
|
if (this._options.adkCommand) {
|
|
4461
4630
|
setAdkCommand(this._options.adkCommand);
|
|
4462
4631
|
}
|
|
4463
|
-
const src =
|
|
4464
|
-
if (!await
|
|
4632
|
+
const src = scanSrcDir;
|
|
4633
|
+
if (!await fs8.stat(src).catch(() => false)) {
|
|
4465
4634
|
this._errors.push({
|
|
4466
4635
|
$type: "ValidationError",
|
|
4467
4636
|
code: "INVALID_STRUCTURE" /* INVALID_STRUCTURE */,
|
|
@@ -4470,14 +4639,33 @@ ${err.stack?.split(`
|
|
|
4470
4639
|
});
|
|
4471
4640
|
return;
|
|
4472
4641
|
}
|
|
4473
|
-
const
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4642
|
+
const adkIgnore = await loadAdkIgnoreMatcher(this._path);
|
|
4643
|
+
const allFiles = [];
|
|
4644
|
+
const collectFiles = async (dir) => {
|
|
4645
|
+
const entries = await fs8.readdir(dir, { withFileTypes: true });
|
|
4646
|
+
for (const entry of entries) {
|
|
4647
|
+
const absolutePath = path9.join(dir, entry.name);
|
|
4648
|
+
const relPath = path9.relative(relBase, absolutePath);
|
|
4649
|
+
if (entry.isDirectory()) {
|
|
4650
|
+
if (adkIgnore.ignores(relPath) && !adkIgnore.canReincludeDescendant(relPath)) {
|
|
4651
|
+
continue;
|
|
4652
|
+
}
|
|
4653
|
+
await collectFiles(absolutePath);
|
|
4654
|
+
continue;
|
|
4655
|
+
}
|
|
4656
|
+
if (entry.isFile()) {
|
|
4657
|
+
allFiles.push({ absolutePath, filename: entry.name, isSymbolicLink: () => entry.isSymbolicLink() });
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
};
|
|
4661
|
+
await collectFiles(src);
|
|
4662
|
+
for (const file of allFiles) {
|
|
4663
|
+
const filename = file.filename;
|
|
4664
|
+
const absolutePath = file.absolutePath;
|
|
4665
|
+
const relPath = path9.relative(relBase, absolutePath);
|
|
4666
|
+
if (adkIgnore.ignores(relPath)) {
|
|
4667
|
+
continue;
|
|
4668
|
+
}
|
|
4481
4669
|
if (filename.toLowerCase().endsWith(".d.ts")) {
|
|
4482
4670
|
continue;
|
|
4483
4671
|
}
|
|
@@ -4764,7 +4952,7 @@ ${err.stack?.split(`
|
|
|
4764
4952
|
});
|
|
4765
4953
|
|
|
4766
4954
|
// src/generators/utils.ts
|
|
4767
|
-
import
|
|
4955
|
+
import path12 from "path";
|
|
4768
4956
|
async function getFormat() {
|
|
4769
4957
|
if (!_formatLoaded) {
|
|
4770
4958
|
_formatLoaded = true;
|
|
@@ -4812,9 +5000,9 @@ var _format = null, _formatLoaded = false, formatCode = async (code, filepath) =
|
|
|
4812
5000
|
`));
|
|
4813
5001
|
return code;
|
|
4814
5002
|
}
|
|
4815
|
-
}, ADK_VERSION = "
|
|
4816
|
-
const fromDir =
|
|
4817
|
-
const relative2 =
|
|
5003
|
+
}, ADK_VERSION = "3.0.0-beta.0", relative = (from, to) => {
|
|
5004
|
+
const fromDir = path12.dirname(from);
|
|
5005
|
+
const relative2 = path12.relative(fromDir, to);
|
|
4818
5006
|
return relative2.startsWith(".") ? relative2 : `./${relative2}`;
|
|
4819
5007
|
};
|
|
4820
5008
|
var init_utils = () => {};
|
|
@@ -4917,7 +5105,10 @@ class PluginResolver {
|
|
|
4917
5105
|
const dependencies = {};
|
|
4918
5106
|
for (const [ifaceAlias, dep] of Object.entries(cloud.interfaces ?? {})) {
|
|
4919
5107
|
if (dep.integrationAlias) {
|
|
4920
|
-
dependencies[ifaceAlias] = {
|
|
5108
|
+
dependencies[ifaceAlias] = {
|
|
5109
|
+
integrationAlias: dep.integrationAlias,
|
|
5110
|
+
...dep.integrationInterfaceAlias && { integrationInterfaceAlias: dep.integrationInterfaceAlias }
|
|
5111
|
+
};
|
|
4921
5112
|
}
|
|
4922
5113
|
}
|
|
4923
5114
|
return {
|
|
@@ -5052,6 +5243,11 @@ class PluginCatalogSource {
|
|
|
5052
5243
|
}
|
|
5053
5244
|
return getSortedCatalogSearchResults(results, limit);
|
|
5054
5245
|
}
|
|
5246
|
+
async fetchCode(plugin) {
|
|
5247
|
+
const client = await this.clientFactory.getClient();
|
|
5248
|
+
const { code } = await client.getPublicPluginCode({ id: plugin.id, platform: "node" });
|
|
5249
|
+
return code;
|
|
5250
|
+
}
|
|
5055
5251
|
async listVersions(name) {
|
|
5056
5252
|
const client = await this.clientFactory.getClient();
|
|
5057
5253
|
const versions = new Set;
|
|
@@ -5121,6 +5317,9 @@ class PluginManager {
|
|
|
5121
5317
|
async fetchPlugin(ref) {
|
|
5122
5318
|
return this.service.getDefinition(ref);
|
|
5123
5319
|
}
|
|
5320
|
+
async fetchPluginCode(plugin) {
|
|
5321
|
+
return this.source.fetchCode(plugin);
|
|
5322
|
+
}
|
|
5124
5323
|
async searchPlugins(query, limit = 20) {
|
|
5125
5324
|
return this.source.search(query, limit);
|
|
5126
5325
|
}
|
|
@@ -5275,12 +5474,20 @@ class DependencyManager {
|
|
|
5275
5474
|
const out = [];
|
|
5276
5475
|
if (!type || type === "integration") {
|
|
5277
5476
|
for (const [alias, e] of Object.entries(data.integrations)) {
|
|
5278
|
-
out.push({ type: "integration", alias, name: e.name, version: e.version, enabled: e.enabled });
|
|
5477
|
+
out.push({ type: "integration", alias, name: e.name, version: e.version, enabled: e.enabled, config: e.config });
|
|
5279
5478
|
}
|
|
5280
5479
|
}
|
|
5281
5480
|
if (!type || type === "plugin") {
|
|
5282
5481
|
for (const [alias, e] of Object.entries(data.plugins)) {
|
|
5283
|
-
out.push({
|
|
5482
|
+
out.push({
|
|
5483
|
+
type: "plugin",
|
|
5484
|
+
alias,
|
|
5485
|
+
name: e.name,
|
|
5486
|
+
version: e.version,
|
|
5487
|
+
enabled: e.enabled,
|
|
5488
|
+
config: e.config,
|
|
5489
|
+
dependencies: e.dependencies
|
|
5490
|
+
});
|
|
5284
5491
|
}
|
|
5285
5492
|
}
|
|
5286
5493
|
return out;
|
|
@@ -5640,6 +5847,9 @@ class DependencyManager {
|
|
|
5640
5847
|
integrationRegistry: this.integrationRegistry
|
|
5641
5848
|
});
|
|
5642
5849
|
}
|
|
5850
|
+
async refresh() {
|
|
5851
|
+
await this.refreshSnapshotFromCloud();
|
|
5852
|
+
}
|
|
5643
5853
|
integrationEntriesMatch(a, b) {
|
|
5644
5854
|
return jsonEqual(stripSnapshotMetadata(a), stripSnapshotMetadata(b));
|
|
5645
5855
|
}
|
|
@@ -5937,7 +6147,7 @@ init_types();
|
|
|
5937
6147
|
|
|
5938
6148
|
// src/dependencies/status-resolver.ts
|
|
5939
6149
|
import { existsSync } from "fs";
|
|
5940
|
-
import * as
|
|
6150
|
+
import * as path10 from "path";
|
|
5941
6151
|
|
|
5942
6152
|
// src/utils/ids.ts
|
|
5943
6153
|
function getIntegrationAlias(integrationName) {
|
|
@@ -5955,7 +6165,7 @@ async function resolveDependencyStatuses(input) {
|
|
|
5955
6165
|
const out = [];
|
|
5956
6166
|
const integrationVerdicts = new Map;
|
|
5957
6167
|
for (const [alias, entry] of Object.entries(input.snapshot.integrations)) {
|
|
5958
|
-
const installed = input.bpModulesDir ? existsSync(
|
|
6168
|
+
const installed = input.bpModulesDir ? existsSync(path10.join(input.bpModulesDir, bpModuleDirName("integration", alias))) : true;
|
|
5959
6169
|
const spec = await tryGetSpec(input.integrationRegistry, entry.name, entry.version);
|
|
5960
6170
|
const verdict = spec ? computeIntegrationStatus({
|
|
5961
6171
|
installed,
|
|
@@ -5982,7 +6192,7 @@ async function resolveDependencyStatuses(input) {
|
|
|
5982
6192
|
});
|
|
5983
6193
|
}
|
|
5984
6194
|
for (const [alias, entry] of Object.entries(input.snapshot.plugins)) {
|
|
5985
|
-
const installed = input.bpModulesDir ? existsSync(
|
|
6195
|
+
const installed = input.bpModulesDir ? existsSync(path10.join(input.bpModulesDir, bpModuleDirName("plugin", alias))) : true;
|
|
5986
6196
|
const spec = await tryGetSpec(input.pluginRegistry, entry.name, entry.version);
|
|
5987
6197
|
const dependencyStatuses = mapPluginDependencyStatuses(entry.dependencies, (intAlias) => integrationVerdicts.get(intAlias));
|
|
5988
6198
|
let verdict;
|
|
@@ -6041,26 +6251,26 @@ class InterfaceRegistry {
|
|
|
6041
6251
|
init_snapshot_store();
|
|
6042
6252
|
|
|
6043
6253
|
// src/dependencies/migration.ts
|
|
6044
|
-
import * as
|
|
6045
|
-
import * as
|
|
6254
|
+
import * as fs10 from "fs/promises";
|
|
6255
|
+
import * as path14 from "path";
|
|
6046
6256
|
import { Project as Project3, SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
6047
6257
|
|
|
6048
6258
|
// src/dependencies/legacy-lock-file.ts
|
|
6049
6259
|
init_types();
|
|
6050
6260
|
init_errors2();
|
|
6051
|
-
import * as
|
|
6052
|
-
import * as
|
|
6261
|
+
import * as fs9 from "fs/promises";
|
|
6262
|
+
import * as path11 from "path";
|
|
6053
6263
|
|
|
6054
6264
|
class LegacyDependencyLockFile {
|
|
6055
6265
|
filePath;
|
|
6056
6266
|
env;
|
|
6057
6267
|
constructor(opts) {
|
|
6058
6268
|
this.env = opts.env;
|
|
6059
|
-
this.filePath =
|
|
6269
|
+
this.filePath = path11.join(opts.projectPath, `dependencies.${opts.env}.lock.json`);
|
|
6060
6270
|
}
|
|
6061
6271
|
async exists() {
|
|
6062
6272
|
try {
|
|
6063
|
-
await
|
|
6273
|
+
await fs9.access(this.filePath);
|
|
6064
6274
|
return true;
|
|
6065
6275
|
} catch {
|
|
6066
6276
|
return false;
|
|
@@ -6069,7 +6279,7 @@ class LegacyDependencyLockFile {
|
|
|
6069
6279
|
async read(options) {
|
|
6070
6280
|
let raw;
|
|
6071
6281
|
try {
|
|
6072
|
-
raw = await
|
|
6282
|
+
raw = await fs9.readFile(this.filePath, "utf8");
|
|
6073
6283
|
} catch (err) {
|
|
6074
6284
|
if (err.code === "ENOENT") {
|
|
6075
6285
|
return dependencyStateSchema.parse({ version: 1, env: this.env });
|
|
@@ -6091,7 +6301,7 @@ class LegacyDependencyLockFile {
|
|
|
6091
6301
|
}
|
|
6092
6302
|
async delete() {
|
|
6093
6303
|
try {
|
|
6094
|
-
await
|
|
6304
|
+
await fs9.unlink(this.filePath);
|
|
6095
6305
|
} catch (err) {
|
|
6096
6306
|
if (err.code !== "ENOENT")
|
|
6097
6307
|
throw err;
|
|
@@ -6103,17 +6313,17 @@ class LegacyDependencyLockFile {
|
|
|
6103
6313
|
init_utils();
|
|
6104
6314
|
init_src();
|
|
6105
6315
|
import { Project as Project2, SyntaxKind as SyntaxKind2 } from "ts-morph";
|
|
6106
|
-
import { readFileSync as
|
|
6107
|
-
import * as
|
|
6316
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
6317
|
+
import * as path13 from "path";
|
|
6108
6318
|
|
|
6109
6319
|
class ConfigWriter {
|
|
6110
6320
|
configPath;
|
|
6111
6321
|
constructor(projectPath) {
|
|
6112
|
-
this.configPath =
|
|
6322
|
+
this.configPath = path13.join(projectPath, "agent.config.ts");
|
|
6113
6323
|
}
|
|
6114
6324
|
loadConfig() {
|
|
6115
6325
|
const project = new Project2;
|
|
6116
|
-
const sourceFile = project.createSourceFile(this.configPath,
|
|
6326
|
+
const sourceFile = project.createSourceFile(this.configPath, readFileSync3(this.configPath, "utf-8"), {
|
|
6117
6327
|
overwrite: true
|
|
6118
6328
|
});
|
|
6119
6329
|
const defineConfigCall = sourceFile.getDescendantsOfKind(SyntaxKind2.CallExpression).find((call) => {
|
|
@@ -6571,10 +6781,10 @@ async function migrateFromConfig(opts) {
|
|
|
6571
6781
|
return new DependencyMigrationManager(opts).run();
|
|
6572
6782
|
}
|
|
6573
6783
|
async function readDependenciesFromConfig(projectPath) {
|
|
6574
|
-
const configPath =
|
|
6784
|
+
const configPath = path14.join(projectPath, "agent.config.ts");
|
|
6575
6785
|
const empty = { version: 1, env: "dev", integrations: {}, plugins: {} };
|
|
6576
6786
|
try {
|
|
6577
|
-
await
|
|
6787
|
+
await fs10.access(configPath);
|
|
6578
6788
|
} catch {
|
|
6579
6789
|
return empty;
|
|
6580
6790
|
}
|
|
@@ -6668,4 +6878,4 @@ export {
|
|
|
6668
6878
|
DEPENDENCY_ERROR_CODES
|
|
6669
6879
|
};
|
|
6670
6880
|
|
|
6671
|
-
//# debugId=
|
|
6881
|
+
//# debugId=777FF4527C20ABFC64756E2164756E21
|