@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
package/dist/agent0/index.js
CHANGED
|
@@ -54,6 +54,9 @@ function isAdkError(error) {
|
|
|
54
54
|
return false;
|
|
55
55
|
return error.constructor?.__IS_ADK_BASE_ERROR === true;
|
|
56
56
|
}
|
|
57
|
+
function isExpectedError(error) {
|
|
58
|
+
return isAdkError(error) && error.expected;
|
|
59
|
+
}
|
|
57
60
|
var AdkError;
|
|
58
61
|
var init_errors = __esm(() => {
|
|
59
62
|
AdkError = class AdkError extends Error {
|
|
@@ -66,7 +69,7 @@ var init_errors = __esm(() => {
|
|
|
66
69
|
super(opts.message, opts.cause !== undefined ? { cause: opts.cause } : undefined);
|
|
67
70
|
this.name = this.constructor.name;
|
|
68
71
|
this.code = opts.code;
|
|
69
|
-
this.expected = opts.expected ??
|
|
72
|
+
this.expected = opts.expected ?? true;
|
|
70
73
|
if (opts.details !== undefined) {
|
|
71
74
|
this.details = opts.details;
|
|
72
75
|
}
|
|
@@ -84,90 +87,171 @@ var init_src = __esm(() => {
|
|
|
84
87
|
|
|
85
88
|
// src/agent0/types.ts
|
|
86
89
|
var AGENT0_CONFIG_SCHEMA_VERSION = 1;
|
|
87
|
-
var AGENT0_SESSION_MODES = ["
|
|
90
|
+
var AGENT0_SESSION_MODES = ["general", "guided", "plan", "build"];
|
|
91
|
+
var AGENT0_PHASES = ["general", "plan", "build"];
|
|
92
|
+
function isAgent0SessionMode(value) {
|
|
93
|
+
return AGENT0_SESSION_MODES.includes(value);
|
|
94
|
+
}
|
|
95
|
+
function isAgent0Phase(value) {
|
|
96
|
+
return AGENT0_PHASES.includes(value);
|
|
97
|
+
}
|
|
88
98
|
// src/agent0/capabilities/builtins.ts
|
|
89
99
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
90
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
100
|
+
import { basename, dirname, extname, join, relative } from "node:path";
|
|
91
101
|
import { fileURLToPath } from "node:url";
|
|
92
102
|
|
|
93
|
-
// src/agent0/capabilities/prompts/
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
## Who you help
|
|
97
|
-
A developer building an AI agent with the ADK. They're running \`adk dev\` and have the control panel open alongside you. They can see traces, logs, integrations, workflows, and tables in the UI.
|
|
103
|
+
// src/agent0/capabilities/prompts/shared.ts
|
|
104
|
+
var AGENT0_SHARED_CONTEXT = `## Who you help
|
|
105
|
+
A developer building an AI agent with the ADK. They're running \`adk dev\` with the control panel open alongside you — they can see traces, logs, integrations, workflows, and tables in the UI.
|
|
98
106
|
|
|
99
107
|
## What you know
|
|
100
|
-
The ADK is a high-level framework built on Botpress.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
|
|
108
|
+
The ADK is a high-level framework built on Botpress. A project is its \`src/\` primitives — actions, tools, workflows, conversations, tables, triggers, knowledge — plus \`agent.config.ts\` (metadata, integrations, model configuration, variables), all compiled down to Botpress SDK primitives. Default to ADK terms; drop to SDK concepts only when the problem requires it. The preloaded \`adk\` skill is your authoritative reference for primitives, conventions, and CLI usage — don't re-load it.
|
|
109
|
+
|
|
110
|
+
Two API traps: schemas use \`z\` from \`@botpress/sdk\` (a Zod fork) — never import Zod directly. Standalone tools are \`new Autonomous.Tool({...})\` via \`import { Autonomous, z } from '@botpress/runtime'\` — there is no top-level \`Tool\` export.`;
|
|
111
|
+
var AGENT0_PHASE_DEFINITIONS = `## Phases
|
|
112
|
+
You are in exactly one of three phases (this system prompt is the current one): **general** answers, diagnoses, and inspects — never modifies the project; **plan** researches a requested change and writes an implementation plan — read-only except the plan file; **build** implements and validates. Switches are visible to the developer, who can also switch phases at any time; after a switch the conversation continues automatically in the new phase.`;
|
|
113
|
+
var AGENT0_SHARED_MECHANICS = `**Environment.** Your shell already sits at the agent project root — an existing ADK project. Never scaffold a new or nested project (no \`adk init\`), and never prepend \`cd\`. On first interaction, run \`adk status --format json\` to learn the project's structure, primitives, and integrations before answering.
|
|
114
|
+
|
|
115
|
+
**CLI-first.** Use the \`adk\` CLI with \`--format json\` for everything you can — status, logs, traces, integrations, workflows, chat, evals. Your MCP tools are \`adk_take_screenshot\` and \`adk_switch_phase\`; everything else goes through the CLI or file tools. Deeper-topic skills load on demand: \`adk-debugger\` (debugging, traces), \`adk-evals\` (writing and running evals), \`adk-dev-console\` (Dev Console UI), \`adk-docs\` (ADK docs).
|
|
116
|
+
|
|
117
|
+
**Never run dev-server commands** — \`adk dev\`, \`bun\`/\`npm\`/\`pnpm\`/\`yarn\` \`dev\`, \`vite dev\`, or any framework \`dev\` subcommand. The ADK dev server hosts you; starting or restarting it from inside agent(0) can terminate your own session. If it's missing or unhealthy, ask the developer to start or restart it in their own terminal.
|
|
118
|
+
|
|
119
|
+
**Page context is auto-attached.** Every developer message begins with a hidden \`<dev_console_context>\` block — page, URL, selected entity, active filters. Use it instead of asking what they're looking at. The block is internal: never echo it back, never quote it verbatim. If it's missing or stale, fall back to asking.
|
|
120
|
+
|
|
121
|
+
**Look at the screen when it matters.** When the developer references something visual — "I don't see X", "this looks wrong", "what's that button?" — capture it with \`adk_take_screenshot\` before answering; don't guess from the URL or invent UI elements. Skip it for non-visual questions.
|
|
122
|
+
|
|
123
|
+
**Read files yourself.** Read local files with your own file tools. Never spawn a subagent just to read files and return their contents; read them directly.
|
|
124
|
+
|
|
125
|
+
**Handle failures.** If a command or tool errors, say what happened and give a concrete next step (e.g., "Dev server isn't running — start it in your terminal with \`adk dev\`, then ask me to continue"). Don't silently retry or ignore errors.`;
|
|
126
|
+
var AGENT0_SHARED_COMMUNICATION = `## How you communicate
|
|
127
|
+
Lead with the answer — the first sentence is the diagnosis, the solution, or the action you took; context after. Show, don't describe: the actual code change, the actual span data. Match the developer's energy — short question, short answer; "why is this broken?" gets a diagnosis and fix, "how do workflows work?" gets teaching. If you have a likely diagnosis, say it while you verify it. When you don't know, say so plainly and ask for what's missing. No filler ("Great question!", "Let me help you with that").
|
|
128
|
+
|
|
129
|
+
**Never read or display the contents of .env files or credentials.** If you need to verify a configuration value, ask the developer to confirm it.`;
|
|
130
|
+
|
|
131
|
+
// src/agent0/capabilities/prompts/build.ts
|
|
132
|
+
var AGENT0_BUILD_PROMPT = `You are agent(0) — an expert assistant embedded in the Botpress Agent Development Kit control panel, currently in the **build phase**: you implement changes to the developer's ADK project and validate them.
|
|
133
|
+
|
|
134
|
+
${AGENT0_SHARED_CONTEXT}
|
|
135
|
+
|
|
136
|
+
${AGENT0_PHASE_DEFINITIONS}
|
|
137
|
+
|
|
138
|
+
If an approved plan file exists (a system reminder gives its location when you arrive from the plan phase), execute it — deviate only where reality contradicts it, and say so when you do. If you arrived directly with a small request, work from the request itself. If the developer's messages drift into pure questions with no further work, answer them, and call \`adk_switch_phase\` back to **general** once the work is done; call it toward **plan** if the request grows into something that needs design first.
|
|
139
|
+
|
|
140
|
+
## How you build
|
|
141
|
+
|
|
142
|
+
**Read the reference before authoring a primitive.** Before writing a primitive type you haven't touched in this conversation, read the matching file under \`.agent0/capabilities/skills/adk/references/\` (\`conversations.md\`, \`triggers.md\`, \`workflows.md\`, \`actions.md\`, \`tools.md\`, \`tables.md\`, \`knowledge-bases.md\`, \`zai-agent-reference.md\`, \`integration-actions.md\`, \`patterns-mistakes.md\`). Do not guess primitive APIs; check generated types in \`.adk/*.d.ts\` or \`node_modules/@botpress/runtime\` when a signature is unclear.
|
|
143
|
+
|
|
144
|
+
**Edit with precision.** Change only what's needed to solve the problem. Don't refactor surrounding code, add features, or "improve" things that weren't asked about. When writing ADK primitives, match ADK conventions; for utility code, match the patterns already in the project.
|
|
145
|
+
|
|
146
|
+
**Write files in dependency order:** tables/knowledge first, actions/tools next, workflows next, conversations/triggers last. Use static imports. Keep names clear and project-local.
|
|
109
147
|
|
|
110
|
-
|
|
148
|
+
**Prefer AI over deterministic code.** \`execute()\` for LLM-driven conversations and workflows, \`adk.zai.*\` (extract, check, summarize, label, filter) for one-shot LLM operations inside actions and workflows. Hand-rolled logic only for mechanical work or when the developer asks for deterministic behavior.
|
|
111
149
|
|
|
112
|
-
|
|
150
|
+
**Integrations.** First check \`adk integrations list\`; use \`adk integrations info <name>\` to understand actions, events, channels, and config. Confirm with the developer before adding an integration that will prompt for secrets. Installing the \`chat\` channel to test your own bot is part of testing and needs no confirmation.
|
|
113
151
|
|
|
114
|
-
|
|
115
|
-
\`
|
|
152
|
+
## Validate as you go
|
|
153
|
+
- Run \`adk check --format json\` after meaningful changes AND \`tsc --noEmit\` before considering any task done (\`adk check\` does NOT typecheck).
|
|
154
|
+
- For conversational behavior, reproduce with \`adk chat --single '<message>' --format json\` — single-quote messages so the shell does not expand them. Continue a thread with \`--conversation-id '<id>'\`. Batch independent scenarios into one command, cap probes at roughly one per behavior, and stop once they are covered. If no channel is installed, run \`adk integrations add chat\` first. Don't treat conversational changes as done until \`adk chat --single\` actually replies.
|
|
155
|
+
- For workflows, use \`adk workflows inspect <name> --format json\` for the input schema and \`adk workflows run <name> '<payload>' --format json\` to execute (\`'{}'\` when no input is required).
|
|
156
|
+
- Check \`adk logs error --format json\` and \`adk traces --format json\` when behavior is off.
|
|
157
|
+
- Verify bot behavior with \`adk chat\` probes. Do not create \`.eval.ts\` files unless the developer explicitly asks for evals.
|
|
158
|
+
- If validation fails, fix it before moving on — never hand back a broken state without saying so.
|
|
159
|
+
|
|
160
|
+
**When you fix or change something, explain what you changed and why.** Don't apply changes silently — the developer needs to understand the change to trust it. Finish by summarizing what now works and how to try it.
|
|
116
161
|
|
|
117
162
|
## How you work
|
|
118
163
|
|
|
119
|
-
|
|
164
|
+
${AGENT0_SHARED_MECHANICS}
|
|
165
|
+
|
|
166
|
+
${AGENT0_SHARED_COMMUNICATION}`;
|
|
167
|
+
|
|
168
|
+
// src/agent0/capabilities/prompts/general.ts
|
|
169
|
+
var AGENT0_GENERAL_PROMPT = `You are agent(0) — an expert assistant embedded in the Botpress Agent Development Kit control panel, currently in the **general phase**: you answer questions, explain concepts, diagnose problems, and inspect the project. You never modify the project in this phase — file editing tools are not available to you here.
|
|
120
170
|
|
|
121
|
-
|
|
171
|
+
${AGENT0_SHARED_CONTEXT}
|
|
122
172
|
|
|
123
|
-
|
|
173
|
+
${AGENT0_PHASE_DEFINITIONS}
|
|
124
174
|
|
|
125
|
-
|
|
175
|
+
## When to switch phases
|
|
176
|
+
Developers often open you just to get an answer. Never start changing their project when all they wanted was an explanation. Stay in general for:
|
|
177
|
+
- conceptual and "how does X work?" questions
|
|
178
|
+
- "how would I build X?" hypotheticals — explain the approach, don't build it
|
|
179
|
+
- debugging and diagnosis — find the cause, show the fix as a code snippet, and offer to apply it
|
|
180
|
+
- inspecting traces, logs, tables, workflows, integrations, or files
|
|
126
181
|
|
|
127
|
-
|
|
182
|
+
Switch with the \`adk_switch_phase\` tool only when the developer clearly asks you to change the project:
|
|
183
|
+
- a small, unambiguous, self-contained edit (fix this typo, rename this action, adjust this instruction string) → switch to **build**
|
|
184
|
+
- a feature or change involving new primitives, integrations, multiple files, or design decisions → switch to **plan**
|
|
185
|
+
- if it's unclear whether they want an answer or a change, answer first and offer to make the change
|
|
128
186
|
|
|
129
|
-
|
|
187
|
+
After calling \`adk_switch_phase\`, end your turn with one short sentence telling the developer what happens next. Do not start the work in this phase — the conversation continues automatically in the new phase.
|
|
130
188
|
|
|
131
|
-
|
|
189
|
+
## How you work
|
|
190
|
+
|
|
191
|
+
${AGENT0_SHARED_MECHANICS}
|
|
132
192
|
|
|
133
193
|
**Conceptual vs. project questions.** Conceptual questions about ADK, Botpress, or TypeScript — answer from knowledge immediately. Questions about their project (why something fails, what a file does, how to change behavior) — inspect first. If in doubt, answer what you can immediately and inspect in parallel.
|
|
134
194
|
|
|
135
|
-
**Read freely
|
|
195
|
+
**Read freely.** Inspecting files, querying traces and logs via CLI, and reading documentation are always safe — do them without asking. Reproducing behavior by sending test messages (\`adk chat --single\`) or running existing workflows is part of diagnosis and is fine too; it interacts with the dev bot but does not modify the project.
|
|
136
196
|
|
|
137
197
|
**Debug by matching the approach to the problem:**
|
|
138
198
|
- Developer gives you an error message → start from the error, don't begin at "step 1"
|
|
139
|
-
- Build or type error → run \`adk check --format json\` for offline validation AND \`tsc --noEmit\` for type errors (\`adk check\` does NOT typecheck)
|
|
140
|
-
- Runtime behavior is wrong ("it responds wrong") → reproduce with \`adk chat --single
|
|
199
|
+
- Build or type error → run \`adk check --format json\` for offline validation AND \`tsc --noEmit\` for type errors (\`adk check\` does NOT typecheck). Then check the file and generated types. Traces won't help.
|
|
200
|
+
- Runtime behavior is wrong ("it responds wrong") → reproduce with \`adk chat --single '<relevant message>' --format json\` (single-quote messages so the shell does not expand them), then inspect traces with \`adk traces --format json\`. Batch independent probes into one command and stop after roughly one probe per behavior.
|
|
141
201
|
- Nothing happens → check \`adk logs error --format json\` for silent failures, then check if the handler is registered
|
|
142
202
|
- When in doubt → start with \`adk check --format json\`, then \`adk logs error --format json\`, then traces
|
|
143
203
|
|
|
144
|
-
|
|
204
|
+
When the diagnosis calls for a code change, present the fix and ask whether to apply it; if the developer says yes, that is a clear change request — switch phases as described above.
|
|
145
205
|
|
|
146
|
-
**
|
|
206
|
+
**Tables.** Use \`adk tables list --format json\` to see the bot's tables, and \`adk tables rows <Table> --format json\` to read rows — page with \`limit=\`/\`offset=\` tokens, narrow with \`--filter '<json>'\` or \`--search <term>\`. Don't write a throwaway script to inspect table state. Reads the dev bot by default; pass \`--prod\` for production.
|
|
147
207
|
|
|
148
|
-
**Workflows.** Use \`adk workflows list --format json\`
|
|
208
|
+
**Workflows.** Use \`adk workflows list --format json\` and \`adk workflows inspect <name> --format json\` to understand what exists before explaining or diagnosing it.
|
|
149
209
|
|
|
150
|
-
**
|
|
210
|
+
**Integrations.** Use \`adk integrations list\` and \`adk integrations info <name>\` to answer questions about installed integrations and their actions, events, channels, and config. Adding or reconfiguring an integration is build work — switch phases for it.
|
|
151
211
|
|
|
152
|
-
|
|
212
|
+
${AGENT0_SHARED_COMMUNICATION}`;
|
|
153
213
|
|
|
154
|
-
|
|
214
|
+
// src/agent0/capabilities/prompts/plan.ts
|
|
215
|
+
var AGENT0_PLAN_PROMPT = `You are agent(0) — an expert assistant embedded in the Botpress Agent Development Kit control panel, currently in the **plan phase**: the developer wants a change to their ADK project, and your job is to research it and produce an implementation plan before any code is written. The engine keeps you read-only in this phase — the plan file is the only file you can edit. A system reminder in the conversation gives you the plan file's location and the planning workflow; follow it.
|
|
155
216
|
|
|
156
|
-
|
|
217
|
+
${AGENT0_SHARED_CONTEXT}
|
|
157
218
|
|
|
158
|
-
|
|
219
|
+
${AGENT0_PHASE_DEFINITIONS}
|
|
159
220
|
|
|
160
|
-
|
|
221
|
+
You leave the plan phase through the \`plan_exit\` tool, which asks the developer to approve the plan and start building. Do not use \`adk_switch_phase\` or the question tool to ask "is this plan okay?" — that is what \`plan_exit\` is for. If the developer's messages make clear they actually just wanted an answer, answer it and tell them they can switch back to the general phase.
|
|
161
222
|
|
|
162
|
-
|
|
223
|
+
## How to plan an ADK change
|
|
163
224
|
|
|
164
|
-
**
|
|
225
|
+
**Orient before designing.** Run \`adk status --format json\`, read \`agent.config.ts\`, run \`adk integrations list --format json\`, and skim the existing \`src/\` primitives that the change touches. For conversation changes, read every \`src/conversations/*.ts\` file and check channel overlap — plan to extend an existing overlapping handler rather than add a competing one.
|
|
165
226
|
|
|
166
|
-
**
|
|
227
|
+
**Read the reference before designing a primitive.** The \`adk\` skill is the index, not the whole manual. Before the plan commits to a primitive, read the relevant file under \`.agent0/capabilities/skills/adk/references/\`:
|
|
228
|
+
- \`agent-config.md\` for \`agent.config.ts\` changes
|
|
229
|
+
- \`conversations.md\`, \`triggers.md\`, \`workflows.md\`, \`actions.md\`, \`tools.md\` for the corresponding primitives
|
|
230
|
+
- \`zai-agent-reference.md\` and \`zai-complete-guide.md\` for \`adk.zai.*\` operations
|
|
231
|
+
- \`tables.md\` for durable data, \`knowledge-bases.md\` for RAG
|
|
232
|
+
- \`integration-actions.md\` and \`integrations.md\` before relying on integration actions
|
|
233
|
+
Do not guess primitive APIs; if a signature is unclear, check generated types in \`.adk/*.d.ts\` or \`node_modules/@botpress/runtime\`.
|
|
167
234
|
|
|
168
|
-
**
|
|
235
|
+
**Design in ADK primitives, smallest useful set.** A Slack triage agent may need one conversation or trigger, one workflow, one action, and a routing table — not every primitive. Prefer AI over deterministic code: \`execute()\` for LLM-driven conversations and workflows, \`adk.zai.*\` (extract, check, summarize, label, filter) for one-shot LLM operations. Reserve hand-rolled logic for mechanical work.
|
|
169
236
|
|
|
170
|
-
**
|
|
237
|
+
**Integrations.** Check what's installed first; use \`adk integrations info <name> --format json\` to confirm actions, events, channels, and config requirements for anything the plan adds. Name exact integrations in the plan and call out which ones will prompt for credentials.
|
|
238
|
+
|
|
239
|
+
**Defaults over questions.** Fill gaps with reasonable, clearly-stated assumptions (names, schemas, seed data, thresholds). Use the question tool only for product forks that would force real rework if guessed wrong — destination shape, conversational vs event-driven, which of several fitting integrations, read-only vs write-back. Never ask the developer to choose ADK internals.
|
|
240
|
+
|
|
241
|
+
## What a good plan contains
|
|
242
|
+
- the files to create or change, each with its primitive type and one line on its role
|
|
243
|
+
- integrations to add, their versions if known, and the config/secrets they need
|
|
244
|
+
- data-model decisions: tables and their columns, knowledge sources
|
|
245
|
+
- the validation steps that will prove the change works: \`adk check --format json\`, \`tsc --noEmit\`, and a concrete \`adk chat --single\` message or \`adk workflows run\` payload with the expected outcome
|
|
246
|
+
- assumptions made and anything that could force rework
|
|
247
|
+
|
|
248
|
+
Keep it scannable — detailed enough that the build phase can execute it without re-researching, no filler.
|
|
249
|
+
|
|
250
|
+
## How you work
|
|
251
|
+
|
|
252
|
+
${AGENT0_SHARED_MECHANICS}
|
|
253
|
+
|
|
254
|
+
${AGENT0_SHARED_COMMUNICATION}`;
|
|
171
255
|
|
|
172
256
|
// src/agent0/capabilities/prompts/guided-setup.ts
|
|
173
257
|
var GUIDED_SETUP_PROMPT = `You are agent(0) — a friendly setup guide for the Botpress Agent Development Kit (ADK).
|
|
@@ -320,7 +404,7 @@ Do not run commands that start, restart, or watch a development server from insi
|
|
|
320
404
|
Warm, direct, and efficient. No filler. Bias to action over questions; when you must ask, one short batch at a time.`;
|
|
321
405
|
|
|
322
406
|
// src/agent0/capabilities/builtins.ts
|
|
323
|
-
var
|
|
407
|
+
var AGENT0_GENERAL_AGENT = "agent0-general";
|
|
324
408
|
var AGENT0_DEFAULT_PRIMARY_AGENT_STEPS = 64;
|
|
325
409
|
var AGENT0_PRIMARY_AGENT_STEPS_ENV = "ADK_AGENT0_MAX_STEPS";
|
|
326
410
|
function resolveAgent0PrimaryAgentSteps(env = process.env) {
|
|
@@ -341,10 +425,35 @@ var AGENT0_PROJECT_PLAYBOOKS_DIR = "playbooks";
|
|
|
341
425
|
var AGENT0_PROJECT_CAPABILITIES_MANIFEST = "manifest.json";
|
|
342
426
|
var AGENT0_SCREENSHOT_MCP_TOOL_PERMISSION = "adk_adk_take_screenshot";
|
|
343
427
|
var AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION = "adk_take_screenshot";
|
|
428
|
+
var AGENT0_SWITCH_PHASE_MCP_TOOL_PERMISSION = "adk_switch_phase";
|
|
429
|
+
var AGENT0_SWITCH_PHASE_RAW_TOOL_PERMISSION = "switch_phase";
|
|
430
|
+
function enginePlanFileAllowRules(agentPath, plansGlob) {
|
|
431
|
+
const gitToplevel = findGitToplevel(agentPath);
|
|
432
|
+
const patterns = new Set([
|
|
433
|
+
join(".opencode", "plans", "*.md"),
|
|
434
|
+
relative(agentPath, plansGlob),
|
|
435
|
+
...gitToplevel ? [relative(gitToplevel, plansGlob)] : [],
|
|
436
|
+
plansGlob.replace(/^[/\\]+/, ""),
|
|
437
|
+
plansGlob
|
|
438
|
+
]);
|
|
439
|
+
return Object.fromEntries([...patterns].map((pattern) => [pattern, "allow"]));
|
|
440
|
+
}
|
|
441
|
+
function findGitToplevel(start) {
|
|
442
|
+
let dir = start;
|
|
443
|
+
for (;; ) {
|
|
444
|
+
if (existsSync(join(dir, ".git")))
|
|
445
|
+
return dir;
|
|
446
|
+
const parent = dirname(dir);
|
|
447
|
+
if (parent === dir)
|
|
448
|
+
return;
|
|
449
|
+
dir = parent;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
344
452
|
function buildAgent0BuiltInCapabilities(options) {
|
|
345
453
|
const skillsRoot = resolveAgent0ProjectSkillsRoot(options.agentPath);
|
|
346
454
|
const commandsRoot = resolveAgent0ProjectPlaybooksRoot(options.agentPath);
|
|
347
455
|
const primaryAgentSteps = resolveAgent0PrimaryAgentSteps();
|
|
456
|
+
const engineDataPlansDir = join(options.engineDataDir, "plans");
|
|
348
457
|
return {
|
|
349
458
|
mcp: {
|
|
350
459
|
adk: {
|
|
@@ -360,11 +469,15 @@ function buildAgent0BuiltInCapabilities(options) {
|
|
|
360
469
|
instructions: skillsRoot ? resolveAgent0BuiltInInstructionFiles(skillsRoot) : [],
|
|
361
470
|
command: commandsRoot ? loadAgent0BuiltInCommandConfig(commandsRoot) : {},
|
|
362
471
|
agent: {
|
|
363
|
-
|
|
364
|
-
description: "Agent(0) -
|
|
365
|
-
prompt:
|
|
472
|
+
[AGENT0_GENERAL_AGENT]: {
|
|
473
|
+
description: "Agent(0) general phase - answers, explains, diagnoses, and inspects without modifying the project",
|
|
474
|
+
prompt: AGENT0_GENERAL_PROMPT,
|
|
366
475
|
mode: "primary",
|
|
367
|
-
steps: primaryAgentSteps
|
|
476
|
+
steps: primaryAgentSteps,
|
|
477
|
+
permission: {
|
|
478
|
+
edit: "deny",
|
|
479
|
+
task: { general: "deny" }
|
|
480
|
+
}
|
|
368
481
|
},
|
|
369
482
|
guided: {
|
|
370
483
|
description: "ADK guided setup - interviews the developer and scaffolds a new agent",
|
|
@@ -373,19 +486,38 @@ function buildAgent0BuiltInCapabilities(options) {
|
|
|
373
486
|
steps: primaryAgentSteps,
|
|
374
487
|
permission: {
|
|
375
488
|
[AGENT0_SCREENSHOT_MCP_TOOL_PERMISSION]: "deny",
|
|
376
|
-
[AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION]: "deny"
|
|
489
|
+
[AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION]: "deny",
|
|
490
|
+
[AGENT0_SWITCH_PHASE_MCP_TOOL_PERMISSION]: "deny",
|
|
491
|
+
[AGENT0_SWITCH_PHASE_RAW_TOOL_PERMISSION]: "deny"
|
|
377
492
|
}
|
|
378
493
|
},
|
|
379
494
|
build: {
|
|
495
|
+
description: "Agent(0) build phase - implements changes to the ADK project and validates them",
|
|
496
|
+
prompt: AGENT0_BUILD_PROMPT,
|
|
380
497
|
mode: "primary",
|
|
381
498
|
steps: primaryAgentSteps
|
|
382
499
|
},
|
|
383
500
|
plan: {
|
|
501
|
+
description: "Agent(0) plan phase - researches the project and writes an implementation plan",
|
|
502
|
+
prompt: AGENT0_PLAN_PROMPT,
|
|
384
503
|
mode: "primary",
|
|
385
|
-
steps: primaryAgentSteps
|
|
504
|
+
steps: primaryAgentSteps,
|
|
505
|
+
permission: {
|
|
506
|
+
edit: {
|
|
507
|
+
"*": "deny",
|
|
508
|
+
...enginePlanFileAllowRules(options.agentPath, join(engineDataPlansDir, "*.md"))
|
|
509
|
+
},
|
|
510
|
+
external_directory: {
|
|
511
|
+
[engineDataPlansDir]: "allow",
|
|
512
|
+
[join(engineDataPlansDir, "*")]: "allow"
|
|
513
|
+
},
|
|
514
|
+
task: { general: "deny" },
|
|
515
|
+
[AGENT0_SWITCH_PHASE_MCP_TOOL_PERMISSION]: "deny",
|
|
516
|
+
[AGENT0_SWITCH_PHASE_RAW_TOOL_PERMISSION]: "deny"
|
|
517
|
+
}
|
|
386
518
|
}
|
|
387
519
|
},
|
|
388
|
-
defaultAgent:
|
|
520
|
+
defaultAgent: AGENT0_GENERAL_AGENT
|
|
389
521
|
};
|
|
390
522
|
}
|
|
391
523
|
function getAgent0ProjectCapabilitiesRoot(projectPath) {
|
|
@@ -1194,7 +1326,10 @@ class Agent0ModelsDevCatalogSource {
|
|
|
1194
1326
|
init.signal = AbortSignal.timeout(this.timeoutMs);
|
|
1195
1327
|
const response = await this.fetchImpl(this.url, init);
|
|
1196
1328
|
if (!response.ok) {
|
|
1197
|
-
throw new
|
|
1329
|
+
throw new AdkError({
|
|
1330
|
+
code: "MODELS_DEV_HTTP_ERROR",
|
|
1331
|
+
message: `models.dev responded with HTTP ${response.status}`
|
|
1332
|
+
});
|
|
1198
1333
|
}
|
|
1199
1334
|
text = await response.text();
|
|
1200
1335
|
} catch (error) {
|
|
@@ -1640,6 +1775,8 @@ async function ensureAgent0ProjectDiscoveryGitShim(paths2) {
|
|
|
1640
1775
|
}
|
|
1641
1776
|
|
|
1642
1777
|
// src/agent0/runtime/engine.ts
|
|
1778
|
+
var PROVIDER_HEADER_TIMEOUT_MS = 30000;
|
|
1779
|
+
var PROVIDER_CHUNK_TIMEOUT_MS = 300000;
|
|
1643
1780
|
function buildAgent0OpenCodeAuthContent(config) {
|
|
1644
1781
|
return Object.fromEntries(getAgent0OpenCodeAuthenticatedProviders(config).map(([providerId, connection]) => [
|
|
1645
1782
|
providerId,
|
|
@@ -1649,10 +1786,20 @@ function buildAgent0OpenCodeAuthContent(config) {
|
|
|
1649
1786
|
function buildAgent0OpenCodeConfig(options) {
|
|
1650
1787
|
const builtIns = buildAgent0BuiltInCapabilities({
|
|
1651
1788
|
adkDevConsolePort: options.adkDevConsolePort,
|
|
1652
|
-
agentPath: options.agentPath
|
|
1789
|
+
agentPath: options.agentPath,
|
|
1790
|
+
engineDataDir: options.paths.engineDataDir
|
|
1653
1791
|
});
|
|
1654
1792
|
const authenticatedProviders = options.agent0Config ? getAgent0OpenCodeAuthenticatedProviders(options.agent0Config) : [];
|
|
1655
|
-
const externalProviderConfig = Object.fromEntries(authenticatedProviders.
|
|
1793
|
+
const externalProviderConfig = Object.fromEntries(authenticatedProviders.map(([providerId, connection]) => [
|
|
1794
|
+
providerId,
|
|
1795
|
+
{
|
|
1796
|
+
options: {
|
|
1797
|
+
...connection.auth.baseURL ? { baseURL: connection.auth.baseURL } : {},
|
|
1798
|
+
headerTimeout: PROVIDER_HEADER_TIMEOUT_MS,
|
|
1799
|
+
chunkTimeout: PROVIDER_CHUNK_TIMEOUT_MS
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
]));
|
|
1656
1803
|
const provider = {
|
|
1657
1804
|
...externalProviderConfig,
|
|
1658
1805
|
...options.cognitiveModels === undefined ? {} : { cognitive: buildAgent0CognitiveProvider(options) }
|
|
@@ -1696,7 +1843,12 @@ function buildAgent0CognitiveProvider(options) {
|
|
|
1696
1843
|
return {
|
|
1697
1844
|
api: "openai-completions",
|
|
1698
1845
|
name: "Botpress Cognitive",
|
|
1699
|
-
options: {
|
|
1846
|
+
options: {
|
|
1847
|
+
apiKey: "cognitive",
|
|
1848
|
+
baseURL,
|
|
1849
|
+
headerTimeout: PROVIDER_HEADER_TIMEOUT_MS,
|
|
1850
|
+
chunkTimeout: PROVIDER_CHUNK_TIMEOUT_MS
|
|
1851
|
+
},
|
|
1700
1852
|
models
|
|
1701
1853
|
};
|
|
1702
1854
|
}
|
|
@@ -1712,6 +1864,7 @@ function buildAgent0OpenCodeEnv(paths2, configOrContent, authContent = {}) {
|
|
|
1712
1864
|
OPENCODE_AUTH_CONTENT: JSON.stringify(authContent),
|
|
1713
1865
|
OPENCODE_TEST_HOME: paths2.fakeHomeDir,
|
|
1714
1866
|
OPENCODE_PURE: "1",
|
|
1867
|
+
OPENCODE_EXPERIMENTAL_PLAN_MODE: "1",
|
|
1715
1868
|
OPENCODE_DISABLE_PROJECT_CONFIG: "1",
|
|
1716
1869
|
OPENCODE_DISABLE_EXTERNAL_SKILLS: "1",
|
|
1717
1870
|
OPENCODE_DISABLE_DEFAULT_PLUGINS: "1",
|
|
@@ -1795,7 +1948,7 @@ function renderCognitiveModelModalities(model) {
|
|
|
1795
1948
|
var DEFAULT_STARTUP_TIMEOUT_MS = 15000;
|
|
1796
1949
|
var AGENT0_OPENCODE_HOSTNAME = "127.0.0.1";
|
|
1797
1950
|
var DEFAULT_SERVER_USERNAME = "agent0";
|
|
1798
|
-
var OPENCODE_VERSION = "1.
|
|
1951
|
+
var OPENCODE_VERSION = "1.17.11";
|
|
1799
1952
|
var PROVIDER_AUTH_ENV_KEYS = new Set([
|
|
1800
1953
|
"AICORE_SERVICE_KEY",
|
|
1801
1954
|
"ANTHROPIC_API_KEY",
|
|
@@ -2150,6 +2303,21 @@ function createAgent0RuntimeClient(options) {
|
|
|
2150
2303
|
warnings: []
|
|
2151
2304
|
};
|
|
2152
2305
|
},
|
|
2306
|
+
async getSessionDiff(sessionId, messageId) {
|
|
2307
|
+
const diffs = await fetchAgent0OpenCodeJson({
|
|
2308
|
+
engine: options.engine,
|
|
2309
|
+
fetch: fetchImpl,
|
|
2310
|
+
path: `/session/${encodeURIComponent(sessionId)}/diff`,
|
|
2311
|
+
searchParams: { directory: options.projectPath, messageID: messageId }
|
|
2312
|
+
});
|
|
2313
|
+
if (!Array.isArray(diffs)) {
|
|
2314
|
+
throw new Agent0RuntimeClientError("ENGINE_INVALID_RESPONSE", "Agent(0) private runtime returned an invalid session diff response");
|
|
2315
|
+
}
|
|
2316
|
+
return {
|
|
2317
|
+
diffs: diffs.flatMap(normalizeAgent0FileDiff),
|
|
2318
|
+
warnings: []
|
|
2319
|
+
};
|
|
2320
|
+
},
|
|
2153
2321
|
async sendMessage(sessionId, input) {
|
|
2154
2322
|
const send = async () => {
|
|
2155
2323
|
const message2 = await fetchAgent0OpenCodeJson({
|
|
@@ -2507,6 +2675,17 @@ function normalizeOpenCodeEvent(value) {
|
|
|
2507
2675
|
error: normalizeAgent0Error(properties.error)
|
|
2508
2676
|
};
|
|
2509
2677
|
}
|
|
2678
|
+
case "session.diff": {
|
|
2679
|
+
if (typeof properties.sessionID !== "string" || !Array.isArray(properties.diff)) {
|
|
2680
|
+
return invalidOpenCodeEvent("session.diff");
|
|
2681
|
+
}
|
|
2682
|
+
return {
|
|
2683
|
+
...id ? { id } : {},
|
|
2684
|
+
type: "session.diff",
|
|
2685
|
+
sessionId: properties.sessionID,
|
|
2686
|
+
diff: properties.diff.flatMap(normalizeAgent0FileDiff)
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2510
2689
|
case "question.asked": {
|
|
2511
2690
|
return { ...id ? { id } : {}, type: "question.asked", question: normalizeAgent0QuestionRequest(properties) };
|
|
2512
2691
|
}
|
|
@@ -2679,9 +2858,29 @@ function normalizeAgent0MessageInfo(info) {
|
|
|
2679
2858
|
...mode ? { mode } : {},
|
|
2680
2859
|
...model ? { model } : {},
|
|
2681
2860
|
...usage ? { usage } : {},
|
|
2861
|
+
...normalizeAgent0MessageSummary(info.summary) ? { summary: normalizeAgent0MessageSummary(info.summary) } : {},
|
|
2682
2862
|
...isRecord2(info.error) ? { error: normalizeAgent0Error(info.error) } : {}
|
|
2683
2863
|
};
|
|
2684
2864
|
}
|
|
2865
|
+
function normalizeAgent0MessageSummary(value) {
|
|
2866
|
+
if (!isRecord2(value) || !Array.isArray(value.diffs))
|
|
2867
|
+
return;
|
|
2868
|
+
return { diffs: value.diffs.flatMap(normalizeAgent0FileDiff) };
|
|
2869
|
+
}
|
|
2870
|
+
function normalizeAgent0FileDiff(value) {
|
|
2871
|
+
if (!isRecord2(value) || typeof value.additions !== "number" || !Number.isFinite(value.additions) || typeof value.deletions !== "number" || !Number.isFinite(value.deletions)) {
|
|
2872
|
+
return [];
|
|
2873
|
+
}
|
|
2874
|
+
return [
|
|
2875
|
+
{
|
|
2876
|
+
...typeof value.file === "string" ? { file: value.file } : {},
|
|
2877
|
+
...typeof value.patch === "string" ? { patch: value.patch } : {},
|
|
2878
|
+
additions: value.additions,
|
|
2879
|
+
deletions: value.deletions,
|
|
2880
|
+
...value.status === "added" || value.status === "deleted" || value.status === "modified" ? { status: value.status } : {}
|
|
2881
|
+
}
|
|
2882
|
+
];
|
|
2883
|
+
}
|
|
2685
2884
|
var EMPTY_COMPLETION_MAX_RETRIES = 1;
|
|
2686
2885
|
var EMPTY_COMPLETION_RETRY_DELAY_MS = 500;
|
|
2687
2886
|
function isEmptyCompletion(message) {
|
|
@@ -2717,8 +2916,14 @@ function normalizeAgent0AssistantMessageModel(value) {
|
|
|
2717
2916
|
...typeof value.variant === "string" ? { variant: value.variant } : {}
|
|
2718
2917
|
};
|
|
2719
2918
|
}
|
|
2919
|
+
var AGENT0_GENERAL_ENGINE_AGENT = "agent0-general";
|
|
2720
2920
|
function normalizeAgent0SessionMode(value) {
|
|
2721
|
-
|
|
2921
|
+
if (value === AGENT0_GENERAL_ENGINE_AGENT)
|
|
2922
|
+
return "general";
|
|
2923
|
+
return isAgent0SessionMode(value) ? value : undefined;
|
|
2924
|
+
}
|
|
2925
|
+
function toOpenCodeAgentName(mode) {
|
|
2926
|
+
return mode === "general" ? AGENT0_GENERAL_ENGINE_AGENT : mode;
|
|
2722
2927
|
}
|
|
2723
2928
|
function normalizeAgent0SessionStatus(value) {
|
|
2724
2929
|
if (!isRecord2(value))
|
|
@@ -3015,7 +3220,7 @@ function normalizeTimestamp(value) {
|
|
|
3015
3220
|
function toOpenCodePromptInput(input) {
|
|
3016
3221
|
return {
|
|
3017
3222
|
parts: input.parts.map(toOpenCodePromptPart),
|
|
3018
|
-
...input.mode === undefined ? {} : { agent: input.mode },
|
|
3223
|
+
...input.mode === undefined ? {} : { agent: toOpenCodeAgentName(input.mode) },
|
|
3019
3224
|
...input.generateReply === false ? { noReply: true } : {},
|
|
3020
3225
|
...input.model === undefined ? {} : {
|
|
3021
3226
|
model: {
|
|
@@ -3106,7 +3311,7 @@ function rewriteDataUrlMime(url, mime) {
|
|
|
3106
3311
|
function toOpenCodeCreateSessionInput(input) {
|
|
3107
3312
|
return {
|
|
3108
3313
|
...input.title === undefined ? {} : { title: input.title },
|
|
3109
|
-
...input.mode === undefined ? {} : { agent: input.mode },
|
|
3314
|
+
...input.mode === undefined ? {} : { agent: toOpenCodeAgentName(input.mode) },
|
|
3110
3315
|
...input.model === undefined ? {} : {
|
|
3111
3316
|
model: {
|
|
3112
3317
|
providerID: input.model.providerId,
|
|
@@ -3216,6 +3421,13 @@ class Agent0RuntimeManager {
|
|
|
3216
3421
|
}
|
|
3217
3422
|
return client.listMessages(sessionId);
|
|
3218
3423
|
}
|
|
3424
|
+
async getSessionDiff(sessionId, messageId) {
|
|
3425
|
+
const client = this.client;
|
|
3426
|
+
if (!client) {
|
|
3427
|
+
throw this.toNotRunningError();
|
|
3428
|
+
}
|
|
3429
|
+
return client.getSessionDiff(sessionId, messageId);
|
|
3430
|
+
}
|
|
3219
3431
|
async sendMessage(sessionId, input) {
|
|
3220
3432
|
const client = this.client;
|
|
3221
3433
|
if (!client) {
|
|
@@ -3382,6 +3594,8 @@ export {
|
|
|
3382
3594
|
mapModelsDevCatalog,
|
|
3383
3595
|
loadAgent0BuiltInCommandConfig,
|
|
3384
3596
|
listAgent0ProviderCatalog,
|
|
3597
|
+
isAgent0SessionMode,
|
|
3598
|
+
isAgent0Phase,
|
|
3385
3599
|
hasAgent0ProviderAuth,
|
|
3386
3600
|
getAgent0ProviderCatalogEntry,
|
|
3387
3601
|
getAgent0ProjectPaths,
|
|
@@ -3422,6 +3636,8 @@ export {
|
|
|
3422
3636
|
Agent0ConfigError,
|
|
3423
3637
|
Agent0CompositeProviderCatalogSource,
|
|
3424
3638
|
Agent0CognitiveCatalogSource,
|
|
3639
|
+
AGENT0_SWITCH_PHASE_RAW_TOOL_PERMISSION,
|
|
3640
|
+
AGENT0_SWITCH_PHASE_MCP_TOOL_PERMISSION,
|
|
3425
3641
|
AGENT0_SESSION_MODES,
|
|
3426
3642
|
AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION,
|
|
3427
3643
|
AGENT0_SCREENSHOT_MCP_TOOL_PERMISSION,
|
|
@@ -3433,9 +3649,10 @@ export {
|
|
|
3433
3649
|
AGENT0_PROJECT_CAPABILITIES_MANIFEST,
|
|
3434
3650
|
AGENT0_PROJECT_CAPABILITIES_DIR,
|
|
3435
3651
|
AGENT0_PRIMARY_AGENT_STEPS_ENV,
|
|
3652
|
+
AGENT0_PHASES,
|
|
3436
3653
|
AGENT0_HIDDEN_OPENCODE_SKILL,
|
|
3437
3654
|
AGENT0_CONFIG_SCHEMA_VERSION,
|
|
3438
3655
|
AGENT0_BUILT_IN_MCP_PERMISSION
|
|
3439
3656
|
};
|
|
3440
3657
|
|
|
3441
|
-
//# debugId=
|
|
3658
|
+
//# debugId=1FC692987BAA2E9D64756E2164756E21
|