@botpress/adk-cli 1.19.0-beta.4 → 1.19.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{README-wjb7z7f0.md → README-824wa4jj.md} +1 -1
- package/dist/SKILL-75ym6tcj.md +257 -0
- package/dist/SKILL-chnwzmt1.md +548 -0
- package/dist/SKILL-d4bs53y3.md +244 -0
- package/dist/SKILL-h4b2f1n9.md +114 -0
- package/dist/SKILL-hbw5nt95.md +111 -0
- package/dist/actions-h7hxxvxr.md +823 -0
- package/dist/adk-build-emhwd0tg.md +39 -0
- package/dist/adk-debug-yrrdtpmb.md +23 -0
- package/dist/adk-dev-console-7z9rtjpy.md +17 -0
- package/dist/adk-document-ras6zzzh.md +68 -0
- package/dist/adk-eval-vx76dwq0.md +17 -0
- package/dist/adk-explain-fcsaw852.md +22 -0
- package/dist/adk-init-9kmxmbbe.md +30 -0
- package/dist/adk-ship-dybzn884.md +29 -0
- package/dist/adk-test-xq67savs.md +27 -0
- package/dist/adk-validate-1p4skv4m.md +31 -0
- package/dist/advanced-patterns-z86m9h1a.md +669 -0
- package/dist/agent-config-1aqvkrgf.md +450 -0
- package/dist/agent-steps-zj4c1n9t.md +115 -0
- package/dist/assets-q7jt8r2q.md +237 -0
- package/dist/autonomous-execution-fymc12e5.md +747 -0
- package/dist/cli-c31e06yr.md +1334 -0
- package/dist/cli.js +970 -566
- package/dist/commands.json +24 -3
- package/dist/common-failures-ht29w2db.md +231 -0
- package/dist/component-registry-bbpw0see.md +43 -0
- package/dist/context-api-760cvh0h.md +461 -0
- package/dist/conversation-analysis-8ka4nrm4.md +420 -0
- package/dist/conversation-lifecycle-4seqqjc1.md +311 -0
- package/dist/conversations-gwfvxaee.md +1111 -0
- package/dist/custom-components-y5wdgpey.md +167 -0
- package/dist/debug-workflow-vz84q80v.md +239 -0
- package/dist/desk-k54ktvsd.md +852 -0
- package/dist/doc-standards-ck6ax2jd.md +124 -0
- package/dist/eval-format-7n9brja4.md +354 -0
- package/dist/evals-y1zcr1mc.md +11 -0
- package/dist/explain-config-1yaq3zzd.md +424 -0
- package/dist/files-dzt0wxn3.md +918 -0
- package/dist/integration-actions-xang7tma.md +659 -0
- package/dist/integrations-k5ss07f4.md +266 -0
- package/dist/interfaces-6t0bpxs4.md +97 -0
- package/dist/knowledge-bases-20rg8p5c.md +456 -0
- package/dist/llm-debugging-76ng8rzm.md +209 -0
- package/dist/mcp-server-n1asyzhv.md +112 -0
- package/dist/messages-gkkg0b54.md +769 -0
- package/dist/model-configuration-f273kgd0.md +201 -0
- package/dist/multi-agent-dashboard-1mdfjdts.md +70 -0
- package/dist/pages-xn18xn73.md +273 -0
- package/dist/patterns-mistakes-5vb99dhf.md +469 -0
- package/dist/plugins-ttnx8f49.md +280 -0
- package/dist/tables-x45t36dd.md +1136 -0
- package/dist/tags-46td3qrg.md +516 -0
- package/dist/test-patterns-hj47w4nc.md +355 -0
- package/dist/testing-workflow-2vkp932f.md +225 -0
- package/dist/tools-wk7bq24z.md +581 -0
- package/dist/trace-summarization-hdyx1c2e.md +313 -0
- package/dist/traces-and-logs-f2kjfh19.md +203 -0
- package/dist/triggers-4j2cc86x.md +719 -0
- package/dist/ui-server-entry.js +952 -137
- package/dist/workflow-steps-mrdrf1c5.md +851 -0
- package/dist/workflows-gadx3s69.md +1408 -0
- package/dist/zai-agent-reference-e6644aad.md +454 -0
- package/dist/zai-complete-guide-mnna5d6f.md +1408 -0
- package/package.json +4 -4
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Assets
|
|
2
|
+
|
|
3
|
+
Assets are static files (images, documents, media) that ship with your agent. Place files in the `assets/` directory at the project root, and they get synced to Botpress Cloud with permanent URLs accessible at runtime via the global `assets` object.
|
|
4
|
+
|
|
5
|
+
## Basic Concepts
|
|
6
|
+
|
|
7
|
+
### What are Assets?
|
|
8
|
+
|
|
9
|
+
- **Static file storage**: Ship images, PDFs, stylesheets, or any file alongside your agent
|
|
10
|
+
- **Permanent URLs**: Each asset gets a CDN-backed URL after sync
|
|
11
|
+
- **Auto-typed**: TypeScript paths are generated so `assets.get()` autocompletes
|
|
12
|
+
- **Sync-aware**: Runtime warns when assets are stale or never synced
|
|
13
|
+
- **Content-hashed**: Changes are detected via SHA-256 hashing
|
|
14
|
+
|
|
15
|
+
### File Location
|
|
16
|
+
|
|
17
|
+
- **Location**: `assets/` directory at the project root (not inside `src/`)
|
|
18
|
+
- **Subdirectories supported**: `assets/images/logo.png` → referenced as `"images/logo.png"`
|
|
19
|
+
- **Generated files**: `.adk/assets.d.ts` (types) and `.adk/assets-runtime.ts` (metadata)
|
|
20
|
+
|
|
21
|
+
### Supported File Types
|
|
22
|
+
|
|
23
|
+
Images, documents, media, and more — MIME type is auto-detected from the extension:
|
|
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` |
|
|
34
|
+
|
|
35
|
+
Unrecognized extensions default to `application/octet-stream`.
|
|
36
|
+
|
|
37
|
+
## Project Structure
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/ # Project root
|
|
41
|
+
├── assets/ # ← Asset files live here
|
|
42
|
+
│ ├── logo.png
|
|
43
|
+
│ ├── onboarding.pdf
|
|
44
|
+
│ └── images/
|
|
45
|
+
│ └── header.webp
|
|
46
|
+
├── src/
|
|
47
|
+
│ └── ...
|
|
48
|
+
├── .adk/
|
|
49
|
+
│ ├── assets.d.ts # Auto-generated types
|
|
50
|
+
│ ├── assets-runtime.ts # Auto-generated metadata
|
|
51
|
+
│ └── assets-cache.json # Sync state cache
|
|
52
|
+
└── agent.config.ts
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Using Assets at Runtime
|
|
56
|
+
|
|
57
|
+
The global `assets` object is available in any action, tool, workflow, or conversation handler.
|
|
58
|
+
|
|
59
|
+
### Get an Asset
|
|
60
|
+
|
|
61
|
+
`assets.get()` is async and throws an `Error` if the path does not match any known asset.
|
|
62
|
+
|
|
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
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### List All Assets
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const all = assets.list();
|
|
74
|
+
for (const asset of all) {
|
|
75
|
+
console.log(`${asset.path}: ${asset.url}`);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Check Sync Status
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const status = assets.getSyncStatus();
|
|
83
|
+
if (!status.synced) {
|
|
84
|
+
console.warn("Unsynced assets:", status.neverSynced);
|
|
85
|
+
console.warn("Stale assets:", status.stale);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Asset Properties
|
|
90
|
+
|
|
91
|
+
Each `Asset` object has these fields:
|
|
92
|
+
|
|
93
|
+
| Field | Type | Description |
|
|
94
|
+
| ----------- | -------- | ---------------------------------- |
|
|
95
|
+
| `url` | `string` | Permanent CDN URL |
|
|
96
|
+
| `path` | `string` | Relative path (e.g., `"logo.png"`) |
|
|
97
|
+
| `name` | `string` | Filename |
|
|
98
|
+
| `size` | `number` | File size in bytes |
|
|
99
|
+
| `mime` | `string` | MIME type |
|
|
100
|
+
| `hash` | `string` | SHA-256 content hash |
|
|
101
|
+
| `fileId` | `string` | Unique file ID in Botpress |
|
|
102
|
+
| `createdAt` | `string` | ISO timestamp |
|
|
103
|
+
| `updatedAt` | `string` | ISO timestamp |
|
|
104
|
+
|
|
105
|
+
## CLI Commands
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Sync local assets to Botpress Cloud
|
|
109
|
+
adk assets sync
|
|
110
|
+
|
|
111
|
+
# Dry run — see what would change without uploading
|
|
112
|
+
adk assets sync --dry-run
|
|
113
|
+
|
|
114
|
+
# Force re-upload all assets
|
|
115
|
+
adk assets sync --force
|
|
116
|
+
|
|
117
|
+
# Auto-confirm sync without prompts
|
|
118
|
+
adk assets sync --yes
|
|
119
|
+
|
|
120
|
+
# List assets (local, remote, or both)
|
|
121
|
+
adk assets list
|
|
122
|
+
adk assets list --local
|
|
123
|
+
adk assets list --remote
|
|
124
|
+
adk assets list --format json
|
|
125
|
+
|
|
126
|
+
# Check sync status
|
|
127
|
+
adk assets status
|
|
128
|
+
adk assets status --format json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Assets are also synced automatically during `adk deploy`.
|
|
132
|
+
|
|
133
|
+
## Sync Lifecycle
|
|
134
|
+
|
|
135
|
+
1. Local files in `assets/` are hashed (SHA-256)
|
|
136
|
+
2. Hashes are compared against the remote versions in Botpress Cloud
|
|
137
|
+
3. A sync plan is computed: create / update / delete
|
|
138
|
+
4. Files are uploaded with metadata tags (`type: "asset"`, `adk: "true"`, `path`, `hash`)
|
|
139
|
+
5. Cache is updated in `.adk/assets-cache.json`
|
|
140
|
+
6. TypeScript types and runtime metadata are regenerated
|
|
141
|
+
|
|
142
|
+
### Sync States
|
|
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 |
|
|
149
|
+
|
|
150
|
+
The runtime emits a console warning the first time you access a stale or never-synced asset.
|
|
151
|
+
|
|
152
|
+
## Practical Examples
|
|
153
|
+
|
|
154
|
+
### Send an Image in a Conversation
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { Conversation } from "@botpress/runtime";
|
|
158
|
+
|
|
159
|
+
export default new Conversation({
|
|
160
|
+
channel: "webchat",
|
|
161
|
+
async handler({ conversation }) {
|
|
162
|
+
const logo = await assets.get("logo.png");
|
|
163
|
+
await conversation.send({
|
|
164
|
+
type: "image",
|
|
165
|
+
payload: { imageUrl: logo.url },
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Use an Asset URL in a Tool Response
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import { Autonomous } from "@botpress/runtime";
|
|
175
|
+
|
|
176
|
+
export const getBranding = new Autonomous.Tool({
|
|
177
|
+
description: "Returns branding assets",
|
|
178
|
+
handler: async () => {
|
|
179
|
+
const logo = await assets.get("logo.png");
|
|
180
|
+
const header = await assets.get("images/header.webp");
|
|
181
|
+
return {
|
|
182
|
+
logoUrl: logo.url,
|
|
183
|
+
headerUrl: header.url,
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Check Asset Health in an Action
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
import { Action, z } from "@botpress/runtime";
|
|
193
|
+
|
|
194
|
+
export const checkAssets = new Action({
|
|
195
|
+
name: "checkAssets",
|
|
196
|
+
input: {},
|
|
197
|
+
output: { synced: z.boolean(), issues: z.array(z.string()) },
|
|
198
|
+
async handler() {
|
|
199
|
+
const status = assets.getSyncStatus();
|
|
200
|
+
return {
|
|
201
|
+
synced: status.synced,
|
|
202
|
+
issues: [
|
|
203
|
+
...status.neverSynced.map((p) => `Never synced: ${p}`),
|
|
204
|
+
...status.stale.map((p) => `Stale: ${p}`),
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Common Mistakes
|
|
212
|
+
|
|
213
|
+
### Putting assets inside `src/`
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
# ❌ Wrong — assets/ must be at the project root
|
|
217
|
+
src/assets/logo.png
|
|
218
|
+
|
|
219
|
+
# ✅ Correct
|
|
220
|
+
assets/logo.png
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Forgetting to sync before deploy
|
|
224
|
+
|
|
225
|
+
Assets with placeholder URLs will not be accessible at runtime. Always run `adk assets sync` or `adk deploy` (which syncs automatically) before going live.
|
|
226
|
+
|
|
227
|
+
### Referencing assets by absolute path
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// ❌ Wrong
|
|
231
|
+
await assets.get("/assets/logo.png");
|
|
232
|
+
await assets.get("assets/logo.png");
|
|
233
|
+
|
|
234
|
+
// ✅ Correct — use the path relative to assets/
|
|
235
|
+
await assets.get("logo.png");
|
|
236
|
+
await assets.get("images/header.webp");
|
|
237
|
+
```
|