@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
@@ -7,9 +7,9 @@ The Files API provides structured file storage with automatic indexing, semantic
7
7
  All file operations use the Botpress client. Get the client using the Context API:
8
8
 
9
9
  ```typescript
10
- import { context } from "@botpress/runtime";
10
+ import { context } from '@botpress/runtime'
11
11
 
12
- const client = context.get("client");
12
+ const client = context.get('client')
13
13
  ```
14
14
 
15
15
  This pattern is used in all examples below. See **[Context API](./context-api.md)** for more details.
@@ -17,6 +17,7 @@ This pattern is used in all examples below. See **[Context API](./context-api.md
17
17
  ## Basic Concepts
18
18
 
19
19
  ### What is the Files API?
20
+
20
21
  - **Persistent storage**: Upload and manage files for your bot
21
22
  - **Semantic search**: Optional vector indexing for searchable content
22
23
  - **CDN delivery**: Fast file access through CloudFront
@@ -26,6 +27,7 @@ This pattern is used in all examples below. See **[Context API](./context-api.md
26
27
  ### File Properties
27
28
 
28
29
  Files have the following core properties:
30
+
29
31
  - **id**: Unique file identifier
30
32
  - **key**: User-defined unique key per bot
31
33
  - **url**: CDN URL for file content access
@@ -43,64 +45,64 @@ Files have the following core properties:
43
45
 
44
46
  ```typescript
45
47
  const { file } = await client.uploadFile({
46
- key: "documents/report-2024.pdf", // Unique key
47
- content: fileBuffer, // File content (Buffer/ArrayBuffer/Blob/string)
48
- contentType: "application/pdf", // MIME type
48
+ key: 'documents/report-2024.pdf', // Unique key
49
+ content: fileBuffer, // File content (Buffer/ArrayBuffer/Blob/string)
50
+ contentType: 'application/pdf', // MIME type
49
51
  tags: {
50
- category: "reports",
51
- year: "2024"
52
+ category: 'reports',
53
+ year: '2024',
52
54
  },
53
- index: true, // Enable semantic search
54
- accessPolicies: ["public_content"] // Make publicly accessible
55
- });
55
+ index: true, // Enable semantic search
56
+ accessPolicies: ['public_content'], // Make publicly accessible
57
+ })
56
58
 
57
- console.log("File ID:", file.id);
58
- console.log("File URL:", file.url);
59
+ console.log('File ID:', file.id)
60
+ console.log('File URL:', file.url)
59
61
  ```
60
62
 
61
63
  ### Upload Options
62
64
 
63
65
  ```typescript
64
66
  await client.uploadFile({
65
- key: "unique-file-key", // Required: Unique identifier
66
- content: fileBuffer, // Required: File content
67
- contentType: "text/plain", // Optional: MIME type
67
+ key: 'unique-file-key', // Required: Unique identifier
68
+ content: fileBuffer, // Required: File content
69
+ contentType: 'text/plain', // Optional: MIME type
68
70
 
69
71
  // Indexing options
70
- index: true, // Enable semantic search
72
+ index: true, // Enable semantic search
71
73
  indexing: {
72
74
  configuration: {
73
75
  vision: {
74
- transcribePages: true, // OCR for images/PDFs
75
- indexPages: "all" // Index all pages
76
- }
77
- }
76
+ transcribePages: true, // OCR for images/PDFs
77
+ indexPages: 'all', // Index all pages
78
+ },
79
+ },
78
80
  },
79
81
 
80
82
  // Access control
81
83
  accessPolicies: [
82
- "public_content", // Public URL access
83
- "integrations" // Integration access
84
+ 'public_content', // Public URL access
85
+ 'integrations', // Integration access
84
86
  ],
85
87
 
86
88
  // Organization
87
89
  tags: {
88
- category: "documents",
89
- department: "sales"
90
+ category: 'documents',
91
+ department: 'sales',
90
92
  },
91
93
 
92
94
  // Custom metadata
93
95
  metadata: {
94
- author: "John Doe",
95
- version: "1.0"
96
+ author: 'John Doe',
97
+ version: '1.0',
96
98
  },
97
99
 
98
100
  // Expiry (max 90 days)
99
101
  expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
100
102
 
101
103
  // Immediate public access (requires public_content policy)
102
- publicContentImmediatelyAccessible: true
103
- });
104
+ publicContentImmediatelyAccessible: true,
105
+ })
104
106
  ```
105
107
 
106
108
  ### Uploading Text Content
@@ -109,11 +111,11 @@ For simple text/JSON content:
109
111
 
110
112
  ```typescript
111
113
  const { file } = await client.uploadFile({
112
- key: "config/settings.json",
113
- content: jsonContent, // String content
114
- contentType: "application/json",
115
- index: false
116
- });
114
+ key: 'config/settings.json',
115
+ content: jsonContent, // String content
116
+ contentType: 'application/json',
117
+ index: false,
118
+ })
117
119
  ```
118
120
 
119
121
  ### Uploading from URL
@@ -122,11 +124,11 @@ To upload from an external URL:
122
124
 
123
125
  ```typescript
124
126
  const { file } = await client.uploadFile({
125
- key: "imported/image.jpg",
126
- url: "https://example.com/image.jpg", // Fetch from URL
127
- contentType: "image/jpeg",
128
- index: false
129
- });
127
+ key: 'imported/image.jpg',
128
+ url: 'https://example.com/image.jpg', // Fetch from URL
129
+ contentType: 'image/jpeg',
130
+ index: false,
131
+ })
130
132
  ```
131
133
 
132
134
  ## Retrieving Files
@@ -136,17 +138,17 @@ const { file } = await client.uploadFile({
136
138
  ```typescript
137
139
  // Get by ID
138
140
  const { file } = await client.getFile({
139
- id: "file_abc123"
140
- });
141
+ id: 'file_abc123',
142
+ })
141
143
 
142
144
  // Get by key
143
145
  const { file } = await client.getFile({
144
- id: "documents/report-2024.pdf" // Can use key as ID
145
- });
146
+ id: 'documents/report-2024.pdf', // Can use key as ID
147
+ })
146
148
 
147
- console.log("File URL:", file.url);
148
- console.log("File size:", file.size);
149
- console.log("Status:", file.status);
149
+ console.log('File URL:', file.url)
150
+ console.log('File size:', file.size)
151
+ console.log('Status:', file.status)
150
152
  ```
151
153
 
152
154
  ### Access File Content
@@ -154,36 +156,36 @@ console.log("Status:", file.status);
154
156
  Files are accessed via URL. The URL type depends on access policies:
155
157
 
156
158
  ```typescript
157
- const { file } = await client.getFile({ id: fileId });
159
+ const { file } = await client.getFile({ id: fileId })
158
160
 
159
161
  // For public files: permanent CDN URL
160
162
  // For private files: temporary presigned S3 URL
161
163
 
162
- const response = await fetch(file.url);
163
- const content = await response.text();
164
+ const response = await fetch(file.url)
165
+ const content = await response.text()
164
166
 
165
167
  // For JSON files
166
- const data = await response.json();
168
+ const data = await response.json()
167
169
 
168
170
  // For binary files
169
- const buffer = await response.arrayBuffer();
171
+ const buffer = await response.arrayBuffer()
170
172
  ```
171
173
 
172
174
  ### File Status States
173
175
 
174
176
  ```typescript
175
177
  type FileStatus =
176
- | "upload_pending" // Awaiting content upload
177
- | "upload_completed" // Upload successful
178
- | "upload_failed" // Upload failed
179
- | "indexing_pending" // Queued for indexing
180
- | "indexing_completed" // Indexed and searchable
181
- | "indexing_failed" // Indexing failed
178
+ | 'upload_pending' // Awaiting content upload
179
+ | 'upload_completed' // Upload successful
180
+ | 'upload_failed' // Upload failed
181
+ | 'indexing_pending' // Queued for indexing
182
+ | 'indexing_completed' // Indexed and searchable
183
+ | 'indexing_failed' // Indexing failed
182
184
 
183
185
  // Check file status
184
- const { file } = await client.getFile({ id: fileId });
185
- if (file.status === "indexing_completed") {
186
- console.log("File is indexed and searchable");
186
+ const { file } = await client.getFile({ id: fileId })
187
+ if (file.status === 'indexing_completed') {
188
+ console.log('File is indexed and searchable')
187
189
  }
188
190
  ```
189
191
 
@@ -194,18 +196,18 @@ if (file.status === "indexing_completed") {
194
196
  ```typescript
195
197
  const { files, meta } = await client.listFiles({
196
198
  limit: 20,
197
- offset: 0
198
- });
199
+ offset: 0,
200
+ })
199
201
 
200
- files.forEach(file => {
201
- console.log(file.key, file.size, file.status);
202
- });
202
+ files.forEach((file) => {
203
+ console.log(file.key, file.size, file.status)
204
+ })
203
205
 
204
206
  // Pagination
205
207
  if (meta.nextToken) {
206
208
  const nextPage = await client.listFiles({
207
- nextToken: meta.nextToken
208
- });
209
+ nextToken: meta.nextToken,
210
+ })
209
211
  }
210
212
  ```
211
213
 
@@ -214,42 +216,42 @@ if (meta.nextToken) {
214
216
  ```typescript
215
217
  // Single tag filter
216
218
  const { files } = await client.listFiles({
217
- tags: { category: "reports" }
218
- });
219
+ tags: { category: 'reports' },
220
+ })
219
221
 
220
222
  // Multiple values (OR condition)
221
223
  const { files } = await client.listFiles({
222
224
  tags: {
223
- category: ["reports", "documents"]
224
- }
225
- });
225
+ category: ['reports', 'documents'],
226
+ },
227
+ })
226
228
 
227
229
  // Exclude values
228
230
  const { files } = await client.listFiles({
229
231
  tags: {
230
232
  category: {
231
- not: "archived"
232
- }
233
- }
234
- });
233
+ not: 'archived',
234
+ },
235
+ },
236
+ })
235
237
  ```
236
238
 
237
239
  ### Filtering by IDs
238
240
 
239
241
  ```typescript
240
242
  const { files } = await client.listFiles({
241
- ids: ["file_123", "file_456", "file_789"]
242
- });
243
+ ids: ['file_123', 'file_456', 'file_789'],
244
+ })
243
245
  ```
244
246
 
245
247
  ### Sorting
246
248
 
247
249
  ```typescript
248
250
  const { files } = await client.listFiles({
249
- sortBy: "createdAt",
250
- sortOrder: "desc",
251
- limit: 10
252
- });
251
+ sortBy: 'createdAt',
252
+ sortOrder: 'desc',
253
+ limit: 10,
254
+ })
253
255
 
254
256
  // Available sort fields:
255
257
  // - key
@@ -265,38 +267,38 @@ const { files } = await client.listFiles({
265
267
 
266
268
  ```typescript
267
269
  const { passages } = await client.searchFiles({
268
- query: "machine learning algorithms",
269
- limit: 5
270
- });
270
+ query: 'machine learning algorithms',
271
+ limit: 5,
272
+ })
271
273
 
272
- passages.forEach(passage => {
273
- console.log("File:", passage.file.key);
274
- console.log("Content:", passage.content);
275
- console.log("Similarity:", passage.score);
276
- console.log("Page:", passage.meta.pageNumber);
277
- });
274
+ passages.forEach((passage) => {
275
+ console.log('File:', passage.file.key)
276
+ console.log('Content:', passage.content)
277
+ console.log('Similarity:', passage.score)
278
+ console.log('Page:', passage.meta.pageNumber)
279
+ })
278
280
  ```
279
281
 
280
282
  ### Search Options
281
283
 
282
284
  ```typescript
283
285
  const { passages } = await client.searchFiles({
284
- query: "customer feedback",
286
+ query: 'customer feedback',
285
287
 
286
288
  // Filtering
287
- tags: { category: "support" },
289
+ tags: { category: 'support' },
288
290
 
289
291
  // Context
290
- contextDepth: 2, // Include 2 surrounding passages
291
- includeBreadcrumb: true, // Include document structure
292
- withContext: true, // Return detailed context
292
+ contextDepth: 2, // Include 2 surrounding passages
293
+ includeBreadcrumb: true, // Include document structure
294
+ withContext: true, // Return detailed context
293
295
 
294
296
  // Consolidation
295
- consolidate: true, // Group by file, sort by position
297
+ consolidate: true, // Group by file, sort by position
296
298
 
297
299
  // Pagination
298
- limit: 10
299
- });
300
+ limit: 10,
301
+ })
300
302
  ```
301
303
 
302
304
  ### Search Result Structure
@@ -305,38 +307,39 @@ const { passages } = await client.searchFiles({
305
307
  {
306
308
  passages: [
307
309
  {
308
- content: "The matched text passage...",
309
- score: 0.89, // Similarity score (0-1)
310
+ content: 'The matched text passage...',
311
+ score: 0.89, // Similarity score (0-1)
310
312
  meta: {
311
- type: "paragraph", // passage | title | subtitle | etc.
312
- subtype: "text",
313
+ type: 'paragraph', // passage | title | subtitle | etc.
314
+ subtype: 'text',
313
315
  pageNumber: 5,
314
316
  position: 12,
315
- sourceUrl: "https://..."
317
+ sourceUrl: 'https://...',
316
318
  },
317
319
  file: {
318
- id: "file_abc123",
319
- key: "documents/report.pdf",
320
- contentType: "application/pdf",
321
- tags: { category: "reports" },
322
- createdAt: "2024-01-15T10:30:00Z",
323
- updatedAt: "2024-01-15T10:30:00Z"
320
+ id: 'file_abc123',
321
+ key: 'documents/report.pdf',
322
+ contentType: 'application/pdf',
323
+ tags: { category: 'reports' },
324
+ createdAt: '2024-01-15T10:30:00Z',
325
+ updatedAt: '2024-01-15T10:30:00Z',
324
326
  },
325
- context: [ // Only if withContext: true
327
+ context: [
328
+ // Only if withContext: true
326
329
  {
327
- type: "preceding",
328
- content: "Previous passage..."
330
+ type: 'preceding',
331
+ content: 'Previous passage...',
329
332
  },
330
333
  {
331
- type: "current",
332
- content: "The matched text passage..."
334
+ type: 'current',
335
+ content: 'The matched text passage...',
333
336
  },
334
337
  {
335
- type: "subsequent",
336
- content: "Next passage..."
337
- }
338
- ]
339
- }
338
+ type: 'subsequent',
339
+ content: 'Next passage...',
340
+ },
341
+ ],
342
+ },
340
343
  ]
341
344
  }
342
345
  ```
@@ -351,19 +354,19 @@ const { file } = await client.updateFileMetadata({
351
354
  id: fileId,
352
355
 
353
356
  metadata: {
354
- version: "2.0",
355
- updatedBy: "Jane Doe"
357
+ version: '2.0',
358
+ updatedBy: 'Jane Doe',
356
359
  },
357
360
 
358
361
  tags: {
359
- status: "reviewed",
360
- newTag: "value"
362
+ status: 'reviewed',
363
+ newTag: 'value',
361
364
  },
362
365
 
363
- accessPolicies: ["public_content"],
366
+ accessPolicies: ['public_content'],
364
367
 
365
- expiresAt: new Date("2024-12-31").toISOString()
366
- });
368
+ expiresAt: new Date('2024-12-31').toISOString(),
369
+ })
367
370
  ```
368
371
 
369
372
  ### Metadata Update Behavior
@@ -373,26 +376,26 @@ const { file } = await client.updateFileMetadata({
373
376
  await client.updateFileMetadata({
374
377
  id: fileId,
375
378
  metadata: {
376
- newKey: "newValue"
379
+ newKey: 'newValue',
377
380
  // Other metadata keys remain unchanged
378
- }
379
- });
381
+ },
382
+ })
380
383
 
381
384
  // Delete metadata key
382
385
  await client.updateFileMetadata({
383
386
  id: fileId,
384
387
  metadata: {
385
- oldKey: null // Removes this key
386
- }
387
- });
388
+ oldKey: null, // Removes this key
389
+ },
390
+ })
388
391
 
389
392
  // Delete tag
390
393
  await client.updateFileMetadata({
391
394
  id: fileId,
392
395
  tags: {
393
- oldTag: null // Removes this tag
394
- }
395
- });
396
+ oldTag: null, // Removes this tag
397
+ },
398
+ })
396
399
  ```
397
400
 
398
401
  ### Replace File Content
@@ -402,8 +405,8 @@ await client.updateFileMetadata({
402
405
  const { file } = await client.uploadFile({
403
406
  key: existingFileKey,
404
407
  content: newContent,
405
- contentType: "text/plain"
406
- });
408
+ contentType: 'text/plain',
409
+ })
407
410
  ```
408
411
 
409
412
  ## Managing File Passages
@@ -413,15 +416,15 @@ const { file } = await client.uploadFile({
413
416
  ```typescript
414
417
  const { passages, meta } = await client.listFilePassages({
415
418
  id: fileId,
416
- limit: 20
417
- });
419
+ limit: 20,
420
+ })
418
421
 
419
- passages.forEach(passage => {
420
- console.log("Passage ID:", passage.id);
421
- console.log("Content:", passage.content);
422
- console.log("Type:", passage.meta.type);
423
- console.log("Page:", passage.meta.pageNumber);
424
- });
422
+ passages.forEach((passage) => {
423
+ console.log('Passage ID:', passage.id)
424
+ console.log('Content:', passage.content)
425
+ console.log('Type:', passage.meta.type)
426
+ console.log('Page:', passage.meta.pageNumber)
427
+ })
425
428
  ```
426
429
 
427
430
  ### Set Custom Passages
@@ -432,20 +435,20 @@ await client.setFilePassages({
432
435
  id: fileId,
433
436
  passages: [
434
437
  {
435
- content: "# Introduction\n\nThis is the first section...",
436
- type: "title"
438
+ content: '# Introduction\n\nThis is the first section...',
439
+ type: 'title',
437
440
  },
438
441
  {
439
- content: "Main content paragraph here.",
440
- type: "paragraph",
441
- pageNumber: 1
442
+ content: 'Main content paragraph here.',
443
+ type: 'paragraph',
444
+ pageNumber: 1,
442
445
  },
443
446
  {
444
- content: "## Subsection\n\nMore details...",
445
- type: "subtitle"
446
- }
447
- ]
448
- });
447
+ content: '## Subsection\n\nMore details...',
448
+ type: 'subtitle',
449
+ },
450
+ ],
451
+ })
449
452
 
450
453
  // File status becomes "indexing_pending"
451
454
  // Check status later to confirm completion
@@ -457,15 +460,16 @@ await client.setFilePassages({
457
460
 
458
461
  ```typescript
459
462
  // Delete by ID
460
- await client.deleteFile({ id: "file_abc123" });
463
+ await client.deleteFile({ id: 'file_abc123' })
461
464
 
462
465
  // Delete by key
463
- await client.deleteFile({ id: "documents/report.pdf" });
466
+ await client.deleteFile({ id: 'documents/report.pdf' })
464
467
  ```
465
468
 
466
469
  ### Cleanup
467
470
 
468
471
  When a file is deleted:
472
+
469
473
  - File metadata removed from database
470
474
  - File content removed from S3
471
475
  - Vector embeddings removed (if indexed)
@@ -484,9 +488,9 @@ The Files API provides low-level file management. Knowledge Bases use the Files
484
488
  ```typescript
485
489
  const { file } = await client.copyFile({
486
490
  idOrKey: sourceFileId,
487
- destinationKey: "backups/report-copy.pdf",
488
- overwrite: false // Fail if destination exists
489
- });
491
+ destinationKey: 'backups/report-copy.pdf',
492
+ overwrite: false, // Fail if destination exists
493
+ })
490
494
  ```
491
495
 
492
496
  ### Copy Across Bots
@@ -494,10 +498,10 @@ const { file } = await client.copyFile({
494
498
  ```typescript
495
499
  const { file } = await client.copyFile({
496
500
  idOrKey: sourceFileId,
497
- destinationKey: "imported/report.pdf",
501
+ destinationKey: 'imported/report.pdf',
498
502
  destinationBotId: targetBotId,
499
- overwrite: true
500
- });
503
+ overwrite: true,
504
+ })
501
505
  ```
502
506
 
503
507
  ## Supported File Types
@@ -509,19 +513,19 @@ These file types support semantic search indexing:
509
513
  ```typescript
510
514
  const INDEXABLE_TYPES = {
511
515
  // Documents
512
- pdf: "application/pdf",
513
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
516
+ pdf: 'application/pdf',
517
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
514
518
 
515
519
  // Text
516
- txt: "text/plain",
517
- md: "text/markdown",
518
- html: "text/html",
520
+ txt: 'text/plain',
521
+ md: 'text/markdown',
522
+ html: 'text/html',
519
523
 
520
524
  // Images (with vision processing)
521
- jpg: "image/jpeg",
522
- jpeg: "image/jpeg",
523
- png: "image/png"
524
- };
525
+ jpg: 'image/jpeg',
526
+ jpeg: 'image/jpeg',
527
+ png: 'image/png',
528
+ }
525
529
  ```
526
530
 
527
531
  ### Vision Processing
@@ -530,19 +534,19 @@ For images and PDFs with vision enabled:
530
534
 
531
535
  ```typescript
532
536
  await client.uploadFile({
533
- key: "documents/invoice.pdf",
537
+ key: 'documents/invoice.pdf',
534
538
  content: pdfBuffer,
535
- contentType: "application/pdf",
539
+ contentType: 'application/pdf',
536
540
  index: true,
537
541
  indexing: {
538
542
  configuration: {
539
543
  vision: {
540
- transcribePages: true, // OCR text extraction
541
- indexPages: "all" // or [1, 2, 3] for specific pages
542
- }
543
- }
544
- }
545
- });
544
+ transcribePages: true, // OCR text extraction
545
+ indexPages: 'all', // or [1, 2, 3] for specific pages
546
+ },
547
+ },
548
+ },
549
+ })
546
550
  ```
547
551
 
548
552
  ## Usage in Actions/Workflows
@@ -550,90 +554,90 @@ await client.uploadFile({
550
554
  ### In Actions
551
555
 
552
556
  ```typescript
553
- import { Action, z, context } from "@botpress/runtime";
557
+ import { Action, z, context } from '@botpress/runtime'
554
558
 
555
559
  export const uploadDocument = new Action({
556
- name: "uploadDocument",
560
+ name: 'uploadDocument',
557
561
  input: z.object({
558
562
  content: z.string(),
559
- filename: z.string()
563
+ filename: z.string(),
560
564
  }),
561
565
  output: z.object({
562
566
  fileId: z.string(),
563
- fileUrl: z.string()
567
+ fileUrl: z.string(),
564
568
  }),
565
569
 
566
570
  async handler({ input }) {
567
- const client = context.get("client");
571
+ const client = context.get('client')
568
572
 
569
573
  // Upload file
570
574
  const { file } = await client.uploadFile({
571
575
  key: `uploads/${input.filename}`,
572
576
  content: input.content,
573
- contentType: "text/plain",
577
+ contentType: 'text/plain',
574
578
  index: true,
575
579
  tags: {
576
- source: "action",
577
- type: "user-upload"
578
- }
579
- });
580
+ source: 'action',
581
+ type: 'user-upload',
582
+ },
583
+ })
580
584
 
581
585
  return {
582
586
  fileId: file.id,
583
- fileUrl: file.url
584
- };
585
- }
586
- });
587
+ fileUrl: file.url,
588
+ }
589
+ },
590
+ })
587
591
  ```
588
592
 
589
593
  ### In Workflows
590
594
 
591
595
  ```typescript
592
- import { Workflow, z, context } from "@botpress/runtime";
596
+ import { Workflow, z, context } from '@botpress/runtime'
593
597
 
594
598
  export const ProcessDocumentWorkflow = new Workflow({
595
- name: "processDocument",
599
+ name: 'processDocument',
596
600
  input: z.object({ documentKey: z.string() }),
597
601
 
598
602
  async handler({ input, step }) {
599
- const client = context.get("client");
603
+ const client = context.get('client')
600
604
 
601
605
  // Get file
602
- const file = await step("get-file", async () => {
606
+ const file = await step('get-file', async () => {
603
607
  const { file } = await client.getFile({
604
- id: input.documentKey
605
- });
606
- return file;
607
- });
608
+ id: input.documentKey,
609
+ })
610
+ return file
611
+ })
608
612
 
609
613
  // Wait for indexing
610
- await step("wait-indexing", async () => {
611
- let status = file.status;
612
- while (status === "INDEXING_PENDING") {
613
- await new Promise(resolve => setTimeout(resolve, 1000));
614
+ await step('wait-indexing', async () => {
615
+ let status = file.status
616
+ while (status === 'INDEXING_PENDING') {
617
+ await new Promise((resolve) => setTimeout(resolve, 1000))
614
618
  const { file: updated } = await client.getFile({
615
- id: file.id
616
- });
617
- status = updated.status;
619
+ id: file.id,
620
+ })
621
+ status = updated.status
618
622
  }
619
- return status;
620
- });
623
+ return status
624
+ })
621
625
 
622
626
  // Search content
623
- const results = await step("search", async () => {
627
+ const results = await step('search', async () => {
624
628
  const { passages } = await client.searchFiles({
625
- query: "important findings",
626
- tags: { key: input.documentKey }
627
- });
628
- return passages;
629
- });
629
+ query: 'important findings',
630
+ tags: { key: input.documentKey },
631
+ })
632
+ return passages
633
+ })
630
634
 
631
635
  return {
632
636
  processed: true,
633
- findings: results.length
634
- };
635
- }
636
- });
637
+ findings: results.length,
638
+ }
639
+ },
640
+ })
637
641
  ```
638
642
 
639
643
  ## Best Practices
@@ -643,13 +647,13 @@ export const ProcessDocumentWorkflow = new Workflow({
643
647
  ```typescript
644
648
  // ✅ Good - Clear, hierarchical structure
645
649
  await client.uploadFile({
646
- key: "documents/2024/reports/q1-sales.pdf"
647
- });
650
+ key: 'documents/2024/reports/q1-sales.pdf',
651
+ })
648
652
 
649
653
  // ❌ Bad - Unclear, no structure
650
654
  await client.uploadFile({
651
- key: "file123.pdf"
652
- });
655
+ key: 'file123.pdf',
656
+ })
653
657
  ```
654
658
 
655
659
  ### 2. Tag Appropriately
@@ -674,21 +678,21 @@ tags: {
674
678
 
675
679
  ```typescript
676
680
  // ✅ Good - Check and handle status
677
- const { file } = await client.getFile({ id: fileId });
681
+ const { file } = await client.getFile({ id: fileId })
678
682
 
679
683
  switch (file.status) {
680
- case "UPLOAD_PENDING":
681
- console.log("Waiting for upload...");
682
- break;
683
- case "INDEXING_PENDING":
684
- console.log("Indexing in progress...");
685
- break;
686
- case "INDEXING_COMPLETED":
684
+ case 'UPLOAD_PENDING':
685
+ console.log('Waiting for upload...')
686
+ break
687
+ case 'INDEXING_PENDING':
688
+ console.log('Indexing in progress...')
689
+ break
690
+ case 'INDEXING_COMPLETED':
687
691
  // File is searchable
688
- break;
689
- case "INDEXING_FAILED":
690
- console.error("Indexing failed:", file.failedStatusReason);
691
- break;
692
+ break
693
+ case 'INDEXING_FAILED':
694
+ console.error('Indexing failed:', file.failedStatusReason)
695
+ break
692
696
  }
693
697
  ```
694
698
 
@@ -697,15 +701,15 @@ switch (file.status) {
697
701
  ```typescript
698
702
  // ✅ Good - Reasonable expiry for temporary files
699
703
  await client.uploadFile({
700
- key: "temp/cache-data.json",
701
- expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString() // 1 day
702
- });
704
+ key: 'temp/cache-data.json',
705
+ expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(), // 1 day
706
+ })
703
707
 
704
708
  // For permanent files, omit expiresAt
705
709
  await client.uploadFile({
706
- key: "documents/permanent-record.pdf"
710
+ key: 'documents/permanent-record.pdf',
707
711
  // No expiresAt = never expires
708
- });
712
+ })
709
713
  ```
710
714
 
711
715
  ### 5. Optimize Indexing
@@ -713,30 +717,30 @@ await client.uploadFile({
713
717
  ```typescript
714
718
  // ✅ Good - Index only searchable content
715
719
  await client.uploadFile({
716
- key: "documents/report.pdf",
720
+ key: 'documents/report.pdf',
717
721
  content: pdfBuffer,
718
- index: true // Searchable document
719
- });
722
+ index: true, // Searchable document
723
+ })
720
724
 
721
725
  await client.uploadFile({
722
- key: "images/logo.png",
726
+ key: 'images/logo.png',
723
727
  content: imageBuffer,
724
- index: false // Not searchable, save quota
725
- });
728
+ index: false, // Not searchable, save quota
729
+ })
726
730
 
727
731
  // ✅ Good - Use vision only when needed
728
732
  await client.uploadFile({
729
- key: "documents/scanned-invoice.pdf",
733
+ key: 'documents/scanned-invoice.pdf',
730
734
  content: pdfBuffer,
731
735
  index: true,
732
736
  indexing: {
733
737
  configuration: {
734
738
  vision: {
735
- transcribePages: true // OCR needed
736
- }
737
- }
738
- }
739
- });
739
+ transcribePages: true, // OCR needed
740
+ },
741
+ },
742
+ },
743
+ })
740
744
  ```
741
745
 
742
746
  ## Common Patterns
@@ -744,22 +748,19 @@ await client.uploadFile({
744
748
  ### File Upload with Validation
745
749
 
746
750
  ```typescript
747
- export const uploadWithValidation = async (
748
- fileContent: Buffer,
749
- filename: string
750
- ) => {
751
- const client = context.get("client");
751
+ export const uploadWithValidation = async (fileContent: Buffer, filename: string) => {
752
+ const client = context.get('client')
752
753
 
753
754
  // Validate file size (max 100MB)
754
- const MAX_SIZE = 100 * 1024 * 1024;
755
+ const MAX_SIZE = 100 * 1024 * 1024
755
756
  if (fileContent.length > MAX_SIZE) {
756
- throw new Error("File too large");
757
+ throw new Error('File too large')
757
758
  }
758
759
 
759
760
  // Validate file type
760
- const contentType = getContentType(filename);
761
+ const contentType = getContentType(filename)
761
762
  if (!ALLOWED_TYPES.includes(contentType)) {
762
- throw new Error("File type not allowed");
763
+ throw new Error('File type not allowed')
763
764
  }
764
765
 
765
766
  // Upload
@@ -770,45 +771,42 @@ export const uploadWithValidation = async (
770
771
  index: true,
771
772
  tags: {
772
773
  originalName: filename,
773
- uploadedAt: new Date().toISOString()
774
- }
775
- });
774
+ uploadedAt: new Date().toISOString(),
775
+ },
776
+ })
776
777
 
777
- return file;
778
- };
778
+ return file
779
+ }
779
780
  ```
780
781
 
781
782
  ### Search with Context
782
783
 
783
784
  ```typescript
784
- export const searchWithContext = async (
785
- query: string,
786
- category?: string
787
- ) => {
788
- const client = context.get("client");
785
+ export const searchWithContext = async (query: string, category?: string) => {
786
+ const client = context.get('client')
789
787
 
790
788
  const { passages } = await client.searchFiles({
791
789
  query,
792
790
  tags: category ? { category } : undefined,
793
791
  contextDepth: 2,
794
792
  includeBreadcrumb: true,
795
- limit: 5
796
- });
793
+ limit: 5,
794
+ })
797
795
 
798
- return passages.map(p => ({
796
+ return passages.map((p) => ({
799
797
  content: p.content,
800
798
  source: p.file.key,
801
799
  relevance: p.score,
802
- location: `Page ${p.meta.pageNumber || "N/A"}`
803
- }));
804
- };
800
+ location: `Page ${p.meta.pageNumber || 'N/A'}`,
801
+ }))
802
+ }
805
803
  ```
806
804
 
807
805
  ### Bulk File Operations
808
806
 
809
807
  ```typescript
810
808
  export const bulkUpload = async (files: FileData[]) => {
811
- const client = context.get("client");
809
+ const client = context.get('client')
812
810
 
813
811
  const results = await Promise.allSettled(
814
812
  files.map(async (fileData) => {
@@ -816,23 +814,19 @@ export const bulkUpload = async (files: FileData[]) => {
816
814
  key: fileData.key,
817
815
  content: fileData.content,
818
816
  contentType: fileData.contentType,
819
- index: true
820
- });
817
+ index: true,
818
+ })
821
819
 
822
- return file;
820
+ return file
823
821
  })
824
- );
822
+ )
825
823
 
826
- const successful = results
827
- .filter(r => r.status === "fulfilled")
828
- .map(r => r.value);
824
+ const successful = results.filter((r) => r.status === 'fulfilled').map((r) => r.value)
829
825
 
830
- const failed = results
831
- .filter(r => r.status === "rejected")
832
- .map(r => r.reason);
826
+ const failed = results.filter((r) => r.status === 'rejected').map((r) => r.reason)
833
827
 
834
- return { successful, failed };
835
- };
828
+ return { successful, failed }
829
+ }
836
830
  ```
837
831
 
838
832
  ## Troubleshooting
@@ -883,18 +877,18 @@ The current Files API uses direct content upload:
883
877
  ```typescript
884
878
  // ✅ CURRENT - Direct content parameter
885
879
  await client.uploadFile({
886
- key: "unique-key",
887
- content: fileBuffer, // Direct upload
888
- contentType: "application/pdf",
889
- tags: { category: "docs" }
890
- });
880
+ key: 'unique-key',
881
+ content: fileBuffer, // Direct upload
882
+ contentType: 'application/pdf',
883
+ tags: { category: 'docs' },
884
+ })
891
885
 
892
886
  // Alternative: Upload from URL
893
887
  await client.uploadFile({
894
- key: "unique-key",
895
- url: "https://example.com/file.pdf", // Fetch from URL
896
- tags: { category: "docs" }
897
- });
888
+ key: 'unique-key',
889
+ url: 'https://example.com/file.pdf', // Fetch from URL
890
+ tags: { category: 'docs' },
891
+ })
898
892
  ```
899
893
 
900
894
  ### Retrieving File Content
@@ -902,17 +896,18 @@ await client.uploadFile({
902
896
  Files are accessed via their URL:
903
897
 
904
898
  ```typescript
905
- const { file } = await client.getFile({ id: fileId });
899
+ const { file } = await client.getFile({ id: fileId })
906
900
 
907
901
  // Fetch file content
908
- const response = await fetch(file.url);
909
- const content = await response.arrayBuffer();
902
+ const response = await fetch(file.url)
903
+ const content = await response.arrayBuffer()
910
904
 
911
905
  // For text/JSON
912
- const text = await response.text();
913
- const json = await response.json();
906
+ const text = await response.text()
907
+ const json = await response.json()
914
908
  ```
915
909
 
916
910
  **URL Types:**
911
+
917
912
  - **Public files** (`public_content` policy): Permanent CDN URL
918
913
  - **Private files**: Temporary presigned URL (use shortly after retrieval)