@hailer/mcp 0.0.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.
- package/.claude/commands/tool-builder.md +37 -0
- package/.claude/commands/ws-pull.md +44 -0
- package/.claude/settings.json +8 -0
- package/.claude/settings.local.json +49 -0
- package/.claude/skills/activity-api/SKILL.md +96 -0
- package/.claude/skills/activity-api/references/activity-endpoints.md +845 -0
- package/.claude/skills/add-app-member-skill/SKILL.md +977 -0
- package/.claude/skills/agent-building/SKILL.md +243 -0
- package/.claude/skills/agent-building/references/architecture-patterns.md +446 -0
- package/.claude/skills/agent-building/references/code-examples.md +587 -0
- package/.claude/skills/agent-building/references/implementation-guide.md +619 -0
- package/.claude/skills/app-api/SKILL.md +219 -0
- package/.claude/skills/app-api/references/app-endpoints.md +759 -0
- package/.claude/skills/building-hailer-apps-skill/SKILL.md +548 -0
- package/.claude/skills/create-app-skill/SKILL.md +1101 -0
- package/.claude/skills/create-insight-skill/SKILL.md +1317 -0
- package/.claude/skills/get-insight-data-skill/SKILL.md +1053 -0
- package/.claude/skills/hailer-api/SKILL.md +283 -0
- package/.claude/skills/hailer-api/references/activities.md +620 -0
- package/.claude/skills/hailer-api/references/authentication.md +216 -0
- package/.claude/skills/hailer-api/references/datasets.md +437 -0
- package/.claude/skills/hailer-api/references/files.md +301 -0
- package/.claude/skills/hailer-api/references/insights.md +469 -0
- package/.claude/skills/hailer-api/references/workflows.md +720 -0
- package/.claude/skills/hailer-api/references/workspaces-users.md +445 -0
- package/.claude/skills/insight-api/SKILL.md +185 -0
- package/.claude/skills/insight-api/references/insight-endpoints.md +514 -0
- package/.claude/skills/install-workflow-skill/SKILL.md +1056 -0
- package/.claude/skills/list-apps-skill/SKILL.md +1010 -0
- package/.claude/skills/list-workflows-minimal-skill/SKILL.md +992 -0
- package/.claude/skills/local-first-skill/SKILL.md +570 -0
- package/.claude/skills/mcp-tools/SKILL.md +419 -0
- package/.claude/skills/mcp-tools/references/api-endpoints.md +499 -0
- package/.claude/skills/mcp-tools/references/data-structures.md +554 -0
- package/.claude/skills/mcp-tools/references/implementation-patterns.md +717 -0
- package/.claude/skills/preview-insight-skill/SKILL.md +1290 -0
- package/.claude/skills/publish-hailer-app-skill/SKILL.md +453 -0
- package/.claude/skills/remove-app-member-skill/SKILL.md +671 -0
- package/.claude/skills/remove-app-skill/SKILL.md +985 -0
- package/.claude/skills/remove-insight-skill/SKILL.md +1011 -0
- package/.claude/skills/remove-workflow-skill/SKILL.md +920 -0
- package/.claude/skills/scaffold-hailer-app-skill/SKILL.md +1034 -0
- package/.claude/skills/skill-testing/README.md +137 -0
- package/.claude/skills/skill-testing/SKILL.md +348 -0
- package/.claude/skills/skill-testing/references/test-patterns.md +705 -0
- package/.claude/skills/skill-testing/references/testing-guide.md +603 -0
- package/.claude/skills/skill-testing/references/validation-checklist.md +537 -0
- package/.claude/skills/tool-builder/SKILL.md +328 -0
- package/.claude/skills/update-app-skill/SKILL.md +970 -0
- package/.claude/skills/update-workflow-field-skill/SKILL.md +1098 -0
- package/.env.example +81 -0
- package/.mcp.json +13 -0
- package/README.md +297 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +74 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +5 -0
- package/dist/client/adaptive-documentation-bot.d.ts +108 -0
- package/dist/client/adaptive-documentation-bot.js +475 -0
- package/dist/client/adaptive-documentation-types.d.ts +66 -0
- package/dist/client/adaptive-documentation-types.js +9 -0
- package/dist/client/agent-activity-bot.d.ts +51 -0
- package/dist/client/agent-activity-bot.js +166 -0
- package/dist/client/agent-tracker.d.ts +499 -0
- package/dist/client/agent-tracker.js +659 -0
- package/dist/client/description-updater.d.ts +56 -0
- package/dist/client/description-updater.js +259 -0
- package/dist/client/log-parser.d.ts +72 -0
- package/dist/client/log-parser.js +387 -0
- package/dist/client/mcp-client.d.ts +50 -0
- package/dist/client/mcp-client.js +532 -0
- package/dist/client/message-processor.d.ts +35 -0
- package/dist/client/message-processor.js +352 -0
- package/dist/client/multi-bot-manager.d.ts +24 -0
- package/dist/client/multi-bot-manager.js +74 -0
- package/dist/client/providers/anthropic-provider.d.ts +19 -0
- package/dist/client/providers/anthropic-provider.js +631 -0
- package/dist/client/providers/llm-provider.d.ts +47 -0
- package/dist/client/providers/llm-provider.js +367 -0
- package/dist/client/providers/openai-provider.d.ts +23 -0
- package/dist/client/providers/openai-provider.js +621 -0
- package/dist/client/simple-llm-caller.d.ts +19 -0
- package/dist/client/simple-llm-caller.js +100 -0
- package/dist/client/skill-generator.d.ts +81 -0
- package/dist/client/skill-generator.js +386 -0
- package/dist/client/test-adaptive-bot.d.ts +9 -0
- package/dist/client/test-adaptive-bot.js +82 -0
- package/dist/client/token-pricing.d.ts +38 -0
- package/dist/client/token-pricing.js +127 -0
- package/dist/client/token-tracker.d.ts +232 -0
- package/dist/client/token-tracker.js +457 -0
- package/dist/client/token-usage-bot.d.ts +53 -0
- package/dist/client/token-usage-bot.js +153 -0
- package/dist/client/tool-executor.d.ts +69 -0
- package/dist/client/tool-executor.js +159 -0
- package/dist/client/tool-schema-loader.d.ts +60 -0
- package/dist/client/tool-schema-loader.js +178 -0
- package/dist/client/types.d.ts +69 -0
- package/dist/client/types.js +7 -0
- package/dist/config.d.ts +162 -0
- package/dist/config.js +296 -0
- package/dist/core.d.ts +26 -0
- package/dist/core.js +147 -0
- package/dist/lib/context-manager.d.ts +111 -0
- package/dist/lib/context-manager.js +431 -0
- package/dist/lib/logger.d.ts +74 -0
- package/dist/lib/logger.js +277 -0
- package/dist/lib/materialize.d.ts +3 -0
- package/dist/lib/materialize.js +101 -0
- package/dist/lib/normalizedName.d.ts +7 -0
- package/dist/lib/normalizedName.js +48 -0
- package/dist/lib/prompt-length-manager.d.ts +81 -0
- package/dist/lib/prompt-length-manager.js +457 -0
- package/dist/lib/terminal-prompt.d.ts +9 -0
- package/dist/lib/terminal-prompt.js +108 -0
- package/dist/mcp/UserContextCache.d.ts +56 -0
- package/dist/mcp/UserContextCache.js +163 -0
- package/dist/mcp/auth.d.ts +2 -0
- package/dist/mcp/auth.js +29 -0
- package/dist/mcp/hailer-clients.d.ts +42 -0
- package/dist/mcp/hailer-clients.js +246 -0
- package/dist/mcp/signal-handler.d.ts +45 -0
- package/dist/mcp/signal-handler.js +317 -0
- package/dist/mcp/tool-registry.d.ts +100 -0
- package/dist/mcp/tool-registry.js +306 -0
- package/dist/mcp/tools/activity.d.ts +15 -0
- package/dist/mcp/tools/activity.js +955 -0
- package/dist/mcp/tools/app.d.ts +20 -0
- package/dist/mcp/tools/app.js +1488 -0
- package/dist/mcp/tools/discussion.d.ts +19 -0
- package/dist/mcp/tools/discussion.js +950 -0
- package/dist/mcp/tools/file.d.ts +15 -0
- package/dist/mcp/tools/file.js +119 -0
- package/dist/mcp/tools/insight.d.ts +17 -0
- package/dist/mcp/tools/insight.js +806 -0
- package/dist/mcp/tools/skill.d.ts +10 -0
- package/dist/mcp/tools/skill.js +279 -0
- package/dist/mcp/tools/user.d.ts +10 -0
- package/dist/mcp/tools/user.js +108 -0
- package/dist/mcp/tools/workflow-template.d.ts +19 -0
- package/dist/mcp/tools/workflow-template.js +822 -0
- package/dist/mcp/tools/workflow.d.ts +18 -0
- package/dist/mcp/tools/workflow.js +1362 -0
- package/dist/mcp/utils/api-errors.d.ts +45 -0
- package/dist/mcp/utils/api-errors.js +160 -0
- package/dist/mcp/utils/data-transformers.d.ts +102 -0
- package/dist/mcp/utils/data-transformers.js +194 -0
- package/dist/mcp/utils/file-upload.d.ts +33 -0
- package/dist/mcp/utils/file-upload.js +148 -0
- package/dist/mcp/utils/hailer-api-client.d.ts +120 -0
- package/dist/mcp/utils/hailer-api-client.js +323 -0
- package/dist/mcp/utils/index.d.ts +13 -0
- package/dist/mcp/utils/index.js +39 -0
- package/dist/mcp/utils/logger.d.ts +42 -0
- package/dist/mcp/utils/logger.js +103 -0
- package/dist/mcp/utils/types.d.ts +286 -0
- package/dist/mcp/utils/types.js +7 -0
- package/dist/mcp/workspace-cache.d.ts +42 -0
- package/dist/mcp/workspace-cache.js +97 -0
- package/dist/mcp-server.d.ts +42 -0
- package/dist/mcp-server.js +280 -0
- package/package.json +56 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# Hailer Files API
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Hailer's Files API allows uploading, downloading, and managing files attached to activities, workspaces, and datasets.
|
|
6
|
+
|
|
7
|
+
## Endpoints
|
|
8
|
+
|
|
9
|
+
### Upload File
|
|
10
|
+
|
|
11
|
+
```http
|
|
12
|
+
POST /v3/files
|
|
13
|
+
Content-Type: multipart/form-data
|
|
14
|
+
|
|
15
|
+
file: (binary)
|
|
16
|
+
activity_id: 123 (optional)
|
|
17
|
+
workspace_id: ws_456 (optional)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Python Example:**
|
|
21
|
+
```python
|
|
22
|
+
with open('document.pdf', 'rb') as f:
|
|
23
|
+
response = requests.post(
|
|
24
|
+
'https://api.hailer.local.gd/v3/files',
|
|
25
|
+
headers={'Authorization': f'Bearer {token}'},
|
|
26
|
+
files={'file': f},
|
|
27
|
+
data={'activity_id': '123'}
|
|
28
|
+
)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Response:**
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"id": "file_789",
|
|
35
|
+
"filename": "document.pdf",
|
|
36
|
+
"size": 524288,
|
|
37
|
+
"mime_type": "application/pdf",
|
|
38
|
+
"url": "https://files.hailer.com/file_789",
|
|
39
|
+
"thumbnail_url": "https://files.hailer.com/file_789/thumb",
|
|
40
|
+
"created_at": "2025-01-15T10:30:00Z"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Get File Metadata
|
|
45
|
+
|
|
46
|
+
```http
|
|
47
|
+
GET /v3/files/{file_id}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Response:**
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"id": "file_789",
|
|
54
|
+
"filename": "document.pdf",
|
|
55
|
+
"size": 524288,
|
|
56
|
+
"mime_type": "application/pdf",
|
|
57
|
+
"url": "https://files.hailer.com/file_789",
|
|
58
|
+
"created_at": "2025-01-15T10:30:00Z",
|
|
59
|
+
"created_by": {
|
|
60
|
+
"id": "user_123",
|
|
61
|
+
"name": "Johan Rekna"
|
|
62
|
+
},
|
|
63
|
+
"activity_id": "act_456",
|
|
64
|
+
"workspace_id": "ws_789"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Download File
|
|
69
|
+
|
|
70
|
+
```http
|
|
71
|
+
GET /v3/files/{file_id}/download
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Returns file binary with appropriate Content-Type header.
|
|
75
|
+
|
|
76
|
+
**Python Example:**
|
|
77
|
+
```python
|
|
78
|
+
response = requests.get(
|
|
79
|
+
f'https://api.hailer.local.gd/v3/files/{file_id}/download',
|
|
80
|
+
headers={'Authorization': f'Bearer {token}'},
|
|
81
|
+
stream=True
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
with open('downloaded_file.pdf', 'wb') as f:
|
|
85
|
+
for chunk in response.iter_content(chunk_size=8192):
|
|
86
|
+
f.write(chunk)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Delete File
|
|
90
|
+
|
|
91
|
+
```http
|
|
92
|
+
DELETE /v3/files/{file_id}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Response:** `204 No Content`
|
|
96
|
+
|
|
97
|
+
### List Files
|
|
98
|
+
|
|
99
|
+
```http
|
|
100
|
+
GET /v3/files?activity_id=123
|
|
101
|
+
GET /v3/files?workspace_id=ws_456
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Query Parameters:**
|
|
105
|
+
- `activity_id` - Filter by activity
|
|
106
|
+
- `workspace_id` - Filter by workspace
|
|
107
|
+
- `created_after` - ISO 8601 timestamp
|
|
108
|
+
- `created_before` - ISO 8601 timestamp
|
|
109
|
+
- `mime_type` - Filter by MIME type
|
|
110
|
+
- `page` - Page number
|
|
111
|
+
- `per_page` - Items per page (max 100)
|
|
112
|
+
|
|
113
|
+
**Response:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"data": [
|
|
117
|
+
{
|
|
118
|
+
"id": "file_789",
|
|
119
|
+
"filename": "document.pdf",
|
|
120
|
+
"size": 524288,
|
|
121
|
+
"mime_type": "application/pdf",
|
|
122
|
+
"url": "https://files.hailer.com/file_789",
|
|
123
|
+
"created_at": "2025-01-15T10:30:00Z"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"meta": {
|
|
127
|
+
"page": 1,
|
|
128
|
+
"per_page": 50,
|
|
129
|
+
"total": 15
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Update File Metadata
|
|
135
|
+
|
|
136
|
+
```http
|
|
137
|
+
PATCH /v3/files/{file_id}
|
|
138
|
+
Content-Type: application/json
|
|
139
|
+
|
|
140
|
+
{
|
|
141
|
+
"filename": "renamed_document.pdf"
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Supported MIME Types
|
|
146
|
+
|
|
147
|
+
### Documents
|
|
148
|
+
- `application/pdf` - PDF documents
|
|
149
|
+
- `application/msword` - Word (.doc)
|
|
150
|
+
- `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - Word (.docx)
|
|
151
|
+
- `application/vnd.ms-excel` - Excel (.xls)
|
|
152
|
+
- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` - Excel (.xlsx)
|
|
153
|
+
- `text/plain` - Text files
|
|
154
|
+
- `text/csv` - CSV files
|
|
155
|
+
|
|
156
|
+
### Images
|
|
157
|
+
- `image/jpeg` - JPEG images
|
|
158
|
+
- `image/png` - PNG images
|
|
159
|
+
- `image/gif` - GIF images
|
|
160
|
+
- `image/svg+xml` - SVG images
|
|
161
|
+
- `image/webp` - WebP images
|
|
162
|
+
|
|
163
|
+
### Archives
|
|
164
|
+
- `application/zip` - ZIP archives
|
|
165
|
+
- `application/x-rar-compressed` - RAR archives
|
|
166
|
+
|
|
167
|
+
### Other
|
|
168
|
+
- `application/json` - JSON files
|
|
169
|
+
- `application/xml` - XML files
|
|
170
|
+
|
|
171
|
+
## File Size Limits
|
|
172
|
+
|
|
173
|
+
- Maximum file size: 100 MB per file
|
|
174
|
+
- Maximum total storage: Depends on workspace plan
|
|
175
|
+
- Thumbnail generation: Automatic for images and PDFs
|
|
176
|
+
|
|
177
|
+
## Thumbnails
|
|
178
|
+
|
|
179
|
+
Hailer automatically generates thumbnails for:
|
|
180
|
+
- Images (JPEG, PNG, GIF, WebP)
|
|
181
|
+
- PDF documents (first page)
|
|
182
|
+
|
|
183
|
+
Access thumbnails:
|
|
184
|
+
```http
|
|
185
|
+
GET /v3/files/{file_id}/thumbnail?size=small
|
|
186
|
+
GET /v3/files/{file_id}/thumbnail?size=medium
|
|
187
|
+
GET /v3/files/{file_id}/thumbnail?size=large
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Sizes:
|
|
191
|
+
- `small` - 150x150px
|
|
192
|
+
- `medium` - 300x300px
|
|
193
|
+
- `large` - 600x600px
|
|
194
|
+
|
|
195
|
+
## Batch Upload
|
|
196
|
+
|
|
197
|
+
```http
|
|
198
|
+
POST /v3/files/batch
|
|
199
|
+
Content-Type: multipart/form-data
|
|
200
|
+
|
|
201
|
+
files[]: (binary) multiple files
|
|
202
|
+
activity_id: 123
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Response:**
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"files": [
|
|
209
|
+
{
|
|
210
|
+
"id": "file_789",
|
|
211
|
+
"filename": "doc1.pdf",
|
|
212
|
+
"success": true
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"filename": "doc2.pdf",
|
|
216
|
+
"success": false,
|
|
217
|
+
"error": "File too large"
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## File Sharing
|
|
224
|
+
|
|
225
|
+
### Generate Public Link
|
|
226
|
+
|
|
227
|
+
```http
|
|
228
|
+
POST /v3/files/{file_id}/share
|
|
229
|
+
Content-Type: application/json
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
"expires_at": "2025-12-31T23:59:59Z",
|
|
233
|
+
"password": "optional_password"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Response:**
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"share_url": "https://share.hailer.com/abc123def456",
|
|
241
|
+
"expires_at": "2025-12-31T23:59:59Z"
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Revoke Public Link
|
|
246
|
+
|
|
247
|
+
```http
|
|
248
|
+
DELETE /v3/files/{file_id}/share
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## File Permissions
|
|
252
|
+
|
|
253
|
+
Files inherit permissions from their parent:
|
|
254
|
+
- Activity files: Same permissions as activity
|
|
255
|
+
- Workspace files: Same permissions as workspace
|
|
256
|
+
|
|
257
|
+
Check file access:
|
|
258
|
+
```http
|
|
259
|
+
GET /v3/files/{file_id}/permissions
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Advanced: Direct Upload to S3
|
|
263
|
+
|
|
264
|
+
For large files, use pre-signed S3 URLs:
|
|
265
|
+
|
|
266
|
+
1. Request upload URL:
|
|
267
|
+
```http
|
|
268
|
+
POST /v3/files/upload-url
|
|
269
|
+
{
|
|
270
|
+
"filename": "large_video.mp4",
|
|
271
|
+
"size": 52428800,
|
|
272
|
+
"mime_type": "video/mp4"
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
2. Upload directly to S3:
|
|
277
|
+
```python
|
|
278
|
+
response = requests.put(
|
|
279
|
+
presigned_url,
|
|
280
|
+
data=open('large_video.mp4', 'rb'),
|
|
281
|
+
headers={'Content-Type': 'video/mp4'}
|
|
282
|
+
)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
3. Confirm upload:
|
|
286
|
+
```http
|
|
287
|
+
POST /v3/files/confirm
|
|
288
|
+
{
|
|
289
|
+
"upload_id": "upload_123",
|
|
290
|
+
"activity_id": "act_456"
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Best Practices
|
|
295
|
+
|
|
296
|
+
1. **Use streaming for large files** - Don't load entire file into memory
|
|
297
|
+
2. **Check file size before upload** - Validate against 100MB limit
|
|
298
|
+
3. **Set appropriate MIME types** - For proper file handling
|
|
299
|
+
4. **Use batch upload for multiple files** - More efficient than individual uploads
|
|
300
|
+
5. **Clean up temporary files** - Delete files when no longer needed
|
|
301
|
+
6. **Use thumbnails for previews** - Don't download full images for UI previews
|