@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,445 @@
|
|
|
1
|
+
# Hailer Workspaces & Users API
|
|
2
|
+
|
|
3
|
+
## Workspaces
|
|
4
|
+
|
|
5
|
+
Workspaces are top-level organizational units containing activities, datasets, files, and users.
|
|
6
|
+
|
|
7
|
+
### Get Workspace
|
|
8
|
+
|
|
9
|
+
```http
|
|
10
|
+
GET /v3/workspaces/{workspace_id}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Response:**
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"id": "ws_123",
|
|
17
|
+
"name": "Rekna Production",
|
|
18
|
+
"description": "Main workspace for Rekna operations",
|
|
19
|
+
"created_at": "2024-01-01T00:00:00Z",
|
|
20
|
+
"settings": {
|
|
21
|
+
"timezone": "Europe/Helsinki",
|
|
22
|
+
"language": "fi",
|
|
23
|
+
"date_format": "DD.MM.YYYY"
|
|
24
|
+
},
|
|
25
|
+
"member_count": 25,
|
|
26
|
+
"activity_count": 1523
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### List Workspaces
|
|
31
|
+
|
|
32
|
+
```http
|
|
33
|
+
GET /v3/workspaces
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Returns all workspaces the authenticated user has access to.
|
|
37
|
+
|
|
38
|
+
### Create Workspace
|
|
39
|
+
|
|
40
|
+
```http
|
|
41
|
+
POST /v3/workspaces
|
|
42
|
+
Content-Type: application/json
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
"name": "New Project Workspace",
|
|
46
|
+
"description": "Workspace for new project",
|
|
47
|
+
"settings": {
|
|
48
|
+
"timezone": "Europe/Helsinki",
|
|
49
|
+
"language": "fi"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Update Workspace
|
|
55
|
+
|
|
56
|
+
```http
|
|
57
|
+
PATCH /v3/workspaces/{workspace_id}
|
|
58
|
+
Content-Type: application/json
|
|
59
|
+
|
|
60
|
+
{
|
|
61
|
+
"name": "Updated Workspace Name",
|
|
62
|
+
"description": "New description"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Delete Workspace
|
|
67
|
+
|
|
68
|
+
```http
|
|
69
|
+
DELETE /v3/workspaces/{workspace_id}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
⚠️ **Warning:** Deletes all activities, datasets, files, and content within the workspace.
|
|
73
|
+
|
|
74
|
+
## Workspace Settings
|
|
75
|
+
|
|
76
|
+
### Update Settings
|
|
77
|
+
|
|
78
|
+
```http
|
|
79
|
+
PATCH /v3/workspaces/{workspace_id}/settings
|
|
80
|
+
Content-Type: application/json
|
|
81
|
+
|
|
82
|
+
{
|
|
83
|
+
"timezone": "Europe/Helsinki",
|
|
84
|
+
"language": "fi",
|
|
85
|
+
"date_format": "DD.MM.YYYY",
|
|
86
|
+
"time_format": "24h",
|
|
87
|
+
"first_day_of_week": 1,
|
|
88
|
+
"working_hours": {
|
|
89
|
+
"start": "08:00",
|
|
90
|
+
"end": "17:00"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Users
|
|
96
|
+
|
|
97
|
+
### Get User Profile
|
|
98
|
+
|
|
99
|
+
```http
|
|
100
|
+
GET /v3/users/me
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Response:**
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"id": "user_123",
|
|
107
|
+
"name": "Johan Rekna",
|
|
108
|
+
"email": "johan@rekna.fi",
|
|
109
|
+
"avatar_url": "https://avatars.hailer.com/user_123",
|
|
110
|
+
"timezone": "Europe/Helsinki",
|
|
111
|
+
"language": "fi",
|
|
112
|
+
"created_at": "2023-01-01T00:00:00Z"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Update User Profile
|
|
117
|
+
|
|
118
|
+
```http
|
|
119
|
+
PATCH /v3/users/me
|
|
120
|
+
Content-Type: application/json
|
|
121
|
+
|
|
122
|
+
{
|
|
123
|
+
"name": "Johan Rekna",
|
|
124
|
+
"timezone": "Europe/Helsinki",
|
|
125
|
+
"language": "fi"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Get User by ID
|
|
130
|
+
|
|
131
|
+
```http
|
|
132
|
+
GET /v3/users/{user_id}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### List Users in Workspace
|
|
136
|
+
|
|
137
|
+
```http
|
|
138
|
+
GET /v3/workspaces/{workspace_id}/users
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Response:**
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"data": [
|
|
145
|
+
{
|
|
146
|
+
"id": "user_123",
|
|
147
|
+
"name": "Johan Rekna",
|
|
148
|
+
"email": "johan@rekna.fi",
|
|
149
|
+
"role": "admin",
|
|
150
|
+
"joined_at": "2023-01-01T00:00:00Z"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Workspace Members
|
|
157
|
+
|
|
158
|
+
### Add Member to Workspace
|
|
159
|
+
|
|
160
|
+
```http
|
|
161
|
+
POST /v3/workspaces/{workspace_id}/members
|
|
162
|
+
Content-Type: application/json
|
|
163
|
+
|
|
164
|
+
{
|
|
165
|
+
"email": "newuser@company.com",
|
|
166
|
+
"role": "member",
|
|
167
|
+
"send_invitation": true
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Roles:**
|
|
172
|
+
- `admin` - Full workspace control
|
|
173
|
+
- `member` - Standard access
|
|
174
|
+
- `guest` - Limited access (read-only to assigned activities)
|
|
175
|
+
|
|
176
|
+
### Update Member Role
|
|
177
|
+
|
|
178
|
+
```http
|
|
179
|
+
PATCH /v3/workspaces/{workspace_id}/members/{user_id}
|
|
180
|
+
Content-Type: application/json
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
"role": "admin"
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Remove Member
|
|
188
|
+
|
|
189
|
+
```http
|
|
190
|
+
DELETE /v3/workspaces/{workspace_id}/members/{user_id}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Permissions System
|
|
194
|
+
|
|
195
|
+
### Permission Levels
|
|
196
|
+
|
|
197
|
+
Hailer uses role-based and object-based permissions:
|
|
198
|
+
|
|
199
|
+
**Workspace Level:**
|
|
200
|
+
- `admin` - Full control
|
|
201
|
+
- `member` - Standard access
|
|
202
|
+
- `guest` - Limited access
|
|
203
|
+
|
|
204
|
+
**Activity Level:**
|
|
205
|
+
- `owner` - Created the activity
|
|
206
|
+
- `assigned` - Assigned to activity
|
|
207
|
+
- `follower` - Following activity
|
|
208
|
+
- `workspace_member` - Has workspace access
|
|
209
|
+
|
|
210
|
+
**Dataset Level:**
|
|
211
|
+
- `admin` - Full control
|
|
212
|
+
- `editor` - Can modify records
|
|
213
|
+
- `viewer` - Read-only
|
|
214
|
+
|
|
215
|
+
### Check Permissions
|
|
216
|
+
|
|
217
|
+
```http
|
|
218
|
+
GET /v3/activities/{activity_id}/permissions/me
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Response:**
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"can_read": true,
|
|
225
|
+
"can_update": true,
|
|
226
|
+
"can_delete": false,
|
|
227
|
+
"can_assign": true,
|
|
228
|
+
"can_comment": true
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### List Activity Permissions
|
|
233
|
+
|
|
234
|
+
```http
|
|
235
|
+
GET /v3/activities/{activity_id}/permissions
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Response:**
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"data": [
|
|
242
|
+
{
|
|
243
|
+
"user_id": "user_123",
|
|
244
|
+
"name": "Johan Rekna",
|
|
245
|
+
"role": "owner",
|
|
246
|
+
"permissions": ["read", "update", "delete", "assign"]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"user_id": "user_456",
|
|
250
|
+
"name": "Team Member",
|
|
251
|
+
"role": "assigned",
|
|
252
|
+
"permissions": ["read", "update", "comment"]
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Set Activity Permissions
|
|
259
|
+
|
|
260
|
+
```http
|
|
261
|
+
POST /v3/activities/{activity_id}/permissions
|
|
262
|
+
Content-Type: application/json
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
"user_id": "user_456",
|
|
266
|
+
"role": "assigned"
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Grant Workspace-Wide Permissions
|
|
271
|
+
|
|
272
|
+
```http
|
|
273
|
+
POST /v3/workspaces/{workspace_id}/permissions
|
|
274
|
+
Content-Type: application/json
|
|
275
|
+
|
|
276
|
+
{
|
|
277
|
+
"user_id": "user_456",
|
|
278
|
+
"permissions": {
|
|
279
|
+
"can_create_activities": true,
|
|
280
|
+
"can_create_datasets": false,
|
|
281
|
+
"can_manage_workflows": false
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Teams
|
|
287
|
+
|
|
288
|
+
Groups of users within a workspace.
|
|
289
|
+
|
|
290
|
+
### Create Team
|
|
291
|
+
|
|
292
|
+
```http
|
|
293
|
+
POST /v3/workspaces/{workspace_id}/teams
|
|
294
|
+
Content-Type: application/json
|
|
295
|
+
|
|
296
|
+
{
|
|
297
|
+
"name": "Development Team",
|
|
298
|
+
"description": "Software development team",
|
|
299
|
+
"member_ids": ["user_123", "user_456"]
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Add Users to Team
|
|
304
|
+
|
|
305
|
+
```http
|
|
306
|
+
POST /v3/teams/{team_id}/members
|
|
307
|
+
Content-Type: application/json
|
|
308
|
+
|
|
309
|
+
{
|
|
310
|
+
"user_ids": ["user_789"]
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Assign Team to Activity
|
|
315
|
+
|
|
316
|
+
```http
|
|
317
|
+
POST /v3/activities/{activity_id}/assignments
|
|
318
|
+
Content-Type: application/json
|
|
319
|
+
|
|
320
|
+
{
|
|
321
|
+
"team_id": "team_123"
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## API Keys
|
|
326
|
+
|
|
327
|
+
Create API keys for programmatic access:
|
|
328
|
+
|
|
329
|
+
### Create API Key
|
|
330
|
+
|
|
331
|
+
```http
|
|
332
|
+
POST /v3/api-keys
|
|
333
|
+
Content-Type: application/json
|
|
334
|
+
|
|
335
|
+
{
|
|
336
|
+
"name": "Automation Script",
|
|
337
|
+
"workspace_id": "ws_123",
|
|
338
|
+
"scopes": ["activities:read", "activities:write", "datasets:read"],
|
|
339
|
+
"expires_at": "2026-12-31T23:59:59Z"
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Response:**
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"id": "key_789",
|
|
347
|
+
"name": "Automation Script",
|
|
348
|
+
"key": "hsk_abc123def456...",
|
|
349
|
+
"scopes": ["activities:read", "activities:write", "datasets:read"],
|
|
350
|
+
"created_at": "2025-01-15T10:30:00Z",
|
|
351
|
+
"expires_at": "2026-12-31T23:59:59Z"
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
⚠️ **Warning:** API key is only shown once. Store it securely.
|
|
356
|
+
|
|
357
|
+
### List API Keys
|
|
358
|
+
|
|
359
|
+
```http
|
|
360
|
+
GET /v3/api-keys
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Revoke API Key
|
|
364
|
+
|
|
365
|
+
```http
|
|
366
|
+
DELETE /v3/api-keys/{key_id}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Available Scopes
|
|
370
|
+
|
|
371
|
+
### Activity Scopes
|
|
372
|
+
- `activities:read` - Read activities
|
|
373
|
+
- `activities:write` - Create/update activities
|
|
374
|
+
- `activities:delete` - Delete activities
|
|
375
|
+
|
|
376
|
+
### Dataset Scopes
|
|
377
|
+
- `datasets:read` - Read datasets and records
|
|
378
|
+
- `datasets:write` - Create/update datasets and records
|
|
379
|
+
- `datasets:delete` - Delete datasets and records
|
|
380
|
+
|
|
381
|
+
### File Scopes
|
|
382
|
+
- `files:read` - Read files
|
|
383
|
+
- `files:write` - Upload files
|
|
384
|
+
- `files:delete` - Delete files
|
|
385
|
+
|
|
386
|
+
### Workspace Scopes
|
|
387
|
+
- `workspaces:read` - Read workspace information
|
|
388
|
+
- `workspaces:write` - Update workspace settings
|
|
389
|
+
- `workspaces:admin` - Full workspace administration
|
|
390
|
+
|
|
391
|
+
### User Scopes
|
|
392
|
+
- `users:read` - Read user information
|
|
393
|
+
- `users:write` - Update user profiles
|
|
394
|
+
|
|
395
|
+
## Audit Logs
|
|
396
|
+
|
|
397
|
+
Track actions within workspace:
|
|
398
|
+
|
|
399
|
+
### List Audit Logs
|
|
400
|
+
|
|
401
|
+
```http
|
|
402
|
+
GET /v3/workspaces/{workspace_id}/audit-logs
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Query Parameters:**
|
|
406
|
+
- `user_id` - Filter by user
|
|
407
|
+
- `action` - Filter by action type
|
|
408
|
+
- `resource_type` - Filter by resource (activity, dataset, etc.)
|
|
409
|
+
- `start_date` - ISO 8601 timestamp
|
|
410
|
+
- `end_date` - ISO 8601 timestamp
|
|
411
|
+
|
|
412
|
+
**Response:**
|
|
413
|
+
```json
|
|
414
|
+
{
|
|
415
|
+
"data": [
|
|
416
|
+
{
|
|
417
|
+
"id": "log_123",
|
|
418
|
+
"action": "activity.created",
|
|
419
|
+
"user": {
|
|
420
|
+
"id": "user_123",
|
|
421
|
+
"name": "Johan Rekna"
|
|
422
|
+
},
|
|
423
|
+
"resource": {
|
|
424
|
+
"type": "activity",
|
|
425
|
+
"id": "act_456"
|
|
426
|
+
},
|
|
427
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
428
|
+
"metadata": {
|
|
429
|
+
"ip_address": "192.168.1.1",
|
|
430
|
+
"user_agent": "Mozilla/5.0..."
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## Best Practices
|
|
438
|
+
|
|
439
|
+
1. **Use teams for group permissions** - Easier than managing individual user permissions
|
|
440
|
+
2. **Create API keys with minimal scopes** - Principle of least privilege
|
|
441
|
+
3. **Rotate API keys regularly** - Set expiration dates
|
|
442
|
+
4. **Monitor audit logs** - Track suspicious activity
|
|
443
|
+
5. **Remove inactive members** - Clean up workspace regularly
|
|
444
|
+
6. **Use guest role for external collaborators** - Limit access appropriately
|
|
445
|
+
7. **Check permissions before operations** - Avoid unnecessary API calls
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Insight API Reference
|
|
3
|
+
description: Complete reference for Hailer Insight API (SQL-like reporting over workflow data) - use when building insight-related MCP tools
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Insight API Reference Skill
|
|
7
|
+
|
|
8
|
+
This skill provides comprehensive documentation for Hailer Insight API endpoints. Insights are SQL-like reports that query activity data from workflows, with support for joins across multiple workflows.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
Invoke this skill when:
|
|
13
|
+
- Building insight/reporting MCP tools
|
|
14
|
+
- Creating SQL queries over workflow data
|
|
15
|
+
- Working with cross-workflow data analysis
|
|
16
|
+
- Implementing data visualization features
|
|
17
|
+
- Managing insight permissions and sharing
|
|
18
|
+
|
|
19
|
+
## What are Insights?
|
|
20
|
+
|
|
21
|
+
**Insights = SQL queries over Hailer workflow data**
|
|
22
|
+
|
|
23
|
+
Think of it as:
|
|
24
|
+
- **Workflows** = Database tables
|
|
25
|
+
- **Activities** = Rows in those tables
|
|
26
|
+
- **Fields** = Columns in those tables
|
|
27
|
+
- **Insights** = SQL SELECT queries with JOINs
|
|
28
|
+
|
|
29
|
+
## Quick Navigation
|
|
30
|
+
|
|
31
|
+
### Core Insight Operations
|
|
32
|
+
- **v3.insight.create** - Create new insight with SQL query
|
|
33
|
+
- **v3.insight.update** - Update existing insight
|
|
34
|
+
- **v3.insight.list** - List all insights in workspace
|
|
35
|
+
- **v3.insight.data** - Get query results (execute the SQL)
|
|
36
|
+
- **v3.insight.preview** - Preview insight while designing (debugging)
|
|
37
|
+
- **v3.insight.remove** - Delete an insight
|
|
38
|
+
|
|
39
|
+
### Insight Management
|
|
40
|
+
- **v3.insight.copy** - Duplicate an insight
|
|
41
|
+
- **v3.insight.public** - Get public insight data (shared insights)
|
|
42
|
+
- **v3.insight.member.add** - Add member permissions
|
|
43
|
+
- **v3.insight.member.remove** - Remove member permissions
|
|
44
|
+
|
|
45
|
+
## Key Concepts
|
|
46
|
+
|
|
47
|
+
### Insight Structure
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
{
|
|
51
|
+
name: 'Insight Name',
|
|
52
|
+
public: false, // Whether insight is publicly accessible
|
|
53
|
+
sources: [
|
|
54
|
+
{
|
|
55
|
+
name: 'books', // Table alias for SQL
|
|
56
|
+
workflowId: '<id>', // Which workflow to query
|
|
57
|
+
fields: [
|
|
58
|
+
{ name: 'title', meta: 'name' }, // Activity name
|
|
59
|
+
{ name: 'publishDate', fieldId: '<fieldId>' } // Custom field
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
query: 'SELECT title, publishDate FROM books' // Standard SQL
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Field References
|
|
68
|
+
|
|
69
|
+
**Meta fields** (built-in):
|
|
70
|
+
- `meta: '_id'` - Activity ID (for JOINs)
|
|
71
|
+
- `meta: 'uid'` - User ID (creator)
|
|
72
|
+
- `meta: 'team'` - Owner team ID
|
|
73
|
+
- `meta: 'createdBy'` - Creator user ID
|
|
74
|
+
- `meta: 'name'` - Activity name/title
|
|
75
|
+
- `meta: 'created'` - Creation timestamp
|
|
76
|
+
- `meta: 'updated'` - Last update timestamp
|
|
77
|
+
- `meta: 'phaseId'` - Current phase ID
|
|
78
|
+
- `meta: 'phaseName'` - Current phase name
|
|
79
|
+
- `meta: 'phaseLastMove'` - Last phase change timestamp
|
|
80
|
+
- `meta: 'workflowId'` - Workflow ID
|
|
81
|
+
- `meta: 'workflowName'` - Workflow name
|
|
82
|
+
- `meta: 'priority'` - Activity priority
|
|
83
|
+
|
|
84
|
+
**Custom fields**:
|
|
85
|
+
- `fieldId: '<fieldId>'` - Reference a workflow field by ID
|
|
86
|
+
|
|
87
|
+
### SQL Query Support
|
|
88
|
+
|
|
89
|
+
- Standard SELECT syntax
|
|
90
|
+
- JOINs across multiple workflows
|
|
91
|
+
- WHERE clauses
|
|
92
|
+
- GROUP BY, ORDER BY
|
|
93
|
+
- Aggregation functions (COUNT, SUM, AVG, etc.)
|
|
94
|
+
|
|
95
|
+
## Common Use Cases
|
|
96
|
+
|
|
97
|
+
1. **Single Workflow Report**: Query activities from one workflow
|
|
98
|
+
2. **Cross-Workflow Join**: Join data from related workflows (via ActivityLinks)
|
|
99
|
+
3. **Aggregated Reports**: COUNT, SUM, AVG across activities
|
|
100
|
+
4. **Filtered Views**: WHERE clauses to filter activity data
|
|
101
|
+
5. **Public Dashboards**: Share insights publicly with `public: true`
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
See [Insight API Endpoints](references/insight-endpoints.md) for complete endpoint documentation with request/response schemas and examples.
|
|
106
|
+
|
|
107
|
+
## MCP Tool Building Rules
|
|
108
|
+
|
|
109
|
+
When building Insight MCP tools:
|
|
110
|
+
|
|
111
|
+
1. **Use PlaygroundTools.ts** for testing first
|
|
112
|
+
2. **Follow the three-part pattern**:
|
|
113
|
+
- Description method (with SQL examples)
|
|
114
|
+
- Schema method (Zod validation)
|
|
115
|
+
- Handler method (implementation)
|
|
116
|
+
3. **Use HailerApiClient** with socket calls
|
|
117
|
+
4. **Validate SQL queries** before sending (basic syntax check)
|
|
118
|
+
5. **Format responses** as markdown tables for readability
|
|
119
|
+
6. **Handle permissions** - only workspace admins can modify sources
|
|
120
|
+
|
|
121
|
+
## Example Patterns
|
|
122
|
+
|
|
123
|
+
### Simple Report
|
|
124
|
+
```javascript
|
|
125
|
+
create_insight({
|
|
126
|
+
name: 'All Books',
|
|
127
|
+
sources: [{
|
|
128
|
+
name: 'books',
|
|
129
|
+
workflowId: bookWorkflowId,
|
|
130
|
+
fields: [
|
|
131
|
+
{ name: 'title', meta: 'name' },
|
|
132
|
+
{ name: 'author', fieldId: authorFieldId }
|
|
133
|
+
]
|
|
134
|
+
}],
|
|
135
|
+
query: 'SELECT title, author FROM books'
|
|
136
|
+
})
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Cross-Workflow Join
|
|
140
|
+
```javascript
|
|
141
|
+
create_insight({
|
|
142
|
+
name: 'Books with Authors',
|
|
143
|
+
sources: [
|
|
144
|
+
{
|
|
145
|
+
name: 'books',
|
|
146
|
+
workflowId: bookWorkflowId,
|
|
147
|
+
fields: [
|
|
148
|
+
{ name: 'title', meta: 'name' },
|
|
149
|
+
{ name: 'authorId', fieldId: authorLinkFieldId }
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'authors',
|
|
154
|
+
workflowId: authorWorkflowId,
|
|
155
|
+
fields: [
|
|
156
|
+
{ name: 'id', meta: '_id' },
|
|
157
|
+
{ name: 'authorName', meta: 'name' }
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
query: `
|
|
162
|
+
SELECT books.title, authors.authorName
|
|
163
|
+
FROM books
|
|
164
|
+
LEFT JOIN authors ON books.authorId = authors.id
|
|
165
|
+
`
|
|
166
|
+
})
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Preview vs Execute
|
|
170
|
+
|
|
171
|
+
**v3.insight.preview**:
|
|
172
|
+
- Used during design/debugging
|
|
173
|
+
- Limited to ~20 activities for performance
|
|
174
|
+
- Can be called frequently
|
|
175
|
+
- Shows errors in SQL syntax
|
|
176
|
+
|
|
177
|
+
**v3.insight.data**:
|
|
178
|
+
- Executes full query on all activities
|
|
179
|
+
- Returns complete results
|
|
180
|
+
- Use after insight is finalized
|
|
181
|
+
|
|
182
|
+
## Next Steps
|
|
183
|
+
|
|
184
|
+
For complete endpoint documentation with request/response schemas and SQL examples, see:
|
|
185
|
+
- [Insight API Endpoints](references/insight-endpoints.md) - All v3.insight.* endpoints
|