@botpress/adk 1.19.0-beta.9 → 2.0.0-alpha.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 (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
@@ -5,13 +5,13 @@ Call actions from installed integrations using a simple, type-safe API.
5
5
  ## Quick Start
6
6
 
7
7
  ```typescript
8
- import { actions } from "@botpress/runtime";
8
+ import { actions } from '@botpress/runtime'
9
9
 
10
10
  // Call integration action
11
11
  const { items } = await actions.linear.issueList({
12
12
  first: 10,
13
- filter: { state: { name: { eq: "In Progress" } } }
14
- });
13
+ filter: { state: { name: { eq: 'In Progress' } } },
14
+ })
15
15
  ```
16
16
 
17
17
  ## Overview
@@ -19,11 +19,13 @@ const { items } = await actions.linear.issueList({
19
19
  Integration actions allow you to call functionality from installed integrations (Slack, Linear, GitHub, etc.) using a unified, type-safe API. Each integration exposes actions that map to its capabilities.
20
20
 
21
21
  **Pattern:**
22
+
22
23
  ```typescript
23
24
  await actions.{integration}.{actionName}(params);
24
25
  ```
25
26
 
26
27
  **Available in:**
28
+
27
29
  - Actions
28
30
  - Tools
29
31
  - Workflows
@@ -52,7 +54,7 @@ Then configure the integration in the Dev Console at `localhost:3001` or via `ad
52
54
  ### Importing Actions
53
55
 
54
56
  ```typescript
55
- import { actions } from "@botpress/runtime";
57
+ import { actions } from '@botpress/runtime'
56
58
  ```
57
59
 
58
60
  ### Calling Actions
@@ -60,23 +62,23 @@ import { actions } from "@botpress/runtime";
60
62
  ```typescript
61
63
  // Slack - Send message
62
64
  await actions.slack.sendMessage({
63
- channel: "#general",
64
- text: "Hello from bot!"
65
- });
65
+ channel: '#general',
66
+ text: 'Hello from bot!',
67
+ })
66
68
 
67
69
  // Linear - List issues
68
70
  const { items } = await actions.linear.issueList({
69
71
  first: 10,
70
- filter: { state: { name: { eq: "In Progress" } } }
71
- });
72
+ filter: { state: { name: { eq: 'In Progress' } } },
73
+ })
72
74
 
73
75
  // GitHub - Create issue
74
76
  await actions.github.createIssue({
75
- owner: "myorg",
76
- repo: "myrepo",
77
- title: "Bug report",
78
- body: "Issue description"
79
- });
77
+ owner: 'myorg',
78
+ repo: 'myrepo',
79
+ title: 'Bug report',
80
+ body: 'Issue description',
81
+ })
80
82
  ```
81
83
 
82
84
  ### Alternative: Bracket Notation
@@ -85,15 +87,15 @@ Use bracket notation when integration names contain special characters or when a
85
87
 
86
88
  ```typescript
87
89
  // Useful for dynamic integration names
88
- const integrationName = "intercom";
90
+ const integrationName = 'intercom'
89
91
  await actions[integrationName].getConversation({
90
- intercomConversationId: "conv_123"
91
- });
92
+ intercomConversationId: 'conv_123',
93
+ })
92
94
 
93
95
  // Or when the integration name has special characters
94
- await actions["my-integration"].someAction({
95
- param: "value"
96
- });
96
+ await actions['my-integration'].someAction({
97
+ param: 'value',
98
+ })
97
99
  ```
98
100
 
99
101
  ### Type Safety
@@ -101,10 +103,10 @@ await actions["my-integration"].someAction({
101
103
  All integration actions are fully typed with TypeScript:
102
104
 
103
105
  ```typescript
104
- type LinearIssue = Awaited<ReturnType<typeof actions.linear.getIssue>>;
106
+ type LinearIssue = Awaited<ReturnType<typeof actions.linear.getIssue>>
105
107
 
106
108
  // TypeScript knows the exact shape of the result
107
- const issue = await actions.linear.getIssue({ id: "ISS-123" });
109
+ const issue = await actions.linear.getIssue({ id: 'ISS-123' })
108
110
  // issue.title, issue.description, issue.state, etc. are all typed
109
111
  ```
110
112
 
@@ -114,18 +116,19 @@ Integration actions can be converted to AI-callable tools using `.asTool()`:
114
116
 
115
117
  ```typescript
116
118
  await execute({
117
- instructions: "Help the user browse the web",
119
+ instructions: 'Help the user browse the web',
118
120
  tools: [
119
121
  // Convert integration action to tool
120
122
  actions.browser.captureScreenshot.asTool(),
121
123
 
122
124
  // Mix with custom tools
123
125
  customSearchTool,
124
- ]
125
- });
126
+ ],
127
+ })
126
128
  ```
127
129
 
128
130
  **How it works:**
131
+
129
132
  - The action's input/output schemas become the tool's parameters
130
133
  - The action's description (if any) helps the AI understand when to use it
131
134
  - The AI can call the tool during autonomous execution
@@ -137,30 +140,30 @@ await execute({
137
140
  ```typescript
138
141
  // Send message
139
142
  await actions.slack.sendMessage({
140
- channel: "#general",
141
- text: "Hello!",
143
+ channel: '#general',
144
+ text: 'Hello!',
142
145
  blocks: [
143
146
  {
144
- type: "section",
145
- text: { type: "mrkdwn", text: "*Hello* from bot!" }
146
- }
147
- ]
148
- });
147
+ type: 'section',
148
+ text: { type: 'mrkdwn', text: '*Hello* from bot!' },
149
+ },
150
+ ],
151
+ })
149
152
 
150
153
  // Add reaction
151
154
  await actions.slack.addReaction({
152
- channel: "C123456",
153
- timestamp: "1234567890.123456",
154
- name: "thumbsup"
155
- });
155
+ channel: 'C123456',
156
+ timestamp: '1234567890.123456',
157
+ name: 'thumbsup',
158
+ })
156
159
 
157
160
  // Upload file
158
161
  await actions.slack.uploadFile({
159
- channels: ["#general"],
162
+ channels: ['#general'],
160
163
  file: fileBuffer,
161
- filename: "report.pdf",
162
- title: "Monthly Report"
163
- });
164
+ filename: 'report.pdf',
165
+ title: 'Monthly Report',
166
+ })
164
167
  ```
165
168
 
166
169
  ### Linear Integration
@@ -170,31 +173,31 @@ await actions.slack.uploadFile({
170
173
  const { items, meta } = await actions.linear.issueList({
171
174
  first: 50,
172
175
  filter: {
173
- state: { name: { eq: "In Progress" } },
174
- assignee: { email: { eq: "user@example.com" } }
176
+ state: { name: { eq: 'In Progress' } },
177
+ assignee: { email: { eq: 'user@example.com' } },
175
178
  },
176
- orderBy: { createdAt: "desc" }
177
- });
179
+ orderBy: { createdAt: 'desc' },
180
+ })
178
181
 
179
182
  // Get specific issue
180
183
  const issue = await actions.linear.getIssue({
181
- id: "ISS-123"
182
- });
184
+ id: 'ISS-123',
185
+ })
183
186
 
184
187
  // Create issue
185
188
  await actions.linear.issueCreate({
186
- teamId: "team_123",
187
- title: "New feature request",
188
- description: "Detailed description",
189
+ teamId: 'team_123',
190
+ title: 'New feature request',
191
+ description: 'Detailed description',
189
192
  priority: 1,
190
- assigneeId: "user_456"
191
- });
193
+ assigneeId: 'user_456',
194
+ })
192
195
 
193
196
  // Update issue
194
197
  await actions.linear.issueUpdate({
195
- id: "ISS-123",
196
- stateId: "state_done"
197
- });
198
+ id: 'ISS-123',
199
+ stateId: 'state_done',
200
+ })
198
201
  ```
199
202
 
200
203
  ### Browser Integration
@@ -202,23 +205,23 @@ await actions.linear.issueUpdate({
202
205
  ```typescript
203
206
  // Browse pages (web scraping)
204
207
  const { results } = await actions.browser.browsePages({
205
- urls: ["https://docs.example.com"],
206
- extractType: "markdown",
207
- maxPages: 10
208
- });
208
+ urls: ['https://docs.example.com'],
209
+ extractType: 'markdown',
210
+ maxPages: 10,
211
+ })
209
212
 
210
213
  // Web search
211
214
  const output = await actions.browser.webSearch({
212
- query: "Botpress ADK documentation",
213
- maxResults: 5
214
- });
215
+ query: 'Botpress ADK documentation',
216
+ maxResults: 5,
217
+ })
215
218
 
216
219
  // Capture screenshot
217
220
  const screenshot = await actions.browser.captureScreenshot({
218
- url: "https://example.com",
221
+ url: 'https://example.com',
219
222
  fullPage: true,
220
- format: "png"
221
- });
223
+ format: 'png',
224
+ })
222
225
  ```
223
226
 
224
227
  ### GitHub Integration
@@ -226,28 +229,28 @@ const screenshot = await actions.browser.captureScreenshot({
226
229
  ```typescript
227
230
  // Create issue
228
231
  await actions.github.createIssue({
229
- owner: "myorg",
230
- repo: "myrepo",
231
- title: "Bug: Login not working",
232
- body: "Steps to reproduce:\n1. ...",
233
- labels: ["bug", "priority-high"]
234
- });
232
+ owner: 'myorg',
233
+ repo: 'myrepo',
234
+ title: 'Bug: Login not working',
235
+ body: 'Steps to reproduce:\n1. ...',
236
+ labels: ['bug', 'priority-high'],
237
+ })
235
238
 
236
239
  // Get repository
237
240
  const repo = await actions.github.getRepository({
238
- owner: "myorg",
239
- repo: "myrepo"
240
- });
241
+ owner: 'myorg',
242
+ repo: 'myrepo',
243
+ })
241
244
 
242
245
  // Create pull request
243
246
  await actions.github.createPullRequest({
244
- owner: "myorg",
245
- repo: "myrepo",
246
- title: "Fix login issue",
247
- head: "feature-branch",
248
- base: "main",
249
- body: "This PR fixes the login issue"
250
- });
247
+ owner: 'myorg',
248
+ repo: 'myrepo',
249
+ title: 'Fix login issue',
250
+ head: 'feature-branch',
251
+ base: 'main',
252
+ body: 'This PR fixes the login issue',
253
+ })
251
254
  ```
252
255
 
253
256
  ### Discord Integration
@@ -255,23 +258,23 @@ await actions.github.createPullRequest({
255
258
  ```typescript
256
259
  // Send message
257
260
  await actions.discord.sendMessage({
258
- channelId: "123456789",
259
- content: "Hello from bot!",
261
+ channelId: '123456789',
262
+ content: 'Hello from bot!',
260
263
  embeds: [
261
264
  {
262
- title: "Notification",
263
- description: "Your task is complete",
264
- color: 0x00ff00
265
- }
266
- ]
267
- });
265
+ title: 'Notification',
266
+ description: 'Your task is complete',
267
+ color: 0x00ff00,
268
+ },
269
+ ],
270
+ })
268
271
 
269
272
  // Add reaction
270
273
  await actions.discord.addReaction({
271
- channelId: "123456789",
272
- messageId: "987654321",
273
- emoji: "✅"
274
- });
274
+ channelId: '123456789',
275
+ messageId: '987654321',
276
+ emoji: '✅',
277
+ })
275
278
  ```
276
279
 
277
280
  ### WhatsApp Integration
@@ -279,25 +282,25 @@ await actions.discord.addReaction({
279
282
  ```typescript
280
283
  // Send text message
281
284
  await actions.whatsapp.sendMessage({
282
- to: "+1234567890",
283
- type: "text",
284
- text: { body: "Hello from bot!" }
285
- });
285
+ to: '+1234567890',
286
+ type: 'text',
287
+ text: { body: 'Hello from bot!' },
288
+ })
286
289
 
287
290
  // Send template message
288
291
  await actions.whatsapp.sendTemplate({
289
- to: "+1234567890",
292
+ to: '+1234567890',
290
293
  template: {
291
- name: "order_confirmation",
292
- language: { code: "en" },
294
+ name: 'order_confirmation',
295
+ language: { code: 'en' },
293
296
  components: [
294
297
  {
295
- type: "body",
296
- parameters: [{ type: "text", text: "12345" }]
297
- }
298
- ]
299
- }
300
- });
298
+ type: 'body',
299
+ parameters: [{ type: 'text', text: '12345' }],
300
+ },
301
+ ],
302
+ },
303
+ })
301
304
  ```
302
305
 
303
306
  ### Intercom Integration
@@ -305,26 +308,26 @@ await actions.whatsapp.sendTemplate({
305
308
  ```typescript
306
309
  // Send admin message with attachments
307
310
  await actions.intercom.sendAdminMessage({
308
- adminId: "admin_123",
309
- intercomConversationId: "conv_456",
310
- messageType: "comment",
311
- body: "Thank you for contacting us!",
312
- attachment_urls: ["https://example.com/image.png"]
313
- });
311
+ adminId: 'admin_123',
312
+ intercomConversationId: 'conv_456',
313
+ messageType: 'comment',
314
+ body: 'Thank you for contacting us!',
315
+ attachment_urls: ['https://example.com/image.png'],
316
+ })
314
317
 
315
318
  // Close/open conversation
316
319
  await actions.intercom.closeConversation({
317
- intercomConversationId: "conv_456",
318
- adminId: "admin_123"
319
- });
320
+ intercomConversationId: 'conv_456',
321
+ adminId: 'admin_123',
322
+ })
320
323
 
321
324
  // Manage tags
322
325
  await actions.intercom.updateConversationTags({
323
- intercomConversationId: "conv_456",
324
- adminId: "admin_123",
325
- tagsToAdd: ["priority"],
326
- tagsToRemove: ["pending"]
327
- });
326
+ intercomConversationId: 'conv_456',
327
+ adminId: 'admin_123',
328
+ tagsToAdd: ['priority'],
329
+ tagsToRemove: ['pending'],
330
+ })
328
331
  ```
329
332
 
330
333
  ## Advanced: Building Custom Integration Actions
@@ -339,48 +342,43 @@ Here's how integration actions are implemented (example from Intercom integratio
339
342
 
340
343
  ```typescript
341
344
  // In integrations/intercom/src/actions/send-admin-message.ts
342
- import { RuntimeError } from "@botpress/client";
343
- import * as bp from "../../.botpress";
344
-
345
- export const sendAdminMessage: bp.IntegrationProps["actions"]["sendAdminMessage"] =
346
- async ({ input }) => {
347
- const url = new URL(
348
- `https://api.intercom.io/conversations/${input.intercomConversationId}/reply`
349
- );
350
-
351
- const requestBody: Record<string, unknown> = {
352
- message_type: input.messageType ?? "comment",
353
- type: "admin",
354
- body: input.body,
355
- admin_id: input.adminId,
356
- };
357
-
358
- // Add optional parameters
359
- if (input.attachment_urls && input.attachment_urls.length > 0) {
360
- requestBody.attachment_urls = input.attachment_urls;
361
- }
362
-
363
- // Call external API
364
- const response = await fetch(url.toString(), {
365
- method: "POST",
366
- headers: {
367
- Authorization: `Bearer ${bp.secrets.TOKEN}`,
368
- "Intercom-Version": "2.14",
369
- "Content-Type": "application/json",
370
- },
371
- body: JSON.stringify(requestBody),
372
- });
345
+ import { RuntimeError } from '@botpress/client'
346
+ import * as bp from '../../.botpress'
347
+
348
+ export const sendAdminMessage: bp.IntegrationProps['actions']['sendAdminMessage'] = async ({ input }) => {
349
+ const url = new URL(`https://api.intercom.io/conversations/${input.intercomConversationId}/reply`)
373
350
 
374
- // Error handling
375
- if (!response.ok) {
376
- const errorText = await response.text();
377
- throw new RuntimeError(
378
- `Failed to send admin message: ${response.status} - ${errorText}`
379
- );
380
- }
351
+ const requestBody: Record<string, unknown> = {
352
+ message_type: input.messageType ?? 'comment',
353
+ type: 'admin',
354
+ body: input.body,
355
+ admin_id: input.adminId,
356
+ }
357
+
358
+ // Add optional parameters
359
+ if (input.attachment_urls && input.attachment_urls.length > 0) {
360
+ requestBody.attachment_urls = input.attachment_urls
361
+ }
381
362
 
382
- return await response.json();
383
- };
363
+ // Call external API
364
+ const response = await fetch(url.toString(), {
365
+ method: 'POST',
366
+ headers: {
367
+ Authorization: `Bearer ${bp.secrets.TOKEN}`,
368
+ 'Intercom-Version': '2.14',
369
+ 'Content-Type': 'application/json',
370
+ },
371
+ body: JSON.stringify(requestBody),
372
+ })
373
+
374
+ // Error handling
375
+ if (!response.ok) {
376
+ const errorText = await response.text()
377
+ throw new RuntimeError(`Failed to send admin message: ${response.status} - ${errorText}`)
378
+ }
379
+
380
+ return await response.json()
381
+ }
384
382
  ```
385
383
 
386
384
  ### Integration Action Definition
@@ -389,19 +387,19 @@ Actions are defined in the integration's definition file:
389
387
 
390
388
  ```typescript
391
389
  // In integrations/intercom/integration.definition.ts
392
- import { Integration, z } from "@botpress/sdk";
390
+ import { Integration, z } from '@botpress/sdk'
393
391
 
394
392
  export default new Integration({
395
393
  actions: {
396
394
  sendAdminMessage: {
397
- title: "Send Admin Message",
398
- description: "Send a message as an admin with optional attachments",
395
+ title: 'Send Admin Message',
396
+ description: 'Send a message as an admin with optional attachments',
399
397
  input: {
400
398
  schema: z.object({
401
399
  adminId: z.string(),
402
400
  intercomConversationId: z.string(),
403
401
  body: z.string(),
404
- messageType: z.enum(["comment", "note"]).optional(),
402
+ messageType: z.enum(['comment', 'note']).optional(),
405
403
  attachment_urls: z.array(z.string().url()).max(10).optional(),
406
404
  }),
407
405
  },
@@ -415,7 +413,7 @@ export default new Integration({
415
413
  },
416
414
  // ... more actions
417
415
  },
418
- });
416
+ })
419
417
  ```
420
418
 
421
419
  ### Key Integration Action Patterns
@@ -433,71 +431,69 @@ export default new Integration({
433
431
 
434
432
  ```typescript
435
433
  // In a workflow step
436
- await step("sync-to-slack", async () => {
434
+ await step('sync-to-slack', async () => {
437
435
  // Get data from Linear
438
436
  const { items } = await actions.linear.issueList({
439
437
  first: 10,
440
- filter: { state: { name: { eq: "Done" } } }
441
- });
438
+ filter: { state: { name: { eq: 'Done' } } },
439
+ })
442
440
 
443
441
  // Send to Slack
444
442
  for (const issue of items) {
445
443
  await actions.slack.sendMessage({
446
- channel: "#updates",
447
- text: `✅ Completed: ${issue.title}`
448
- });
444
+ channel: '#updates',
445
+ text: `✅ Completed: ${issue.title}`,
446
+ })
449
447
  }
450
- });
448
+ })
451
449
  ```
452
450
 
453
451
  ### Using in Workflows
454
452
 
455
453
  ```typescript
456
454
  export const SyncLinearWorkflow = new Workflow({
457
- name: "syncLinear",
455
+ name: 'syncLinear',
458
456
  async handler({ step }) {
459
457
  // Step 1: Fetch from Linear
460
- const issues = await step("fetch-issues", async () => {
458
+ const issues = await step('fetch-issues', async () => {
461
459
  const { items } = await actions.linear.issueList({
462
460
  first: 50,
463
- orderBy: { updatedAt: "desc" }
464
- });
465
- return items;
466
- });
461
+ orderBy: { updatedAt: 'desc' },
462
+ })
463
+ return items
464
+ })
467
465
 
468
466
  // Step 2: Process and update
469
- await step("update-database", async () => {
467
+ await step('update-database', async () => {
470
468
  for (const issue of issues) {
471
- await updateDatabase(issue);
469
+ await updateDatabase(issue)
472
470
  }
473
- });
474
- }
475
- });
471
+ })
472
+ },
473
+ })
476
474
  ```
477
475
 
478
476
  ### Using in Tools
479
477
 
480
478
  ```typescript
481
- import { Autonomous, z } from "@botpress/runtime";
479
+ import { Autonomous, z } from '@botpress/runtime'
482
480
 
483
481
  export const searchWebTool = new Autonomous.Tool({
484
- name: "searchWeb",
485
- description: "Search the web for information",
482
+ name: 'searchWeb',
483
+ description: 'Search the web for information',
486
484
  input: z.object({
487
- query: z.string().describe("Search query")
485
+ query: z.string().describe('Search query'),
488
486
  }),
489
487
  output: z.string(),
490
488
  handler: async ({ query }) => {
491
489
  const results = await actions.browser.webSearch({
492
490
  query,
493
- maxResults: 5
494
- });
491
+ maxResults: 5,
492
+ })
495
493
 
496
- return results
497
- .map((r, i) => `${i + 1}. ${r.title}\n${r.snippet}`)
498
- .join("\n\n");
499
- }
500
- });
494
+ return results.map((r, i) => `${i + 1}. ${r.title}\n${r.snippet}`).join('\n\n')
495
+ },
496
+ })
501
497
  ```
502
498
 
503
499
  ## Type Inference
@@ -506,18 +502,16 @@ TypeScript automatically infers types from integration actions:
506
502
 
507
503
  ```typescript
508
504
  // Infer return type
509
- type SearchResult = Awaited<ReturnType<typeof actions.browser.webSearch>>;
505
+ type SearchResult = Awaited<ReturnType<typeof actions.browser.webSearch>>
510
506
  // SearchResult is { title: string; url: string; snippet: string }[]
511
507
 
512
508
  // Infer parameter type
513
- type IssueListParams = Parameters<typeof actions.linear.issueList>[0];
509
+ type IssueListParams = Parameters<typeof actions.linear.issueList>[0]
514
510
  // IssueListParams is { first?: number; filter?: {...}; ... }
515
511
 
516
512
  // Use in function signatures
517
- async function processIssues(
518
- params: Parameters<typeof actions.linear.issueList>[0]
519
- ) {
520
- const { items } = await actions.linear.issueList(params);
513
+ async function processIssues(params: Parameters<typeof actions.linear.issueList>[0]) {
514
+ const { items } = await actions.linear.issueList(params)
521
515
  // ...
522
516
  }
523
517
  ```
@@ -527,15 +521,17 @@ async function processIssues(
527
521
  The `actions` proxy handles both:
528
522
 
529
523
  **Bot Actions** (from `src/actions/*.ts`):
524
+
530
525
  ```typescript
531
526
  // Direct access to your bot's actions
532
- await actions.myCustomAction({ param: "value" });
527
+ await actions.myCustomAction({ param: 'value' })
533
528
  ```
534
529
 
535
530
  **Integration Actions** (from installed integrations):
531
+
536
532
  ```typescript
537
533
  // Nested under integration name
538
- await actions.slack.sendMessage({ channel: "#general", text: "Hi" });
534
+ await actions.slack.sendMessage({ channel: '#general', text: 'Hi' })
539
535
  ```
540
536
 
541
537
  The actions proxy automatically determines whether you're calling a bot action (top-level) or an integration action (nested under integration name).
@@ -549,6 +545,7 @@ The actions proxy automatically determines whether you're calling a bot action (
549
545
  ```
550
546
 
551
547
  **Solutions:**
548
+
552
549
  1. Add integration: `adk integrations add slack@2.5.5`
553
550
  2. Enable: `adk integrations enable slack`
554
551
  3. Configure credentials in Dev Console (localhost:3001) or via `adk integrations configure`
@@ -561,6 +558,7 @@ The actions proxy automatically determines whether you're calling a bot action (
561
558
  ```
562
559
 
563
560
  **Solutions:**
561
+
564
562
  1. Check integration documentation for available actions
565
563
  2. Verify integration version supports the action
566
564
  3. Check for typos in action name
@@ -572,6 +570,7 @@ The actions proxy automatically determines whether you're calling a bot action (
572
570
  ```
573
571
 
574
572
  **Solutions:**
573
+
575
574
  1. Check IntelliSense for correct parameter names
576
575
  2. Verify integration version matches your usage
577
576
  3. Run `adk dev` to regenerate types
@@ -583,6 +582,7 @@ The actions proxy automatically determines whether you're calling a bot action (
583
582
  ```
584
583
 
585
584
  **Solutions:**
585
+
586
586
  1. Configure credentials in Dev Console (localhost:3001 during dev)
587
587
  2. Set credentials via `adk integrations configure <alias> --set key=value`
588
588
  3. Check environment variables are set
@@ -594,9 +594,9 @@ The actions proxy automatically determines whether you're calling a bot action (
594
594
 
595
595
  ```typescript
596
596
  try {
597
- await actions.slack.sendMessage({ channel: "#general", text: "Hi" });
597
+ await actions.slack.sendMessage({ channel: '#general', text: 'Hi' })
598
598
  } catch (error) {
599
- console.error("Failed to send Slack message:", error);
599
+ console.error('Failed to send Slack message:', error)
600
600
  // Fallback or retry logic
601
601
  }
602
602
  ```
@@ -628,13 +628,13 @@ if (slack) {
628
628
  ```typescript
629
629
  // ✅ Good - Parallel requests
630
630
  await Promise.all([
631
- actions.slack.sendMessage({ channel: "#team1", text: "Update" }),
632
- actions.slack.sendMessage({ channel: "#team2", text: "Update" })
633
- ]);
631
+ actions.slack.sendMessage({ channel: '#team1', text: 'Update' }),
632
+ actions.slack.sendMessage({ channel: '#team2', text: 'Update' }),
633
+ ])
634
634
 
635
635
  // ❌ Bad - Sequential (slower)
636
- await actions.slack.sendMessage({ channel: "#team1", text: "Update" });
637
- await actions.slack.sendMessage({ channel: "#team2", text: "Update" });
636
+ await actions.slack.sendMessage({ channel: '#team1', text: 'Update' })
637
+ await actions.slack.sendMessage({ channel: '#team2', text: 'Update' })
638
638
  ```
639
639
 
640
640
  ### 5. Use .asTool() for AI
@@ -642,12 +642,9 @@ await actions.slack.sendMessage({ channel: "#team2", text: "Update" });
642
642
  ```typescript
643
643
  // Make integration actions available to AI
644
644
  await execute({
645
- instructions: "Help the user",
646
- tools: [
647
- actions.linear.issueCreate.asTool(),
648
- actions.slack.sendMessage.asTool(),
649
- ]
650
- });
645
+ instructions: 'Help the user',
646
+ tools: [actions.linear.issueCreate.asTool(), actions.slack.sendMessage.asTool()],
647
+ })
651
648
  ```
652
649
 
653
650
  ## See Also