@botpress/adk 1.19.0-beta.9 → 2.0.0-alpha.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.
Files changed (199) hide show
  1. package/dist/agent-init/agent-project-generator.d.ts +5 -1
  2. package/dist/agent-init/agent-project-generator.d.ts.map +1 -1
  3. package/dist/agent-project/agent-project.d.ts +3 -3
  4. package/dist/agent-project/agent-project.d.ts.map +1 -1
  5. package/dist/agent-project/agent-resolver.d.ts.map +1 -1
  6. package/dist/agent-project/config-writer.d.ts +1 -1
  7. package/dist/agent-project/dependency-state-to-dependencies.d.ts +11 -0
  8. package/dist/agent-project/dependency-state-to-dependencies.d.ts.map +1 -0
  9. package/dist/agent-project/types.d.ts +9 -4
  10. package/dist/agent-project/types.d.ts.map +1 -1
  11. package/dist/agent0/capabilities/commands/adk-build.md +6 -5
  12. package/dist/agent0/capabilities/commands/adk-debug.md +1 -1
  13. package/dist/agent0/capabilities/commands/adk-dev-console.md +1 -1
  14. package/dist/agent0/capabilities/commands/adk-document.md +10 -2
  15. package/dist/agent0/capabilities/commands/adk-eval.md +1 -1
  16. package/dist/agent0/capabilities/commands/adk-explain.md +2 -2
  17. package/dist/agent0/capabilities/commands/adk-init.md +2 -2
  18. package/dist/agent0/capabilities/commands/adk-ship.md +1 -1
  19. package/dist/agent0/capabilities/commands/adk-test.md +3 -3
  20. package/dist/agent0/capabilities/commands/adk-validate.md +3 -3
  21. package/dist/agent0/capabilities/skills/adk/SKILL.md +21 -21
  22. package/dist/agent0/capabilities/skills/adk/references/actions.md +245 -239
  23. package/dist/agent0/capabilities/skills/adk/references/advanced-patterns.md +185 -218
  24. package/dist/agent0/capabilities/skills/adk/references/agent-config.md +74 -71
  25. package/dist/agent0/capabilities/skills/adk/references/assets.md +45 -48
  26. package/dist/agent0/capabilities/skills/adk/references/autonomous-execution.md +40 -46
  27. package/dist/agent0/capabilities/skills/adk/references/cli.md +17 -7
  28. package/dist/agent0/capabilities/skills/adk/references/context-api.md +98 -94
  29. package/dist/agent0/capabilities/skills/adk/references/conversation-lifecycle.md +65 -62
  30. package/dist/agent0/capabilities/skills/adk/references/conversations.md +395 -385
  31. package/dist/agent0/capabilities/skills/adk/references/custom-components.md +1 -1
  32. package/dist/agent0/capabilities/skills/adk/references/desk.md +236 -234
  33. package/dist/agent0/capabilities/skills/adk/references/explain-config.md +54 -37
  34. package/dist/agent0/capabilities/skills/adk/references/files.md +301 -306
  35. package/dist/agent0/capabilities/skills/adk/references/integration-actions.md +211 -214
  36. package/dist/agent0/capabilities/skills/adk/references/integrations.md +33 -31
  37. package/dist/agent0/capabilities/skills/adk/references/interfaces.md +13 -12
  38. package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +98 -111
  39. package/dist/agent0/capabilities/skills/adk/references/mcp-server.md +6 -0
  40. package/dist/agent0/capabilities/skills/adk/references/messages.md +280 -256
  41. package/dist/agent0/capabilities/skills/adk/references/model-configuration.md +52 -49
  42. package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +102 -101
  43. package/dist/agent0/capabilities/skills/adk/references/plugins.md +15 -15
  44. package/dist/agent0/capabilities/skills/adk/references/tables.md +204 -210
  45. package/dist/agent0/capabilities/skills/adk/references/tags.md +141 -143
  46. package/dist/agent0/capabilities/skills/adk/references/tools.md +191 -199
  47. package/dist/agent0/capabilities/skills/adk/references/triggers.md +331 -336
  48. package/dist/agent0/capabilities/skills/adk/references/workflow-steps.md +132 -96
  49. package/dist/agent0/capabilities/skills/adk/references/workflows.md +479 -464
  50. package/dist/agent0/capabilities/skills/adk/references/zai-agent-reference.md +127 -129
  51. package/dist/agent0/capabilities/skills/adk/references/zai-complete-guide.md +255 -276
  52. package/dist/agent0/capabilities/skills/adk-debugger/SKILL.md +21 -17
  53. package/dist/agent0/capabilities/skills/adk-debugger/references/common-failures.md +25 -25
  54. package/dist/agent0/capabilities/skills/adk-debugger/references/conversation-analysis.md +49 -41
  55. package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +20 -14
  56. package/dist/agent0/capabilities/skills/adk-debugger/references/llm-debugging.md +13 -13
  57. package/dist/agent0/capabilities/skills/adk-debugger/references/trace-summarization.md +18 -18
  58. package/dist/agent0/capabilities/skills/adk-debugger/references/traces-and-logs.md +67 -67
  59. package/dist/agent0/capabilities/skills/adk-dev-console/SKILL.md +36 -36
  60. package/dist/agent0/capabilities/skills/adk-dev-console/references/agent-steps.md +14 -6
  61. package/dist/agent0/capabilities/skills/adk-dev-console/references/multi-agent-dashboard.md +13 -13
  62. package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +18 -0
  63. package/dist/agent0/capabilities/skills/adk-docs/SKILL.md +13 -13
  64. package/dist/agent0/capabilities/skills/adk-docs/references/doc-standards.md +15 -0
  65. package/dist/agent0/capabilities/skills/adk-evals/SKILL.md +29 -23
  66. package/dist/agent0/capabilities/skills/adk-evals/references/eval-format.md +31 -23
  67. package/dist/agent0/capabilities/skills/adk-evals/references/test-patterns.md +25 -36
  68. package/dist/agent0/capabilities/skills/adk-evals/references/testing-workflow.md +6 -4
  69. package/dist/agent0/index.js +41 -19
  70. package/dist/agent0/index.js.map +7 -7
  71. package/dist/agent0/runtime/client.d.ts +2 -0
  72. package/dist/agent0/runtime/client.d.ts.map +1 -1
  73. package/dist/agent0/runtime/engine.d.ts +2 -1
  74. package/dist/agent0/runtime/engine.d.ts.map +1 -1
  75. package/dist/agent0/runtime/process.d.ts +1 -0
  76. package/dist/agent0/runtime/process.d.ts.map +1 -1
  77. package/dist/assets/manager.d.ts +3 -0
  78. package/dist/assets/manager.d.ts.map +1 -1
  79. package/dist/auth/credentials.d.ts +1 -1
  80. package/dist/bot-generator/generator.d.ts +22 -0
  81. package/dist/bot-generator/generator.d.ts.map +1 -1
  82. package/dist/bot-generator/plugin-sync.d.ts.map +1 -1
  83. package/dist/commands/base-command.d.ts +1 -0
  84. package/dist/commands/base-command.d.ts.map +1 -1
  85. package/dist/commands/bp-dev-command.d.ts +1 -1
  86. package/dist/commands/bp-dev-command.d.ts.map +1 -1
  87. package/dist/commands/bp-dev-stderr.d.ts +9 -0
  88. package/dist/commands/bp-dev-stderr.d.ts.map +1 -1
  89. package/dist/commands/index.d.ts +1 -0
  90. package/dist/commands/index.d.ts.map +1 -1
  91. package/dist/dependencies/catalog/catalog-service.d.ts +53 -0
  92. package/dist/dependencies/catalog/catalog-service.d.ts.map +1 -0
  93. package/dist/dependencies/catalog/client-factory.d.ts +33 -0
  94. package/dist/dependencies/catalog/client-factory.d.ts.map +1 -0
  95. package/dist/dependencies/catalog/integration-source.d.ts +34 -0
  96. package/dist/dependencies/catalog/integration-source.d.ts.map +1 -0
  97. package/dist/dependencies/catalog/interface-source.d.ts +23 -0
  98. package/dist/dependencies/catalog/interface-source.d.ts.map +1 -0
  99. package/dist/dependencies/catalog/plugin-source.d.ts +49 -0
  100. package/dist/dependencies/catalog/plugin-source.d.ts.map +1 -0
  101. package/dist/dependencies/catalog/resolution-cache.d.ts +76 -0
  102. package/dist/dependencies/catalog/resolution-cache.d.ts.map +1 -0
  103. package/dist/dependencies/dependency-manager.d.ts +31 -16
  104. package/dist/dependencies/dependency-manager.d.ts.map +1 -1
  105. package/dist/dependencies/errors.d.ts +2 -2
  106. package/dist/dependencies/errors.d.ts.map +1 -1
  107. package/dist/dependencies/index.d.ts +5 -4
  108. package/dist/dependencies/index.d.ts.map +1 -1
  109. package/dist/dependencies/index.js +2089 -1670
  110. package/dist/dependencies/index.js.map +37 -30
  111. package/dist/dependencies/legacy-lock-file.d.ts +15 -0
  112. package/dist/dependencies/legacy-lock-file.d.ts.map +1 -0
  113. package/dist/dependencies/migration.d.ts +19 -0
  114. package/dist/dependencies/migration.d.ts.map +1 -1
  115. package/dist/dependencies/resolvers/integration-resolver.d.ts +4 -3
  116. package/dist/dependencies/resolvers/integration-resolver.d.ts.map +1 -1
  117. package/dist/dependencies/resolvers/plugin-resolver.d.ts +4 -4
  118. package/dist/dependencies/resolvers/plugin-resolver.d.ts.map +1 -1
  119. package/dist/dependencies/snapshot-store.d.ts +59 -0
  120. package/dist/dependencies/snapshot-store.d.ts.map +1 -0
  121. package/dist/dependencies/status-resolver.d.ts +36 -0
  122. package/dist/dependencies/status-resolver.d.ts.map +1 -0
  123. package/dist/dependencies/status.d.ts +214 -0
  124. package/dist/dependencies/status.d.ts.map +1 -0
  125. package/dist/dependencies/types.d.ts +380 -29
  126. package/dist/dependencies/types.d.ts.map +1 -1
  127. package/dist/file-watcher/watcher.d.ts +21 -5
  128. package/dist/file-watcher/watcher.d.ts.map +1 -1
  129. package/dist/generators/action-types.d.ts.map +1 -1
  130. package/dist/generators/client-wrapper.d.ts.map +1 -1
  131. package/dist/index.d.ts +4 -5
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +3134 -2226
  134. package/dist/index.js.map +55 -48
  135. package/dist/integrations/config-utils.d.ts +11 -7
  136. package/dist/integrations/config-utils.d.ts.map +1 -1
  137. package/dist/integrations/hub-cache.d.ts +0 -58
  138. package/dist/integrations/hub-cache.d.ts.map +1 -1
  139. package/dist/integrations/index.d.ts +1 -3
  140. package/dist/integrations/index.d.ts.map +1 -1
  141. package/dist/integrations/manager.d.ts +19 -53
  142. package/dist/integrations/manager.d.ts.map +1 -1
  143. package/dist/interfaces/enhanced-cache.d.ts +7 -7
  144. package/dist/interfaces/enhanced-cache.d.ts.map +1 -1
  145. package/dist/interfaces/manager.d.ts +11 -17
  146. package/dist/interfaces/manager.d.ts.map +1 -1
  147. package/dist/knowledge/manager.d.ts +3 -0
  148. package/dist/knowledge/manager.d.ts.map +1 -1
  149. package/dist/plugins/index.d.ts +0 -1
  150. package/dist/plugins/index.d.ts.map +1 -1
  151. package/dist/plugins/manager.d.ts +16 -48
  152. package/dist/plugins/manager.d.ts.map +1 -1
  153. package/dist/preflight/checker.d.ts +6 -1
  154. package/dist/preflight/checker.d.ts.map +1 -1
  155. package/dist/preflight/dependency-gate.d.ts +37 -0
  156. package/dist/preflight/dependency-gate.d.ts.map +1 -0
  157. package/dist/preflight/index.d.ts +2 -1
  158. package/dist/preflight/index.d.ts.map +1 -1
  159. package/dist/preflight/types.d.ts +18 -0
  160. package/dist/preflight/types.d.ts.map +1 -1
  161. package/dist/runner/script-runner.d.ts.map +1 -1
  162. package/dist/tables/table-manager.d.ts +3 -0
  163. package/dist/tables/table-manager.d.ts.map +1 -1
  164. package/dist/templates/README.md +23 -13
  165. package/dist/templates/blank/agent.config.ts +3 -3
  166. package/dist/templates/blank/src/triggers/index.ts +1 -1
  167. package/dist/templates/botpress-desk/evals/index.eval.ts +1 -1
  168. package/dist/templates/botpress-desk/src/triggers/index.ts +1 -1
  169. package/dist/templates/crm-enrichment/README.md +3 -3
  170. package/dist/templates/crm-enrichment/agent.config.ts +2 -2
  171. package/dist/templates/crm-enrichment/src/conversations/index.ts +1 -1
  172. package/dist/templates/hello-world/agent.config.ts +3 -3
  173. package/dist/templates/hello-world/src/triggers/index.ts +1 -1
  174. package/dist/templates/knowledge-assistant/src/triggers/index.ts +1 -1
  175. package/dist/templates/template.config.json +3 -3
  176. package/dist/utils/ids.d.ts +10 -0
  177. package/dist/utils/ids.d.ts.map +1 -1
  178. package/dist/workspace/workspace-cache.d.ts +2 -1
  179. package/dist/workspace/workspace-cache.d.ts.map +1 -1
  180. package/package.json +3 -3
  181. package/dist/agent-project/lock-to-dependencies.d.ts +0 -11
  182. package/dist/agent-project/lock-to-dependencies.d.ts.map +0 -1
  183. package/dist/dependencies/lock-file.d.ts +0 -15
  184. package/dist/dependencies/lock-file.d.ts.map +0 -1
  185. package/dist/integrations/enhanced-cache.d.ts +0 -53
  186. package/dist/integrations/enhanced-cache.d.ts.map +0 -1
  187. package/dist/plugins/enhanced-cache.d.ts +0 -53
  188. package/dist/plugins/enhanced-cache.d.ts.map +0 -1
  189. package/dist/templates/blank/package.json +0 -17
  190. package/dist/templates/blank/tsconfig.json +0 -25
  191. package/dist/templates/botpress-desk/package.json +0 -17
  192. package/dist/templates/crm-enrichment/package.json +0 -18
  193. package/dist/templates/crm-enrichment/tsconfig.json +0 -25
  194. package/dist/templates/hello-world/package.json +0 -18
  195. package/dist/templates/hello-world/tsconfig.json +0 -25
  196. package/dist/templates/knowledge-assistant/package.json +0 -18
  197. package/dist/templates/knowledge-assistant/tsconfig.json +0 -25
  198. package/dist/templates/slack-triage/package.json +0 -18
  199. package/dist/templates/slack-triage/tsconfig.json +0 -25
@@ -9,27 +9,27 @@ The main configuration file defines your bot's core settings, AI models, depende
9
9
  ### Configuration Example
10
10
 
11
11
  ```typescript
12
- import { defineConfig, z } from "@botpress/runtime";
12
+ import { defineConfig, z } from '@botpress/runtime'
13
13
 
14
14
  export default defineConfig({
15
- name: "customer-support-bot",
16
- description: "Customer support assistant with knowledge base",
15
+ name: 'customer-support-bot',
16
+ description: 'Customer support assistant with knowledge base',
17
17
 
18
18
  // AI Model Configuration
19
19
  defaultModels: {
20
- autonomous: "openai:gpt-4o", // For execute() function
21
- zai: "openai:gpt-4o-mini", // For zai operations
20
+ autonomous: 'openai:gpt-4o', // For execute() function
21
+ zai: 'openai:gpt-4o-mini', // For zai operations
22
22
  },
23
23
 
24
24
  // User State Schema
25
25
  user: {
26
26
  state: z.object({
27
- preferredLanguage: z.enum(["en", "es", "fr", "de"]).default("en"),
28
- timezone: z.string().default("UTC"),
27
+ preferredLanguage: z.enum(['en', 'es', 'fr', 'de']).default('en'),
28
+ timezone: z.string().default('UTC'),
29
29
  name: z.string().optional(),
30
30
  email: z.string().email().optional(),
31
31
  notificationsEnabled: z.boolean().default(true),
32
- accountTier: z.enum(["free", "pro", "enterprise"]).default("free"),
32
+ accountTier: z.enum(['free', 'pro', 'enterprise']).default('free'),
33
33
  metadata: z.object({}).passthrough().default({}),
34
34
  }),
35
35
  },
@@ -41,10 +41,12 @@ export default defineConfig({
41
41
  maintenanceMode: z.boolean().default(false),
42
42
 
43
43
  // Feature flags
44
- features: z.object({
45
- advancedSearch: z.boolean().default(false),
46
- multiLanguage: z.boolean().default(true),
47
- }).default({}),
44
+ features: z
45
+ .object({
46
+ advancedSearch: z.boolean().default(false),
47
+ multiLanguage: z.boolean().default(true),
48
+ })
49
+ .default({}),
48
50
 
49
51
  // Analytics
50
52
  totalConversations: z.number().default(0),
@@ -54,7 +56,7 @@ export default defineConfig({
54
56
 
55
57
  // Integrations are managed via lock files (dependencies.dev.lock.json / dependencies.prod.lock.json)
56
58
  // Use `adk integrations add/remove/configure` to manage them — see integrations.md
57
- });
59
+ })
58
60
  ```
59
61
 
60
62
  ### Additional Configuration Fields
@@ -69,7 +71,7 @@ Define a custom configuration schema for bot-level settings accessible via the C
69
71
 
70
72
  ```typescript
71
73
  export default defineConfig({
72
- name: "my-bot",
74
+ name: 'my-bot',
73
75
 
74
76
  configuration: {
75
77
  schema: z.object({
@@ -80,13 +82,13 @@ export default defineConfig({
80
82
  }),
81
83
  }),
82
84
  },
83
- });
85
+ })
84
86
  ```
85
87
 
86
88
  Access via direct import from `@botpress/runtime`:
87
89
 
88
90
  ```typescript
89
- import { configuration } from "@botpress/runtime";
91
+ import { configuration } from '@botpress/runtime'
90
92
 
91
93
  if (configuration.featureFlags.enableBetaFeatures) {
92
94
  // Use beta features
@@ -100,6 +102,7 @@ See **[Context API](./context-api.md)** for details on accessing other runtime v
100
102
  **Default Models:**
101
103
 
102
104
  If you don't specify `defaultModels`, the ADK uses these defaults:
105
+
103
106
  - `zai`: `"openai:gpt-4.1-2025-04-14"`
104
107
  - `autonomous`: `"openai:gpt-4.1-mini-2025-04-14"`
105
108
 
@@ -107,20 +110,20 @@ If you don't specify `defaultModels`, the ADK uses these defaults:
107
110
 
108
111
  ```typescript
109
112
  // OpenAI
110
- "openai:gpt-4o"
111
- "openai:gpt-4o-mini"
112
- "openai:gpt-4-turbo"
113
- "openai:gpt-4.1-2025-04-14"
114
- "openai:gpt-4.1-mini-2025-04-14"
113
+ 'openai:gpt-4o'
114
+ 'openai:gpt-4o-mini'
115
+ 'openai:gpt-4-turbo'
116
+ 'openai:gpt-4.1-2025-04-14'
117
+ 'openai:gpt-4.1-mini-2025-04-14'
115
118
 
116
119
  // Anthropic
117
- "anthropic:claude-3-5-sonnet"
118
- "anthropic:claude-3-opus"
119
- "anthropic:claude-3-haiku"
120
+ 'anthropic:claude-3-5-sonnet'
121
+ 'anthropic:claude-3-opus'
122
+ 'anthropic:claude-3-haiku'
120
123
 
121
124
  // Google
122
- "google:gemini-1.5-pro"
123
- "google:gemini-1.5-flash"
125
+ 'google:gemini-1.5-pro'
126
+ 'google:gemini-1.5-flash'
124
127
  ```
125
128
 
126
129
  **Model Fallback Arrays:**
@@ -141,25 +144,25 @@ defaultModels: {
141
144
  ### Accessing Configuration
142
145
 
143
146
  ```typescript
144
- import { bot, user } from "@botpress/runtime";
147
+ import { bot, user } from '@botpress/runtime'
145
148
 
146
149
  // In any handler (action, workflow, conversation)
147
150
 
148
151
  // Access bot state
149
- const version = bot.state.version;
150
- const maintenanceMode = bot.state.maintenanceMode;
152
+ const version = bot.state.version
153
+ const maintenanceMode = bot.state.maintenanceMode
151
154
 
152
155
  // Modify bot state
153
- bot.state.totalConversations += 1;
154
- bot.state.features.advancedSearch = true;
156
+ bot.state.totalConversations += 1
157
+ bot.state.features.advancedSearch = true
155
158
 
156
159
  // Access user state
157
- const language = user.state.preferredLanguage;
158
- const tier = user.state.accountTier;
160
+ const language = user.state.preferredLanguage
161
+ const tier = user.state.accountTier
159
162
 
160
163
  // Modify user state
161
- user.state.lastActiveDate = new Date();
162
- user.state.metadata.lastQuery = "product pricing";
164
+ user.state.lastActiveDate = new Date()
165
+ user.state.metadata.lastQuery = 'product pricing'
163
166
  ```
164
167
 
165
168
  ## Dependencies (Integrations, Plugins, Interfaces)
@@ -225,28 +228,28 @@ WEBHOOK_URL=https://api.example.com/webhooks
225
228
  ```typescript
226
229
  // In configuration
227
230
  export default defineConfig({
228
- name: process.env.BOT_NAME || "my-bot",
231
+ name: process.env.BOT_NAME || 'my-bot',
229
232
 
230
233
  defaultModels: {
231
- autonomous: process.env.AI_MODEL || "openai:gpt-4o",
234
+ autonomous: process.env.AI_MODEL || 'openai:gpt-4o',
232
235
  },
233
- });
236
+ })
234
237
 
235
238
  // In handlers
236
239
  export const myAction = new Action({
237
240
  async handler({ input }) {
238
- const apiKey = process.env.EXTERNAL_API_KEY;
241
+ const apiKey = process.env.EXTERNAL_API_KEY
239
242
 
240
243
  if (!apiKey) {
241
- throw new Error("EXTERNAL_API_KEY not configured");
244
+ throw new Error('EXTERNAL_API_KEY not configured')
242
245
  }
243
246
 
244
247
  // Use the API key
245
- const response = await fetch("https://api.example.com", {
248
+ const response = await fetch('https://api.example.com', {
246
249
  headers: { Authorization: `Bearer ${apiKey}` },
247
- });
250
+ })
248
251
  },
249
- });
252
+ })
250
253
  ```
251
254
 
252
255
  ## State Management Patterns
@@ -258,25 +261,25 @@ export const myAction = new Action({
258
261
  export const Chat = new Conversation({
259
262
  async handler({ message, conversation, execute }) {
260
263
  // Collect user info progressively
261
- if (!user.state.name && message?.type === "text") {
262
- user.state.name = extractName(message.payload.text);
264
+ if (!user.state.name && message?.type === 'text') {
265
+ user.state.name = extractName(message.payload.text)
263
266
  }
264
267
 
265
268
  if (!user.state.email) {
266
269
  // Ask for email if needed
267
270
  await conversation.send({
268
- type: "text",
271
+ type: 'text',
269
272
  payload: { text: "What's your email address?" },
270
- });
273
+ })
271
274
  }
272
275
 
273
276
  // Use preferences
274
- const language = user.state.preferredLanguage;
277
+ const language = user.state.preferredLanguage
275
278
  await execute({
276
279
  instructions: `Respond in ${language}`,
277
- });
280
+ })
278
281
  },
279
- });
282
+ })
280
283
  ```
281
284
 
282
285
  ### Bot State Patterns
@@ -287,31 +290,31 @@ export const Chat = new Conversation({
287
290
  // Feature flag checking
288
291
  if (bot.state.features.advancedSearch) {
289
292
  // Use advanced search
290
- const results = await advancedSearch(query);
293
+ const results = await advancedSearch(query)
291
294
  } else {
292
295
  // Use basic search
293
- const results = await basicSearch(query);
296
+ const results = await basicSearch(query)
294
297
  }
295
298
 
296
299
  // Maintenance mode
297
300
  if (bot.state.maintenanceMode) {
298
301
  await conversation.send({
299
- type: "text",
302
+ type: 'text',
300
303
  payload: {
301
- text: "The bot is currently under maintenance. Please try again later.",
304
+ text: 'The bot is currently under maintenance. Please try again later.',
302
305
  },
303
- });
304
- return;
306
+ })
307
+ return
305
308
  }
306
309
 
307
310
  // Business hours check (example)
308
- const supportHours = "9:00 AM to 5:00 PM EST";
311
+ const supportHours = '9:00 AM to 5:00 PM EST'
309
312
  await conversation.send({
310
- type: "text",
313
+ type: 'text',
311
314
  payload: { text: `Our support hours are ${supportHours}` },
312
- });
315
+ })
313
316
  },
314
- });
317
+ })
315
318
  ```
316
319
 
317
320
  ## Best Practices
@@ -321,12 +324,12 @@ export const Chat = new Conversation({
321
324
  ```typescript
322
325
  // ❌ Bad - hardcoded secrets
323
326
  config: {
324
- apiKey: "sk-abc123def456";
327
+ apiKey: 'sk-abc123def456'
325
328
  }
326
329
 
327
330
  // ✅ Good - environment variable
328
331
  config: {
329
- apiKey: process.env.OPENAI_API_KEY;
332
+ apiKey: process.env.OPENAI_API_KEY
330
333
  }
331
334
  ```
332
335
 
@@ -343,7 +346,7 @@ export default defineConfig({
343
346
  age: z.number().int().min(0).max(150),
344
347
  }),
345
348
  },
346
- });
349
+ })
347
350
  ```
348
351
 
349
352
  ### 3. Provide Defaults
@@ -352,10 +355,10 @@ export default defineConfig({
352
355
  user: {
353
356
  state: z.object({
354
357
  // Always provide sensible defaults
355
- language: z.string().default("en"),
358
+ language: z.string().default('en'),
356
359
  notifications: z.boolean().default(true),
357
- theme: z.enum(["light", "dark"]).default("light"),
358
- });
360
+ theme: z.enum(['light', 'dark']).default('light'),
361
+ })
359
362
  }
360
363
  ```
361
364
 
@@ -375,7 +378,7 @@ bot: {
375
378
  * @example { "newUI": true, "betaFeatures": false }
376
379
  */
377
380
  features: z.record(z.boolean()).default({}),
378
- });
381
+ })
379
382
  }
380
383
  ```
381
384
 
@@ -385,22 +388,22 @@ bot: {
385
388
  // Separate configuration by domain
386
389
  const userConfig = {
387
390
  state: userStateSchema,
388
- };
391
+ }
389
392
 
390
393
  const botConfig = {
391
394
  state: botStateSchema,
392
- };
395
+ }
393
396
 
394
397
  const integrationConfig = {
395
398
  slack: slackConfig,
396
399
  discord: discordConfig,
397
- };
400
+ }
398
401
 
399
402
  export default defineConfig({
400
403
  ...baseConfig,
401
404
  user: userConfig,
402
405
  bot: botConfig,
403
- });
406
+ })
404
407
  ```
405
408
 
406
409
  ## Project Files
@@ -22,15 +22,15 @@ Assets are static files (images, documents, media) that ship with your agent. Pl
22
22
 
23
23
  Images, documents, media, and more — MIME type is auto-detected from the extension:
24
24
 
25
- | Category | Extensions |
26
- | ---------- | ---------------------------------------------- |
27
- | Images | `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.webp` |
28
- | Documents | `.pdf`, `.txt`, `.md`, `.html` |
29
- | Styles | `.css` |
30
- | Data | `.js`, `.json`, `.xml` |
31
- | Video | `.mp4`, `.webm` |
32
- | Audio | `.mp3`, `.wav`, `.ogg` |
33
- | Archives | `.zip` |
25
+ | Category | Extensions |
26
+ | --------- | ------------------------------------------------ |
27
+ | Images | `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.webp` |
28
+ | Documents | `.pdf`, `.txt`, `.md`, `.html` |
29
+ | Styles | `.css` |
30
+ | Data | `.js`, `.json`, `.xml` |
31
+ | Video | `.mp4`, `.webm` |
32
+ | Audio | `.mp3`, `.wav`, `.ogg` |
33
+ | Archives | `.zip` |
34
34
 
35
35
  Unrecognized extensions default to `application/octet-stream`.
36
36
 
@@ -61,28 +61,28 @@ The global `assets` object is available in any action, tool, workflow, or conver
61
61
  `assets.get()` is async and throws an `Error` if the path does not match any known asset.
62
62
 
63
63
  ```typescript
64
- const logo = await assets.get("logo.png");
65
- console.log(logo.url); // CDN URL
66
- console.log(logo.mime); // "image/png"
67
- console.log(logo.size); // bytes
64
+ const logo = await assets.get('logo.png')
65
+ console.log(logo.url) // CDN URL
66
+ console.log(logo.mime) // "image/png"
67
+ console.log(logo.size) // bytes
68
68
  ```
69
69
 
70
70
  ### List All Assets
71
71
 
72
72
  ```typescript
73
- const all = assets.list();
73
+ const all = assets.list()
74
74
  for (const asset of all) {
75
- console.log(`${asset.path}: ${asset.url}`);
75
+ console.log(`${asset.path}: ${asset.url}`)
76
76
  }
77
77
  ```
78
78
 
79
79
  ### Check Sync Status
80
80
 
81
81
  ```typescript
82
- const status = assets.getSyncStatus();
82
+ const status = assets.getSyncStatus()
83
83
  if (!status.synced) {
84
- console.warn("Unsynced assets:", status.neverSynced);
85
- console.warn("Stale assets:", status.stale);
84
+ console.warn('Unsynced assets:', status.neverSynced)
85
+ console.warn('Stale assets:', status.stale)
86
86
  }
87
87
  ```
88
88
 
@@ -141,11 +141,11 @@ Assets are also synced automatically during `adk deploy`.
141
141
 
142
142
  ### Sync States
143
143
 
144
- | State | Meaning |
145
- | -------------- | --------------------------------------------- |
146
- | **Up to date** | Local and remote hashes match |
147
- | **Stale** | Local file changed since last sync |
148
- | **Never synced** | File exists locally but was never uploaded |
144
+ | State | Meaning |
145
+ | ---------------- | ------------------------------------------ |
146
+ | **Up to date** | Local and remote hashes match |
147
+ | **Stale** | Local file changed since last sync |
148
+ | **Never synced** | File exists locally but was never uploaded |
149
149
 
150
150
  The runtime emits a console warning the first time you access a stale or never-synced asset.
151
151
 
@@ -154,58 +154,55 @@ The runtime emits a console warning the first time you access a stale or never-s
154
154
  ### Send an Image in a Conversation
155
155
 
156
156
  ```typescript
157
- import { Conversation } from "@botpress/runtime";
157
+ import { Conversation } from '@botpress/runtime'
158
158
 
159
159
  export default new Conversation({
160
- channel: "webchat",
160
+ channel: 'webchat',
161
161
  async handler({ conversation }) {
162
- const logo = await assets.get("logo.png");
162
+ const logo = await assets.get('logo.png')
163
163
  await conversation.send({
164
- type: "image",
164
+ type: 'image',
165
165
  payload: { imageUrl: logo.url },
166
- });
166
+ })
167
167
  },
168
- });
168
+ })
169
169
  ```
170
170
 
171
171
  ### Use an Asset URL in a Tool Response
172
172
 
173
173
  ```typescript
174
- import { Autonomous } from "@botpress/runtime";
174
+ import { Autonomous } from '@botpress/runtime'
175
175
 
176
176
  export const getBranding = new Autonomous.Tool({
177
- description: "Returns branding assets",
177
+ description: 'Returns branding assets',
178
178
  handler: async () => {
179
- const logo = await assets.get("logo.png");
180
- const header = await assets.get("images/header.webp");
179
+ const logo = await assets.get('logo.png')
180
+ const header = await assets.get('images/header.webp')
181
181
  return {
182
182
  logoUrl: logo.url,
183
183
  headerUrl: header.url,
184
- };
184
+ }
185
185
  },
186
- });
186
+ })
187
187
  ```
188
188
 
189
189
  ### Check Asset Health in an Action
190
190
 
191
191
  ```typescript
192
- import { Action, z } from "@botpress/runtime";
192
+ import { Action, z } from '@botpress/runtime'
193
193
 
194
194
  export const checkAssets = new Action({
195
- name: "checkAssets",
195
+ name: 'checkAssets',
196
196
  input: {},
197
197
  output: { synced: z.boolean(), issues: z.array(z.string()) },
198
198
  async handler() {
199
- const status = assets.getSyncStatus();
199
+ const status = assets.getSyncStatus()
200
200
  return {
201
201
  synced: status.synced,
202
- issues: [
203
- ...status.neverSynced.map((p) => `Never synced: ${p}`),
204
- ...status.stale.map((p) => `Stale: ${p}`),
205
- ],
206
- };
202
+ issues: [...status.neverSynced.map((p) => `Never synced: ${p}`), ...status.stale.map((p) => `Stale: ${p}`)],
203
+ }
207
204
  },
208
- });
205
+ })
209
206
  ```
210
207
 
211
208
  ## Common Mistakes
@@ -228,10 +225,10 @@ Assets with placeholder URLs will not be accessible at runtime. Always run `adk
228
225
 
229
226
  ```typescript
230
227
  // ❌ Wrong
231
- await assets.get("/assets/logo.png");
232
- await assets.get("assets/logo.png");
228
+ await assets.get('/assets/logo.png')
229
+ await assets.get('assets/logo.png')
233
230
 
234
231
  // ✅ Correct — use the path relative to assets/
235
- await assets.get("logo.png");
236
- await assets.get("images/header.webp");
232
+ await assets.get('logo.png')
233
+ await assets.get('images/header.webp')
237
234
  ```