@botpress/adk 2.0.4 → 3.0.0-beta.1

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.
Files changed (324) hide show
  1. package/dist/agent-project/agent-project.d.ts +5 -0
  2. package/dist/agent-project/agent-project.d.ts.map +1 -1
  3. package/dist/agent-project/agent-resolver.d.ts.map +1 -1
  4. package/dist/agent-project/types.d.ts +8 -88
  5. package/dist/agent-project/types.d.ts.map +1 -1
  6. package/dist/agent0/config/schema.d.ts +8 -130
  7. package/dist/agent0/config/schema.d.ts.map +1 -1
  8. package/dist/agent0/index.js +280 -63
  9. package/dist/agent0/index.js.map +17 -14
  10. package/dist/agent0/providers/source.d.ts.map +1 -1
  11. package/dist/agent0/runtime/client.d.ts +2 -1
  12. package/dist/agent0/runtime/client.d.ts.map +1 -1
  13. package/dist/agent0/runtime/engine.d.ts +2 -0
  14. package/dist/agent0/runtime/engine.d.ts.map +1 -1
  15. package/dist/agent0/runtime/manager.d.ts +2 -1
  16. package/dist/agent0/runtime/manager.d.ts.map +1 -1
  17. package/dist/agent0/types.d.ts +41 -1
  18. package/dist/agent0/types.d.ts.map +1 -1
  19. package/dist/auth/index.d.ts +1 -1
  20. package/dist/auth/index.d.ts.map +1 -1
  21. package/dist/bot-generator/dev-id-manager.d.ts +6 -0
  22. package/dist/bot-generator/dev-id-manager.d.ts.map +1 -1
  23. package/dist/bot-generator/generator.d.ts +1 -1
  24. package/dist/bot-generator/generator.d.ts.map +1 -1
  25. package/dist/bot-generator/install-package.d.ts +22 -0
  26. package/dist/bot-generator/install-package.d.ts.map +1 -0
  27. package/dist/bot-generator/integration-sync.d.ts +6 -20
  28. package/dist/bot-generator/integration-sync.d.ts.map +1 -1
  29. package/dist/bot-generator/interface-sync.d.ts +6 -20
  30. package/dist/bot-generator/interface-sync.d.ts.map +1 -1
  31. package/dist/bot-generator/plugin-sync.d.ts +5 -20
  32. package/dist/bot-generator/plugin-sync.d.ts.map +1 -1
  33. package/dist/build/__fixtures__/generated-import-bot/bot.definition.d.ts +14 -0
  34. package/dist/build/__fixtures__/generated-import-bot/bot.definition.d.ts.map +1 -0
  35. package/dist/build/__fixtures__/generated-import-bot/src/index.d.ts +3 -0
  36. package/dist/build/__fixtures__/generated-import-bot/src/index.d.ts.map +1 -0
  37. package/dist/build/__fixtures__/minimal-bot/bot.definition.d.ts +26 -0
  38. package/dist/build/__fixtures__/minimal-bot/bot.definition.d.ts.map +1 -0
  39. package/dist/build/__fixtures__/minimal-bot/src/index.d.ts +6 -0
  40. package/dist/build/__fixtures__/minimal-bot/src/index.d.ts.map +1 -0
  41. package/dist/build/bot-builder.d.ts +48 -0
  42. package/dist/build/bot-builder.d.ts.map +1 -0
  43. package/dist/build/definition-inputs.d.ts +21 -0
  44. package/dist/build/definition-inputs.d.ts.map +1 -0
  45. package/dist/build/definition-loader.d.ts +14 -0
  46. package/dist/build/definition-loader.d.ts.map +1 -0
  47. package/dist/chat-bundle.cjs +23 -22
  48. package/dist/codegen/bot-implementation/bot-implementation.d.ts +9 -0
  49. package/dist/codegen/bot-implementation/bot-implementation.d.ts.map +1 -0
  50. package/dist/codegen/bot-implementation/bot-plugins/index.d.ts +8 -0
  51. package/dist/codegen/bot-implementation/bot-plugins/index.d.ts.map +1 -0
  52. package/dist/codegen/bot-implementation/bot-plugins/plugin-module.d.ts +14 -0
  53. package/dist/codegen/bot-implementation/bot-plugins/plugin-module.d.ts.map +1 -0
  54. package/dist/codegen/bot-implementation/bot-typings/actions-module.d.ts +22 -0
  55. package/dist/codegen/bot-implementation/bot-typings/actions-module.d.ts.map +1 -0
  56. package/dist/codegen/bot-implementation/bot-typings/events-module.d.ts +11 -0
  57. package/dist/codegen/bot-implementation/bot-typings/events-module.d.ts.map +1 -0
  58. package/dist/codegen/bot-implementation/bot-typings/index.d.ts +8 -0
  59. package/dist/codegen/bot-implementation/bot-typings/index.d.ts.map +1 -0
  60. package/dist/codegen/bot-implementation/bot-typings/states-module.d.ts +18 -0
  61. package/dist/codegen/bot-implementation/bot-typings/states-module.d.ts.map +1 -0
  62. package/dist/codegen/bot-implementation/bot-typings/tables-module.d.ts +11 -0
  63. package/dist/codegen/bot-implementation/bot-typings/tables-module.d.ts.map +1 -0
  64. package/dist/codegen/bot-implementation/bot-typings/workflows-module.d.ts +28 -0
  65. package/dist/codegen/bot-implementation/bot-typings/workflows-module.d.ts.map +1 -0
  66. package/dist/codegen/bot-implementation/index.d.ts +4 -0
  67. package/dist/codegen/bot-implementation/index.d.ts.map +1 -0
  68. package/dist/codegen/casing.d.ts +11 -0
  69. package/dist/codegen/casing.d.ts.map +1 -0
  70. package/dist/codegen/consts.d.ts +19 -0
  71. package/dist/codegen/consts.d.ts.map +1 -0
  72. package/dist/codegen/generators.d.ts +16 -0
  73. package/dist/codegen/generators.d.ts.map +1 -0
  74. package/dist/codegen/index.d.ts +9 -0
  75. package/dist/codegen/index.d.ts.map +1 -0
  76. package/dist/codegen/integration-implementation/index.d.ts +4 -0
  77. package/dist/codegen/integration-implementation/index.d.ts.map +1 -0
  78. package/dist/codegen/integration-implementation/integration-implementation.d.ts +8 -0
  79. package/dist/codegen/integration-implementation/integration-implementation.d.ts.map +1 -0
  80. package/dist/codegen/integration-implementation/integration-typings/actions-module.d.ts +22 -0
  81. package/dist/codegen/integration-implementation/integration-typings/actions-module.d.ts.map +1 -0
  82. package/dist/codegen/integration-implementation/integration-typings/channels-module.d.ts +6 -0
  83. package/dist/codegen/integration-implementation/integration-typings/channels-module.d.ts.map +1 -0
  84. package/dist/codegen/integration-implementation/integration-typings/configuration-module.d.ts +8 -0
  85. package/dist/codegen/integration-implementation/integration-typings/configuration-module.d.ts.map +1 -0
  86. package/dist/codegen/integration-implementation/integration-typings/configurations-module.d.ts +11 -0
  87. package/dist/codegen/integration-implementation/integration-typings/configurations-module.d.ts.map +1 -0
  88. package/dist/codegen/integration-implementation/integration-typings/entities-module.d.ts +11 -0
  89. package/dist/codegen/integration-implementation/integration-typings/entities-module.d.ts.map +1 -0
  90. package/dist/codegen/integration-implementation/integration-typings/events-module.d.ts +11 -0
  91. package/dist/codegen/integration-implementation/integration-typings/events-module.d.ts.map +1 -0
  92. package/dist/codegen/integration-implementation/integration-typings/index.d.ts +9 -0
  93. package/dist/codegen/integration-implementation/integration-typings/index.d.ts.map +1 -0
  94. package/dist/codegen/integration-implementation/integration-typings/states-module.d.ts +18 -0
  95. package/dist/codegen/integration-implementation/integration-typings/states-module.d.ts.map +1 -0
  96. package/dist/codegen/integration-package/index.d.ts +3 -0
  97. package/dist/codegen/integration-package/index.d.ts.map +1 -0
  98. package/dist/codegen/integration-package/integration-package-definition/actions-module.d.ts +22 -0
  99. package/dist/codegen/integration-package/integration-package-definition/actions-module.d.ts.map +1 -0
  100. package/dist/codegen/integration-package/integration-package-definition/channels-module.d.ts +6 -0
  101. package/dist/codegen/integration-package/integration-package-definition/channels-module.d.ts.map +1 -0
  102. package/dist/codegen/integration-package/integration-package-definition/configuration-module.d.ts +8 -0
  103. package/dist/codegen/integration-package/integration-package-definition/configuration-module.d.ts.map +1 -0
  104. package/dist/codegen/integration-package/integration-package-definition/configurations-module.d.ts +11 -0
  105. package/dist/codegen/integration-package/integration-package-definition/configurations-module.d.ts.map +1 -0
  106. package/dist/codegen/integration-package/integration-package-definition/entities-module.d.ts +11 -0
  107. package/dist/codegen/integration-package/integration-package-definition/entities-module.d.ts.map +1 -0
  108. package/dist/codegen/integration-package/integration-package-definition/events-module.d.ts +11 -0
  109. package/dist/codegen/integration-package/integration-package-definition/events-module.d.ts.map +1 -0
  110. package/dist/codegen/integration-package/integration-package-definition/index.d.ts +9 -0
  111. package/dist/codegen/integration-package/integration-package-definition/index.d.ts.map +1 -0
  112. package/dist/codegen/integration-package/integration-package-definition/interfaces-module.d.ts +11 -0
  113. package/dist/codegen/integration-package/integration-package-definition/interfaces-module.d.ts.map +1 -0
  114. package/dist/codegen/integration-package/integration-package-definition/states-module.d.ts +11 -0
  115. package/dist/codegen/integration-package/integration-package-definition/states-module.d.ts.map +1 -0
  116. package/dist/codegen/integration-package/integration-package-definition/typings.d.ts +11 -0
  117. package/dist/codegen/integration-package/integration-package-definition/typings.d.ts.map +1 -0
  118. package/dist/codegen/interface-implementation/index.d.ts +5 -0
  119. package/dist/codegen/interface-implementation/index.d.ts.map +1 -0
  120. package/dist/codegen/interface-implementation/integration-typings/actions-module.d.ts +22 -0
  121. package/dist/codegen/interface-implementation/integration-typings/actions-module.d.ts.map +1 -0
  122. package/dist/codegen/interface-implementation/integration-typings/channels-module.d.ts +6 -0
  123. package/dist/codegen/interface-implementation/integration-typings/channels-module.d.ts.map +1 -0
  124. package/dist/codegen/interface-implementation/integration-typings/entities-module.d.ts +11 -0
  125. package/dist/codegen/interface-implementation/integration-typings/entities-module.d.ts.map +1 -0
  126. package/dist/codegen/interface-implementation/integration-typings/events-module.d.ts +11 -0
  127. package/dist/codegen/interface-implementation/integration-typings/events-module.d.ts.map +1 -0
  128. package/dist/codegen/interface-implementation/integration-typings/index.d.ts +9 -0
  129. package/dist/codegen/interface-implementation/integration-typings/index.d.ts.map +1 -0
  130. package/dist/codegen/interface-package/index.d.ts +3 -0
  131. package/dist/codegen/interface-package/index.d.ts.map +1 -0
  132. package/dist/codegen/interface-package/interface-package-definition/actions-module.d.ts +22 -0
  133. package/dist/codegen/interface-package/interface-package-definition/actions-module.d.ts.map +1 -0
  134. package/dist/codegen/interface-package/interface-package-definition/channels-module.d.ts +6 -0
  135. package/dist/codegen/interface-package/interface-package-definition/channels-module.d.ts.map +1 -0
  136. package/dist/codegen/interface-package/interface-package-definition/entities-module.d.ts +11 -0
  137. package/dist/codegen/interface-package/interface-package-definition/entities-module.d.ts.map +1 -0
  138. package/dist/codegen/interface-package/interface-package-definition/events-module.d.ts +11 -0
  139. package/dist/codegen/interface-package/interface-package-definition/events-module.d.ts.map +1 -0
  140. package/dist/codegen/interface-package/interface-package-definition/index.d.ts +9 -0
  141. package/dist/codegen/interface-package/interface-package-definition/index.d.ts.map +1 -0
  142. package/dist/codegen/interface-package/interface-package-definition/typings.d.ts +8 -0
  143. package/dist/codegen/interface-package/interface-package-definition/typings.d.ts.map +1 -0
  144. package/dist/codegen/module.d.ts +54 -0
  145. package/dist/codegen/module.d.ts.map +1 -0
  146. package/dist/codegen/paths.d.ts +8 -0
  147. package/dist/codegen/paths.d.ts.map +1 -0
  148. package/dist/codegen/plugin-implementation/index.d.ts +4 -0
  149. package/dist/codegen/plugin-implementation/index.d.ts.map +1 -0
  150. package/dist/codegen/plugin-implementation/plugin-implementation.d.ts +8 -0
  151. package/dist/codegen/plugin-implementation/plugin-implementation.d.ts.map +1 -0
  152. package/dist/codegen/plugin-implementation/plugin-typings/actions-module.d.ts +22 -0
  153. package/dist/codegen/plugin-implementation/plugin-typings/actions-module.d.ts.map +1 -0
  154. package/dist/codegen/plugin-implementation/plugin-typings/configuration-module.d.ts +8 -0
  155. package/dist/codegen/plugin-implementation/plugin-typings/configuration-module.d.ts.map +1 -0
  156. package/dist/codegen/plugin-implementation/plugin-typings/conversation-module.d.ts +8 -0
  157. package/dist/codegen/plugin-implementation/plugin-typings/conversation-module.d.ts.map +1 -0
  158. package/dist/codegen/plugin-implementation/plugin-typings/events-module.d.ts +11 -0
  159. package/dist/codegen/plugin-implementation/plugin-typings/events-module.d.ts.map +1 -0
  160. package/dist/codegen/plugin-implementation/plugin-typings/index.d.ts +9 -0
  161. package/dist/codegen/plugin-implementation/plugin-typings/index.d.ts.map +1 -0
  162. package/dist/codegen/plugin-implementation/plugin-typings/message-module.d.ts +8 -0
  163. package/dist/codegen/plugin-implementation/plugin-typings/message-module.d.ts.map +1 -0
  164. package/dist/codegen/plugin-implementation/plugin-typings/states-module.d.ts +18 -0
  165. package/dist/codegen/plugin-implementation/plugin-typings/states-module.d.ts.map +1 -0
  166. package/dist/codegen/plugin-implementation/plugin-typings/tables-module.d.ts +11 -0
  167. package/dist/codegen/plugin-implementation/plugin-typings/tables-module.d.ts.map +1 -0
  168. package/dist/codegen/plugin-implementation/plugin-typings/user-module.d.ts +8 -0
  169. package/dist/codegen/plugin-implementation/plugin-typings/user-module.d.ts.map +1 -0
  170. package/dist/codegen/plugin-implementation/plugin-typings/workflows-module.d.ts +28 -0
  171. package/dist/codegen/plugin-implementation/plugin-typings/workflows-module.d.ts.map +1 -0
  172. package/dist/codegen/plugin-package/index.d.ts +3 -0
  173. package/dist/codegen/plugin-package/index.d.ts.map +1 -0
  174. package/dist/codegen/plugin-package/plugin-package-definition/actions-module.d.ts +22 -0
  175. package/dist/codegen/plugin-package/plugin-package-definition/actions-module.d.ts.map +1 -0
  176. package/dist/codegen/plugin-package/plugin-package-definition/configuration-module.d.ts +8 -0
  177. package/dist/codegen/plugin-package/plugin-package-definition/configuration-module.d.ts.map +1 -0
  178. package/dist/codegen/plugin-package/plugin-package-definition/events-module.d.ts +11 -0
  179. package/dist/codegen/plugin-package/plugin-package-definition/events-module.d.ts.map +1 -0
  180. package/dist/codegen/plugin-package/plugin-package-definition/index.d.ts +9 -0
  181. package/dist/codegen/plugin-package/plugin-package-definition/index.d.ts.map +1 -0
  182. package/dist/codegen/plugin-package/plugin-package-definition/interfaces-module.d.ts +8 -0
  183. package/dist/codegen/plugin-package/plugin-package-definition/interfaces-module.d.ts.map +1 -0
  184. package/dist/codegen/plugin-package/plugin-package-definition/recurring-events-module.d.ts +6 -0
  185. package/dist/codegen/plugin-package/plugin-package-definition/recurring-events-module.d.ts.map +1 -0
  186. package/dist/codegen/plugin-package/plugin-package-definition/states-module.d.ts +11 -0
  187. package/dist/codegen/plugin-package/plugin-package-definition/states-module.d.ts.map +1 -0
  188. package/dist/codegen/plugin-package/plugin-package-definition/typings.d.ts +8 -0
  189. package/dist/codegen/plugin-package/plugin-package-definition/typings.d.ts.map +1 -0
  190. package/dist/codegen/schema.d.ts +8 -0
  191. package/dist/codegen/schema.d.ts.map +1 -0
  192. package/dist/codegen/secret-module.d.ts +17 -0
  193. package/dist/codegen/secret-module.d.ts.map +1 -0
  194. package/dist/codegen/strings.d.ts +6 -0
  195. package/dist/codegen/strings.d.ts.map +1 -0
  196. package/dist/codegen/type-utils.d.ts +9 -0
  197. package/dist/codegen/type-utils.d.ts.map +1 -0
  198. package/dist/codegen/typings.d.ts +167 -0
  199. package/dist/codegen/typings.d.ts.map +1 -0
  200. package/dist/codegen/utils.d.ts +12 -0
  201. package/dist/codegen/utils.d.ts.map +1 -0
  202. package/dist/commands/base-command.d.ts.map +1 -1
  203. package/dist/commands/index.d.ts +1 -12
  204. package/dist/commands/index.d.ts.map +1 -1
  205. package/dist/commands/native-command.d.ts +39 -0
  206. package/dist/commands/native-command.d.ts.map +1 -0
  207. package/dist/constants.d.ts +1 -0
  208. package/dist/constants.d.ts.map +1 -1
  209. package/dist/dependencies/catalog/catalog-service.d.ts +2 -0
  210. package/dist/dependencies/catalog/catalog-service.d.ts.map +1 -1
  211. package/dist/dependencies/catalog/client-factory.d.ts +7 -10
  212. package/dist/dependencies/catalog/client-factory.d.ts.map +1 -1
  213. package/dist/dependencies/catalog/integration-source.d.ts +1 -0
  214. package/dist/dependencies/catalog/integration-source.d.ts.map +1 -1
  215. package/dist/dependencies/catalog/interface-source.d.ts +1 -0
  216. package/dist/dependencies/catalog/interface-source.d.ts.map +1 -1
  217. package/dist/dependencies/catalog/plugin-source.d.ts +7 -0
  218. package/dist/dependencies/catalog/plugin-source.d.ts.map +1 -1
  219. package/dist/dependencies/catalog/resolution-cache.d.ts +8 -6
  220. package/dist/dependencies/catalog/resolution-cache.d.ts.map +1 -1
  221. package/dist/dependencies/dependency-manager.d.ts +13 -0
  222. package/dist/dependencies/dependency-manager.d.ts.map +1 -1
  223. package/dist/dependencies/index.js +502 -267
  224. package/dist/dependencies/index.js.map +24 -24
  225. package/dist/dependencies/resolvers/plugin-resolver.d.ts.map +1 -1
  226. package/dist/dependencies/snapshot-store.d.ts.map +1 -1
  227. package/dist/dependencies/types.d.ts +23 -318
  228. package/dist/dependencies/types.d.ts.map +1 -1
  229. package/dist/deploy/attributes.d.ts +16 -0
  230. package/dist/deploy/attributes.d.ts.map +1 -0
  231. package/dist/deploy/bot-body.d.ts +26 -0
  232. package/dist/deploy/bot-body.d.ts.map +1 -0
  233. package/dist/deploy/errors.d.ts +9 -0
  234. package/dist/deploy/errors.d.ts.map +1 -0
  235. package/dist/deploy/integration-utils.d.ts +11 -0
  236. package/dist/deploy/integration-utils.d.ts.map +1 -0
  237. package/dist/deploy/records.d.ts +14 -0
  238. package/dist/deploy/records.d.ts.map +1 -0
  239. package/dist/deploy/schema-utils.d.ts +16 -0
  240. package/dist/deploy/schema-utils.d.ts.map +1 -0
  241. package/dist/deploy-manifest/index.d.ts +23 -491
  242. package/dist/deploy-manifest/index.d.ts.map +1 -1
  243. package/dist/file-watcher/watcher.d.ts +18 -4
  244. package/dist/file-watcher/watcher.d.ts.map +1 -1
  245. package/dist/generators/tests.d.ts.map +1 -1
  246. package/dist/index.d.ts +11 -4
  247. package/dist/index.d.ts.map +1 -1
  248. package/dist/index.js +15846 -10935
  249. package/dist/index.js.map +128 -48
  250. package/dist/knowledge/manager.d.ts.map +1 -1
  251. package/dist/native-deploy/deploy-bot.d.ts +32 -0
  252. package/dist/native-deploy/deploy-bot.d.ts.map +1 -0
  253. package/dist/native-deploy/prepare-dependencies.d.ts +13 -0
  254. package/dist/native-deploy/prepare-dependencies.d.ts.map +1 -0
  255. package/dist/native-dev/dev-runtime.d.ts +159 -0
  256. package/dist/native-dev/dev-runtime.d.ts.map +1 -0
  257. package/dist/native-dev/event-emitter.d.ts +8 -0
  258. package/dist/native-dev/event-emitter.d.ts.map +1 -0
  259. package/dist/native-dev/tunnel.d.ts +56 -0
  260. package/dist/native-dev/tunnel.d.ts.map +1 -0
  261. package/dist/native-dev/worker/child-wrapper.d.ts +24 -0
  262. package/dist/native-dev/worker/child-wrapper.d.ts.map +1 -0
  263. package/dist/native-dev/worker/config.d.ts +21 -0
  264. package/dist/native-dev/worker/config.d.ts.map +1 -0
  265. package/dist/native-dev/worker/worker-state.d.ts +31 -0
  266. package/dist/native-dev/worker/worker-state.d.ts.map +1 -0
  267. package/dist/native-dev/worker/worker.d.ts +32 -0
  268. package/dist/native-dev/worker/worker.d.ts.map +1 -0
  269. package/dist/{commands/bp-dev-worker-env.d.ts → native-dev/worker-env.d.ts} +1 -1
  270. package/dist/native-dev/worker-env.d.ts.map +1 -0
  271. package/dist/plugins/manager.d.ts +6 -0
  272. package/dist/plugins/manager.d.ts.map +1 -1
  273. package/dist/preflight/checker.d.ts +1 -1
  274. package/dist/preflight/checker.d.ts.map +1 -1
  275. package/dist/preflight/types.d.ts +1 -1
  276. package/dist/preflight/types.d.ts.map +1 -1
  277. package/dist/runner/script-runner.d.ts +0 -4
  278. package/dist/runner/script-runner.d.ts.map +1 -1
  279. package/dist/secrets/index.d.ts +5 -2
  280. package/dist/secrets/index.d.ts.map +1 -1
  281. package/dist/secrets/local.d.ts +28 -0
  282. package/dist/secrets/local.d.ts.map +1 -0
  283. package/dist/secrets/remote.d.ts +22 -0
  284. package/dist/secrets/remote.d.ts.map +1 -0
  285. package/dist/secrets/status.d.ts +24 -0
  286. package/dist/secrets/status.d.ts.map +1 -0
  287. package/dist/secrets/validation.d.ts +11 -0
  288. package/dist/secrets/validation.d.ts.map +1 -0
  289. package/dist/templates/README.md +6 -1
  290. package/dist/templates/blank/README.md +5 -0
  291. package/dist/templates/botpress-desk/README.md +5 -0
  292. package/dist/templates/crm-enrichment/README.md +5 -0
  293. package/dist/templates/hello-world/README.md +5 -0
  294. package/dist/templates/knowledge-assistant/README.md +5 -0
  295. package/dist/templates/slack-triage/README.md +5 -0
  296. package/dist/utils/adk-ignore.d.ts +17 -0
  297. package/dist/utils/adk-ignore.d.ts.map +1 -0
  298. package/dist/utils/json-ordering.d.ts +1 -1
  299. package/dist/utils/json-ordering.d.ts.map +1 -1
  300. package/dist/utils/ref-parser.d.ts +17 -0
  301. package/dist/utils/ref-parser.d.ts.map +1 -0
  302. package/dist/utils/source-map-optimizer.d.ts +4 -4
  303. package/package.json +11 -12
  304. package/dist/auth/bp-cli-import.d.ts +0 -16
  305. package/dist/auth/bp-cli-import.d.ts.map +0 -1
  306. package/dist/commands/bp-add-command.d.ts +0 -19
  307. package/dist/commands/bp-add-command.d.ts.map +0 -1
  308. package/dist/commands/bp-build-command.d.ts +0 -14
  309. package/dist/commands/bp-build-command.d.ts.map +0 -1
  310. package/dist/commands/bp-chat-command.d.ts +0 -18
  311. package/dist/commands/bp-chat-command.d.ts.map +0 -1
  312. package/dist/commands/bp-cli.d.ts +0 -14
  313. package/dist/commands/bp-cli.d.ts.map +0 -1
  314. package/dist/commands/bp-cli.js +0 -147
  315. package/dist/commands/bp-cli.js.map +0 -12
  316. package/dist/commands/bp-deploy-command.d.ts +0 -21
  317. package/dist/commands/bp-deploy-command.d.ts.map +0 -1
  318. package/dist/commands/bp-dev-command.d.ts +0 -89
  319. package/dist/commands/bp-dev-command.d.ts.map +0 -1
  320. package/dist/commands/bp-dev-stderr.d.ts +0 -30
  321. package/dist/commands/bp-dev-stderr.d.ts.map +0 -1
  322. package/dist/commands/bp-dev-worker-env.d.ts.map +0 -1
  323. package/dist/secrets/manager.d.ts +0 -44
  324. package/dist/secrets/manager.d.ts.map +0 -1
@@ -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 ?? false;
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 = ["default", "guided"];
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/default.ts
94
- var AGENT0_DEFAULT_PROMPT = `You are agent(0) — an expert assistant embedded in the Botpress Agent Development Kit control panel.
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. An agent project has:
101
- - /actions — strongly-typed callable functions (Action from @botpress/runtime)
102
- - /tools — LLM-callable interfaces with natural language descriptions (Autonomous.Tool from @botpress/runtime)
103
- - /workflows — step-based, resumable long-running processes (Workflow from @botpress/runtime)
104
- - /conversations — channel-specific interaction handlers (Conversation from @botpress/runtime)
105
- - /tables — schema-validated data storage with semantic search (Table from @botpress/runtime)
106
- - /triggers — event subscription system (Trigger from @botpress/runtime)
107
- - /knowledge — RAG knowledge base documents
108
- - agent.config.ts — agent metadata, integrations, model configuration, variables
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
- The ADK compiles these high-level primitives down to Botpress SDK primitives. Default to ADK terms. Only drop to Botpress SDK concepts when the problem requires it (SDK-level errors, compilation issues, or when the developer explicitly asks).
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
- Schemas use \`z\` from @botpress/sdk (a Zod fork) — never import Zod directly.
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
- Standalone tools use \`Autonomous.Tool\`: \`import { Autonomous, z } from '@botpress/runtime'\`, then
115
- \`new Autonomous.Tool({...})\`. There is no top-level \`Tool\` export from \`@botpress/runtime\`.
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
- **Working directory.** Your shell is already set to the agent project root — an existing ADK project you build into; never scaffold a new or nested project (no \`adk init\`). Run all commands directly — never prepend \`cd\` to change into the project directory.
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
- **CLI-first.** Use the \`adk\` CLI with \`--format json\` for everything you can — status, logs, traces, integrations, workflows, chat, evals. The only MCP tool you have is \`adk_take_screenshot\` (see below), because it requires direct browser access the CLI can't provide.
171
+ ${AGENT0_SHARED_CONTEXT}
122
172
 
123
- **Do not run dev subcommands.** Never run commands that start, restart, or watch a development server from this embedded assistant, including \`adk dev\`, \`bun dev\`, \`bun run dev\`, \`npm run dev\`, \`pnpm dev\`, \`yarn dev\`, \`vite dev\`, or framework-specific \`dev\` subcommands. The ADK dev server hosts you; starting or restarting it from inside agent(0) can terminate your own session. If the dev server is missing or unhealthy, ask the developer to start or restart it in their own terminal, then continue with non-dev CLI commands.
173
+ ${AGENT0_PHASE_DEFINITIONS}
124
174
 
125
- **Skills.** The \`adk\` skill is preloaded for every conversation — treat it as your authoritative reference for ADK primitives, conventions, and CLI usage. Don't try to re-load it. Other packaged skills you can load on demand for deeper topics: \`adk-debugger\` (systematic debugging, traces, common failures), \`adk-evals\` (writing and running evals), \`adk-dev-console\` (Dev Console UI context), and \`adk-docs\` (creating and maintaining ADK docs).
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
- **Page context is auto-attached.** Every developer message begins with a hidden \`<dev_console_context>\` block describing what they're currently viewing in the dev console — page, URL, selected entity (trace ID, workflow name, action name, etc.), and any active filters. Use it to skip "what page are you on?" questions and answer in terms of what the developer can already see. The block is internal: never echo it back, never quote it verbatim. If it's missing or stale, fall back to asking.
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
- **Look at the screen when it matters.** Use \`adk_take_screenshot\` to capture what the developer currently sees (page + sidebar + your own panel) when they reference something visual — "I don't see X", "where is this?", "what's that button?", "this looks wrong", "show you what I'm looking at". Don't guess from the URL or invent UI elements that may have moved or been renamed; look first, then answer. Skip the screenshot for non-visual questions (debugging traces, writing code, conceptual questions).
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
- **Orient on first interaction.** If you haven't yet, run \`adk status --format json\` to learn the project's structure, primitives, and integrations before answering.
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, write carefully.** Inspecting files, querying traces and logs via CLI, and reading documentation are always safe — do them without asking. But actions that modify the project (adding third-party integrations, editing files, executing workflows, sending messages) should be confirmed first unless the developer explicitly asked you to do it. Installing a chat channel to test your own bot is part of testing — see below — not a change that needs confirmation.
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); run \`tsc --noEmit\` before considering any task done. Then check the file and generated types. Traces won't help.
140
- - Runtime behavior is wrong ("it responds wrong") → reproduce with \`adk chat --single "<relevant message>" --format json\`, then inspect traces with \`adk traces --format json\`
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
- **Integrations.** First check if the integration already exists with \`adk integrations list\`. Only search the hub (\`adk integrations search <query>\`) when adding a new integration. Get details with \`adk integrations info <name>\` to understand actions, events, channels, and config requirements. Add it with \`adk integrations add <name>\` after the developer confirms.
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
- **Test iteratively.** To send messages, use \`adk chat --single "<message>" --format json\`. Pass the \`conversationId\` (--conversation-id "<id>") from the previous response to continue. Only test against the local dev bot. Sends need a channel: if none is installed, run \`adk integrations add chat\` first and don't wait for confirmation — installing the test channel is part of testing. Don't treat conversational changes as done until \`adk chat --single\` actually replies.
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\` to discover available workflows. Use \`adk workflows inspect <name> --format json\` to get the input schema. Use \`adk workflows run <name> '{"key": "value"}' --format json\` to execute. For workflows with no required input, pass \`'{}'\` as the payload.
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
- **Handle failures.** If a command or tool returns an error, tell the developer what happened and suggest 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.
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
- **Edit with precision.** When modifying code, 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.
212
+ ${AGENT0_SHARED_COMMUNICATION}`;
153
213
 
154
- ## How you communicate
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
- **Lead with the answer.** First sentence is the diagnosis, the solution, or the action you took. Context and explanation come after, if needed.
217
+ ${AGENT0_SHARED_CONTEXT}
157
218
 
158
- **Show, don't describe.** Instead of "you should add error handling," show the code change. Instead of "the trace shows a failure," show the relevant span data and what it means.
219
+ ${AGENT0_PHASE_DEFINITIONS}
159
220
 
160
- **Match the developer's energy.** Short question → short answer. Detailed question → detailed response. "Why is this broken?" → diagnosis + fix. "How do workflows work?" → teach.
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
- **Hypothesize while verifying.** If you have a likely diagnosis, say so while you check. "This usually means X — checking your trace now" is better than silence followed by an answer.
223
+ ## How to plan an ADK change
163
224
 
164
- **When you fix something, explain what you changed and why.** Don't apply changes silently — the developer needs to understand the fix to trust it and learn from it.
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
- **When you don't know, say so plainly.** "I don't have enough context — can you share the error message?" is fine.
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
- **Skip the filler.** No "Great question!", no "Let me help you with that." Just do it.
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
- **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.`;
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 AGENT0_DEFAULT_AGENT = "default";
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
- default: {
364
- description: "Agent(0) - helps build and debug Botpress ADK agents",
365
- prompt: AGENT0_DEFAULT_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: AGENT0_DEFAULT_AGENT
520
+ defaultAgent: AGENT0_GENERAL_AGENT
389
521
  };
390
522
  }
391
523
  function getAgent0ProjectCapabilitiesRoot(projectPath) {
@@ -572,7 +704,7 @@ var agent0ConfigPreferencesSchema = z.object({
572
704
  var agent0ConfigSchema = z.object({
573
705
  schemaVersion: z.literal(AGENT0_CONFIG_SCHEMA_VERSION),
574
706
  enabled: z.boolean(),
575
- providers: z.record(agent0ProviderConnectionSchema),
707
+ providers: z.record(z.string(), agent0ProviderConnectionSchema),
576
708
  preferences: agent0ConfigPreferencesSchema,
577
709
  createdAt: z.string().datetime(),
578
710
  updatedAt: z.string().datetime()
@@ -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 Error(`models.dev responded with HTTP ${response.status}`);
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.flatMap(([providerId, connection]) => connection.auth.baseURL ? [[providerId, { options: { baseURL: connection.auth.baseURL } }]] : []));
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: { apiKey: "cognitive", baseURL },
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.15.10";
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
- return value === "default" || value === "guided" ? value : undefined;
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=40B39330E6C0780D64756E2164756E21
3658
+ //# debugId=1B54A2AB3E9CB11F64756E2164756E21