@flowdot.ai/mcp-server 1.0.1 → 1.0.2

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 (106) hide show
  1. package/bin/flowdot-mcp.js +1 -1
  2. package/dist/api-client.d.ts +2 -557
  3. package/dist/api-client.d.ts.map +1 -1
  4. package/dist/api-client.js +2 -1264
  5. package/dist/api-client.js.map +1 -1
  6. package/dist/resources/index.d.ts +12 -0
  7. package/dist/resources/index.d.ts.map +1 -0
  8. package/dist/resources/index.js +2204 -0
  9. package/dist/resources/index.js.map +1 -0
  10. package/dist/server.d.ts.map +1 -1
  11. package/dist/server.js +11 -1
  12. package/dist/server.js.map +1 -1
  13. package/dist/tools/add-recipe-step.d.ts +23 -0
  14. package/dist/tools/add-recipe-step.d.ts.map +1 -0
  15. package/dist/tools/add-recipe-step.js +196 -0
  16. package/dist/tools/add-recipe-step.js.map +1 -0
  17. package/dist/tools/add-recipe-store.d.ts +19 -0
  18. package/dist/tools/add-recipe-store.d.ts.map +1 -0
  19. package/dist/tools/add-recipe-store.js +116 -0
  20. package/dist/tools/add-recipe-store.js.map +1 -0
  21. package/dist/tools/agent-toolkits.d.ts.map +1 -1
  22. package/dist/tools/agent-toolkits.js +8 -1
  23. package/dist/tools/agent-toolkits.js.map +1 -1
  24. package/dist/tools/browse-recipes.d.ts +16 -0
  25. package/dist/tools/browse-recipes.d.ts.map +1 -0
  26. package/dist/tools/browse-recipes.js +102 -0
  27. package/dist/tools/browse-recipes.js.map +1 -0
  28. package/dist/tools/create-recipe.d.ts +16 -0
  29. package/dist/tools/create-recipe.d.ts.map +1 -0
  30. package/dist/tools/create-recipe.js +92 -0
  31. package/dist/tools/create-recipe.js.map +1 -0
  32. package/dist/tools/delete-recipe-step.d.ts +14 -0
  33. package/dist/tools/delete-recipe-step.d.ts.map +1 -0
  34. package/dist/tools/delete-recipe-step.js +65 -0
  35. package/dist/tools/delete-recipe-step.js.map +1 -0
  36. package/dist/tools/delete-recipe-store.d.ts +14 -0
  37. package/dist/tools/delete-recipe-store.d.ts.map +1 -0
  38. package/dist/tools/delete-recipe-store.js +65 -0
  39. package/dist/tools/delete-recipe-store.js.map +1 -0
  40. package/dist/tools/delete-recipe.d.ts +13 -0
  41. package/dist/tools/delete-recipe.d.ts.map +1 -0
  42. package/dist/tools/delete-recipe.js +59 -0
  43. package/dist/tools/delete-recipe.js.map +1 -0
  44. package/dist/tools/favorite-recipe.d.ts +13 -0
  45. package/dist/tools/favorite-recipe.d.ts.map +1 -0
  46. package/dist/tools/favorite-recipe.js +53 -0
  47. package/dist/tools/favorite-recipe.js.map +1 -0
  48. package/dist/tools/fork-recipe.d.ts +13 -0
  49. package/dist/tools/fork-recipe.d.ts.map +1 -0
  50. package/dist/tools/fork-recipe.js +56 -0
  51. package/dist/tools/fork-recipe.js.map +1 -0
  52. package/dist/tools/get-recipe-definition.d.ts +15 -0
  53. package/dist/tools/get-recipe-definition.d.ts.map +1 -0
  54. package/dist/tools/get-recipe-definition.js +70 -0
  55. package/dist/tools/get-recipe-definition.js.map +1 -0
  56. package/dist/tools/get-recipe.d.ts +12 -0
  57. package/dist/tools/get-recipe.d.ts.map +1 -0
  58. package/dist/tools/get-recipe.js +88 -0
  59. package/dist/tools/get-recipe.js.map +1 -0
  60. package/dist/tools/index.d.ts.map +1 -1
  61. package/dist/tools/index.js +87 -0
  62. package/dist/tools/index.js.map +1 -1
  63. package/dist/tools/link-recipe.d.ts +14 -0
  64. package/dist/tools/link-recipe.d.ts.map +1 -0
  65. package/dist/tools/link-recipe.js +76 -0
  66. package/dist/tools/link-recipe.js.map +1 -0
  67. package/dist/tools/list-recipe-steps.d.ts +12 -0
  68. package/dist/tools/list-recipe-steps.d.ts.map +1 -0
  69. package/dist/tools/list-recipe-steps.js +69 -0
  70. package/dist/tools/list-recipe-steps.js.map +1 -0
  71. package/dist/tools/list-recipe-stores.d.ts +12 -0
  72. package/dist/tools/list-recipe-stores.d.ts.map +1 -0
  73. package/dist/tools/list-recipe-stores.js +87 -0
  74. package/dist/tools/list-recipe-stores.js.map +1 -0
  75. package/dist/tools/list-recipes.d.ts +12 -0
  76. package/dist/tools/list-recipes.d.ts.map +1 -0
  77. package/dist/tools/list-recipes.js +92 -0
  78. package/dist/tools/list-recipes.js.map +1 -0
  79. package/dist/tools/update-recipe-step.d.ts +22 -0
  80. package/dist/tools/update-recipe-step.d.ts.map +1 -0
  81. package/dist/tools/update-recipe-step.js +97 -0
  82. package/dist/tools/update-recipe-step.js.map +1 -0
  83. package/dist/tools/update-recipe-store.d.ts +20 -0
  84. package/dist/tools/update-recipe-store.d.ts.map +1 -0
  85. package/dist/tools/update-recipe-store.js +98 -0
  86. package/dist/tools/update-recipe-store.js.map +1 -0
  87. package/dist/tools/update-recipe.d.ts +18 -0
  88. package/dist/tools/update-recipe.d.ts.map +1 -0
  89. package/dist/tools/update-recipe.js +98 -0
  90. package/dist/tools/update-recipe.js.map +1 -0
  91. package/dist/tools/vote-recipe.d.ts +13 -0
  92. package/dist/tools/vote-recipe.d.ts.map +1 -0
  93. package/dist/tools/vote-recipe.js +54 -0
  94. package/dist/tools/vote-recipe.js.map +1 -0
  95. package/dist/types.d.ts +3 -1092
  96. package/dist/types.d.ts.map +1 -1
  97. package/dist/types.js +3 -1
  98. package/dist/types.js.map +1 -1
  99. package/dist/utils/script-validator.d.ts.map +1 -1
  100. package/dist/utils/script-validator.js +5 -1
  101. package/dist/utils/script-validator.js.map +1 -1
  102. package/package.json +11 -3
  103. package/dist/tools/convert-app-to-multifile.d.ts +0 -11
  104. package/dist/tools/convert-app-to-multifile.d.ts.map +0 -1
  105. package/dist/tools/convert-app-to-multifile.js +0 -69
  106. package/dist/tools/convert-app-to-multifile.js.map +0 -1
@@ -1,1269 +1,7 @@
1
1
  /**
2
2
  * FlowDot Hub API Client
3
3
  *
4
- * Handles communication with the FlowDot Hub API using MCP tokens.
4
+ * Re-exported from @flowdot.ai/api shared package.
5
5
  */
6
- export class FlowDotApiClient {
7
- hubUrl;
8
- apiToken;
9
- constructor(hubUrl, apiToken) {
10
- // Remove trailing slash from hubUrl
11
- this.hubUrl = hubUrl.replace(/\/$/, '');
12
- this.apiToken = apiToken;
13
- }
14
- /**
15
- * Make an authenticated request to the FlowDot Hub API.
16
- */
17
- async request(endpoint, options = {}) {
18
- const url = `${this.hubUrl}/api/mcp/v1${endpoint}`;
19
- const response = await fetch(url, {
20
- ...options,
21
- headers: {
22
- Authorization: `Bearer ${this.apiToken}`,
23
- 'Content-Type': 'application/json',
24
- Accept: 'application/json',
25
- ...options.headers,
26
- },
27
- });
28
- const data = (await response.json());
29
- if (!response.ok || !data.success) {
30
- let errorMessage = data.error || data.message || `API error: ${response.status}`;
31
- // Include debug info if available
32
- if (data.debug) {
33
- const debug = data.debug;
34
- if (debug.hints && Array.isArray(debug.hints) && debug.hints.length > 0) {
35
- errorMessage += ' | Hints: ' + debug.hints.join('; ');
36
- }
37
- if (debug.code_preview) {
38
- errorMessage += ` | Code starts with: "${String(debug.code_preview).substring(0, 50)}..."`;
39
- }
40
- }
41
- throw new Error(errorMessage);
42
- }
43
- return data.data;
44
- }
45
- /**
46
- * List workflows available to the user.
47
- */
48
- async listWorkflows(filter, favoritesOnly) {
49
- const params = new URLSearchParams();
50
- if (filter)
51
- params.set('filter', filter);
52
- if (favoritesOnly)
53
- params.set('favorites_only', 'true');
54
- const queryString = params.toString();
55
- const endpoint = `/workflows${queryString ? `?${queryString}` : ''}`;
56
- return this.request(endpoint);
57
- }
58
- /**
59
- * Get a specific workflow by ID.
60
- */
61
- async getWorkflow(workflowId) {
62
- return this.request(`/workflows/${workflowId}`);
63
- }
64
- /**
65
- * Execute a workflow.
66
- */
67
- async executeWorkflow(workflowId, inputs = {}, waitForCompletion = true, mode = 'flowdot') {
68
- return this.request(`/workflows/${workflowId}/execute`, {
69
- method: 'POST',
70
- body: JSON.stringify({
71
- inputs,
72
- wait_for_completion: waitForCompletion,
73
- mode,
74
- }),
75
- });
76
- }
77
- /**
78
- * Get execution status and results.
79
- */
80
- async getExecution(executionId) {
81
- return this.request(`/executions/${executionId}`);
82
- }
83
- /**
84
- * Chat with the FlowDot agent.
85
- */
86
- async agentChat(message, conversationId, mode) {
87
- return this.request('/agent/chat', {
88
- method: 'POST',
89
- body: JSON.stringify({
90
- message,
91
- conversation_id: conversationId,
92
- mode: mode || 'flowdot',
93
- }),
94
- });
95
- }
96
- /**
97
- * Test the connection to the FlowDot Hub.
98
- */
99
- async testConnection() {
100
- try {
101
- await this.listWorkflows();
102
- return true;
103
- }
104
- catch {
105
- return false;
106
- }
107
- }
108
- // ============================================
109
- // Analytics & Feedback (analytics:read scope)
110
- // ============================================
111
- /**
112
- * Get workflow execution metrics.
113
- */
114
- async getWorkflowMetrics(workflowId, period) {
115
- const params = new URLSearchParams();
116
- if (period)
117
- params.set('period', period);
118
- const queryString = params.toString();
119
- return this.request(`/workflows/${workflowId}/metrics${queryString ? `?${queryString}` : ''}`);
120
- }
121
- /**
122
- * Get workflow comments.
123
- */
124
- async getWorkflowComments(workflowId) {
125
- return this.request(`/workflows/${workflowId}/comments`);
126
- }
127
- /**
128
- * Get execution history for a workflow.
129
- */
130
- async getExecutionHistory(workflowId, page, limit) {
131
- const params = new URLSearchParams();
132
- if (page)
133
- params.set('page', page.toString());
134
- if (limit)
135
- params.set('limit', limit.toString());
136
- const queryString = params.toString();
137
- return this.request(`/workflows/${workflowId}/executions${queryString ? `?${queryString}` : ''}`);
138
- }
139
- // ============================================
140
- // Workflow Management (workflows:manage scope)
141
- // ============================================
142
- /**
143
- * Get detailed workflow information including nodes, connections, signature.
144
- */
145
- async getWorkflowDetails(workflowId) {
146
- return this.request(`/workflows/${workflowId}/details`);
147
- }
148
- /**
149
- * Get the input schema for a workflow.
150
- */
151
- async getWorkflowInputsSchema(workflowId) {
152
- return this.request(`/workflows/${workflowId}/inputs-schema`);
153
- }
154
- /**
155
- * Duplicate a workflow.
156
- */
157
- async duplicateWorkflow(workflowId, name) {
158
- return this.request(`/workflows/${workflowId}/duplicate`, {
159
- method: 'POST',
160
- body: JSON.stringify({ name }),
161
- });
162
- }
163
- /**
164
- * Toggle workflow public/private status.
165
- */
166
- async toggleWorkflowPublic(workflowId, isPublic) {
167
- return this.request(`/workflows/${workflowId}/toggle-public`, {
168
- method: 'POST',
169
- body: JSON.stringify({ is_public: isPublic }),
170
- });
171
- }
172
- /**
173
- * Favorite or unfavorite a workflow.
174
- */
175
- async favoriteWorkflow(workflowId, favorite) {
176
- return this.request(`/workflows/${workflowId}/favorite`, {
177
- method: 'POST',
178
- body: JSON.stringify({ favorite }),
179
- });
180
- }
181
- // ============================================
182
- // Execution Enhancements (executions:manage scope)
183
- // ============================================
184
- /**
185
- * Cancel a running execution.
186
- */
187
- async cancelExecution(executionId) {
188
- return this.request(`/executions/${executionId}/cancel`, {
189
- method: 'POST',
190
- });
191
- }
192
- /**
193
- * Retry a failed execution.
194
- */
195
- async retryExecution(executionId) {
196
- return this.request(`/executions/${executionId}/retry`, {
197
- method: 'POST',
198
- });
199
- }
200
- /**
201
- * Get SSE stream URL for execution (client handles actual streaming).
202
- */
203
- getExecutionStreamUrl(executionId) {
204
- return `${this.hubUrl}/api/mcp/v1/executions/${executionId}/stream`;
205
- }
206
- /**
207
- * Get auth token for SSE requests.
208
- */
209
- getAuthToken() {
210
- return this.apiToken;
211
- }
212
- // ============================================
213
- // Discovery & Organization (discovery:read scope)
214
- // ============================================
215
- /**
216
- * Get workflow tags.
217
- */
218
- async getWorkflowTags(workflowId) {
219
- return this.request(`/workflows/${workflowId}/tags`);
220
- }
221
- /**
222
- * Set workflow tags.
223
- */
224
- async setWorkflowTags(workflowId, tags) {
225
- return this.request(`/workflows/${workflowId}/tags`, {
226
- method: 'POST',
227
- body: JSON.stringify({ tags }),
228
- });
229
- }
230
- /**
231
- * Search workflows by name, description, or tags.
232
- */
233
- async searchWorkflows(query, tags, page) {
234
- const params = new URLSearchParams();
235
- params.set('q', query);
236
- if (tags && tags.length > 0)
237
- params.set('tags', tags.join(','));
238
- if (page)
239
- params.set('page', page.toString());
240
- return this.request(`/workflows/search?${params.toString()}`);
241
- }
242
- /**
243
- * Get public workflows from all users.
244
- */
245
- async getPublicWorkflows(page, sortBy) {
246
- const params = new URLSearchParams();
247
- if (page)
248
- params.set('page', page.toString());
249
- if (sortBy)
250
- params.set('sort_by', sortBy);
251
- const queryString = params.toString();
252
- return this.request(`/workflows/public${queryString ? `?${queryString}` : ''}`);
253
- }
254
- // ============================================
255
- // Workflow Building (workflows:build scope)
256
- // ============================================
257
- /**
258
- * Create a new empty workflow.
259
- */
260
- async createWorkflow(name, description) {
261
- return this.request('/workflows', {
262
- method: 'POST',
263
- body: JSON.stringify({ name, description }),
264
- });
265
- }
266
- /**
267
- * Delete a workflow.
268
- */
269
- async deleteWorkflow(workflowId) {
270
- return this.request(`/workflows/${workflowId}`, {
271
- method: 'DELETE',
272
- });
273
- }
274
- /**
275
- * Get the full graph (nodes and connections) of a workflow.
276
- */
277
- async getWorkflowGraph(workflowId) {
278
- return this.request(`/workflows/${workflowId}/graph`);
279
- }
280
- /**
281
- * Validate a workflow for errors.
282
- */
283
- async validateWorkflow(workflowId) {
284
- return this.request(`/workflows/${workflowId}/validate`, {
285
- method: 'POST',
286
- });
287
- }
288
- // ============================================
289
- // Node Operations (nodes:manage scope)
290
- // ============================================
291
- /**
292
- * List all available node types.
293
- * Note: Response may be an array or object depending on the API version.
294
- */
295
- async listAvailableNodes() {
296
- return this.request('/node-types');
297
- }
298
- /**
299
- * Get schema for a specific node type.
300
- */
301
- async getNodeSchema(nodeType) {
302
- return this.request(`/node-types/${encodeURIComponent(nodeType)}/schema`);
303
- }
304
- /**
305
- * Add a node to a workflow.
306
- */
307
- async addNode(workflowId, nodeType, position, properties) {
308
- return this.request(`/workflows/${workflowId}/nodes`, {
309
- method: 'POST',
310
- body: JSON.stringify({ type: nodeType, position, properties }),
311
- });
312
- }
313
- /**
314
- * Update a node in a workflow.
315
- */
316
- async updateNode(workflowId, nodeId, updates) {
317
- return this.request(`/workflows/${workflowId}/nodes/${nodeId}`, {
318
- method: 'PUT',
319
- body: JSON.stringify(updates),
320
- });
321
- }
322
- /**
323
- * Delete a node from a workflow.
324
- */
325
- async deleteNode(workflowId, nodeId) {
326
- return this.request(`/workflows/${workflowId}/nodes/${nodeId}`, {
327
- method: 'DELETE',
328
- });
329
- }
330
- // ============================================
331
- // Connection Operations (connections:manage scope)
332
- // ============================================
333
- /**
334
- * Add a connection between nodes.
335
- */
336
- async addConnection(workflowId, sourceNodeId, sourceSocketId, targetNodeId, targetSocketId) {
337
- return this.request(`/workflows/${workflowId}/connections`, {
338
- method: 'POST',
339
- body: JSON.stringify({
340
- source_node_id: sourceNodeId,
341
- source_socket_id: sourceSocketId,
342
- target_node_id: targetNodeId,
343
- target_socket_id: targetSocketId,
344
- }),
345
- });
346
- }
347
- /**
348
- * Delete a connection from a workflow.
349
- */
350
- async deleteConnection(workflowId, connectionId) {
351
- return this.request(`/workflows/${workflowId}/connections/${connectionId}`, {
352
- method: 'DELETE',
353
- });
354
- }
355
- /**
356
- * Get all connections for a specific node.
357
- */
358
- async getNodeConnections(workflowId, nodeId) {
359
- return this.request(`/workflows/${workflowId}/nodes/${nodeId}/connections`);
360
- }
361
- // ============================================
362
- // Custom Node Operations (custom_nodes:read / custom_nodes:manage)
363
- // ============================================
364
- /**
365
- * List user's own custom nodes.
366
- */
367
- async listCustomNodes(options) {
368
- const params = new URLSearchParams();
369
- if (options?.search)
370
- params.set('search', options.search);
371
- if (options?.category)
372
- params.set('category', options.category);
373
- if (options?.limit)
374
- params.set('limit', options.limit.toString());
375
- if (options?.page)
376
- params.set('page', options.page.toString());
377
- const queryString = params.toString();
378
- return this.request(`/custom-nodes${queryString ? `?${queryString}` : ''}`);
379
- }
380
- /**
381
- * Search public custom nodes.
382
- */
383
- async searchPublicCustomNodes(filters) {
384
- const params = new URLSearchParams();
385
- if (filters?.q)
386
- params.set('q', filters.q);
387
- if (filters?.category)
388
- params.set('category', filters.category);
389
- if (filters?.tags && filters.tags.length > 0)
390
- params.set('tags', JSON.stringify(filters.tags));
391
- if (filters?.verified_only)
392
- params.set('verified_only', 'true');
393
- if (filters?.sort)
394
- params.set('sort', filters.sort);
395
- if (filters?.limit)
396
- params.set('limit', filters.limit.toString());
397
- if (filters?.page)
398
- params.set('page', filters.page.toString());
399
- const queryString = params.toString();
400
- return this.request(`/custom-nodes/search${queryString ? `?${queryString}` : ''}`);
401
- }
402
- /**
403
- * Get a specific custom node with full details including script_code.
404
- */
405
- async getCustomNode(nodeId) {
406
- return this.request(`/custom-nodes/${nodeId}`);
407
- }
408
- /**
409
- * Get comments for a custom node.
410
- */
411
- async getCustomNodeComments(nodeId) {
412
- return this.request(`/custom-nodes/${nodeId}/comments`);
413
- }
414
- /**
415
- * Create a new custom node.
416
- */
417
- async createCustomNode(input) {
418
- return this.request('/custom-nodes', {
419
- method: 'POST',
420
- body: JSON.stringify(input),
421
- });
422
- }
423
- /**
424
- * Update a custom node.
425
- */
426
- async updateCustomNode(nodeId, updates) {
427
- return this.request(`/custom-nodes/${nodeId}`, {
428
- method: 'PUT',
429
- body: JSON.stringify(updates),
430
- });
431
- }
432
- /**
433
- * Delete a custom node.
434
- */
435
- async deleteCustomNode(nodeId) {
436
- return this.request(`/custom-nodes/${nodeId}`, {
437
- method: 'DELETE',
438
- });
439
- }
440
- /**
441
- * Copy a public custom node to user's library.
442
- */
443
- async copyCustomNode(nodeId, name) {
444
- return this.request(`/custom-nodes/${nodeId}/copy`, {
445
- method: 'POST',
446
- body: JSON.stringify({ name }),
447
- });
448
- }
449
- /**
450
- * Toggle custom node visibility.
451
- */
452
- async toggleCustomNodeVisibility(nodeId, visibility) {
453
- return this.request(`/custom-nodes/${nodeId}/visibility`, {
454
- method: 'POST',
455
- body: JSON.stringify({ visibility }),
456
- });
457
- }
458
- /**
459
- * Vote on a custom node.
460
- */
461
- async voteCustomNode(nodeId, vote) {
462
- return this.request(`/custom-nodes/${nodeId}/vote`, {
463
- method: 'POST',
464
- body: JSON.stringify({ vote }),
465
- });
466
- }
467
- /**
468
- * Toggle favorite on a custom node.
469
- */
470
- async favoriteCustomNode(nodeId, favorite) {
471
- return this.request(`/custom-nodes/${nodeId}/favorite`, {
472
- method: 'POST',
473
- body: JSON.stringify({ favorite }),
474
- });
475
- }
476
- /**
477
- * Add a comment to a custom node.
478
- */
479
- async addCustomNodeComment(nodeId, content, parentId) {
480
- return this.request(`/custom-nodes/${nodeId}/comments`, {
481
- method: 'POST',
482
- body: JSON.stringify({ content, parent_id: parentId }),
483
- });
484
- }
485
- // ============================================
486
- // App Operations (apps:read / apps:manage)
487
- // ============================================
488
- /**
489
- * List user's own apps.
490
- */
491
- async listApps(options) {
492
- const params = new URLSearchParams();
493
- if (options?.search)
494
- params.set('search', options.search);
495
- if (options?.category)
496
- params.set('category', options.category);
497
- if (options?.limit)
498
- params.set('limit', options.limit.toString());
499
- if (options?.page)
500
- params.set('page', options.page.toString());
501
- const queryString = params.toString();
502
- return this.request(`/apps${queryString ? `?${queryString}` : ''}`);
503
- }
504
- /**
505
- * Search public apps.
506
- */
507
- async searchPublicApps(filters) {
508
- const params = new URLSearchParams();
509
- if (filters?.q)
510
- params.set('q', filters.q);
511
- if (filters?.category)
512
- params.set('category', filters.category);
513
- if (filters?.tag)
514
- params.set('tag', filters.tag);
515
- if (filters?.mobile_compatible)
516
- params.set('mobile_compatible', 'true');
517
- if (filters?.sort)
518
- params.set('sort', filters.sort);
519
- if (filters?.limit)
520
- params.set('limit', filters.limit.toString());
521
- if (filters?.page)
522
- params.set('page', filters.page.toString());
523
- const queryString = params.toString();
524
- return this.request(`/apps/search${queryString ? `?${queryString}` : ''}`);
525
- }
526
- /**
527
- * Get app categories.
528
- */
529
- async getAppCategories() {
530
- return this.request('/apps/categories');
531
- }
532
- /**
533
- * Get popular app tags.
534
- */
535
- async getAppTags() {
536
- return this.request('/apps/tags');
537
- }
538
- /**
539
- * Get a specific app with full details including code.
540
- */
541
- async getApp(appId) {
542
- return this.request(`/apps/${appId}`);
543
- }
544
- /**
545
- * Get comments for an app.
546
- */
547
- async getAppComments(appId) {
548
- return this.request(`/apps/${appId}/comments`);
549
- }
550
- /**
551
- * Create a new app.
552
- */
553
- async createApp(input) {
554
- return this.request('/apps', {
555
- method: 'POST',
556
- body: JSON.stringify(input),
557
- });
558
- }
559
- /**
560
- * Update an app.
561
- */
562
- async updateApp(appId, updates) {
563
- return this.request(`/apps/${appId}`, {
564
- method: 'PUT',
565
- body: JSON.stringify(updates),
566
- });
567
- }
568
- /**
569
- * Delete an app.
570
- */
571
- async deleteApp(appId) {
572
- return this.request(`/apps/${appId}`, {
573
- method: 'DELETE',
574
- });
575
- }
576
- /**
577
- * Publish an app (make it public).
578
- */
579
- async publishApp(appId) {
580
- return this.request(`/apps/${appId}/publish`, {
581
- method: 'POST',
582
- });
583
- }
584
- /**
585
- * Unpublish an app (make it private).
586
- */
587
- async unpublishApp(appId) {
588
- return this.request(`/apps/${appId}/unpublish`, {
589
- method: 'POST',
590
- });
591
- }
592
- /**
593
- * Clone a public app to user's library.
594
- */
595
- async cloneApp(appId, name) {
596
- return this.request(`/apps/${appId}/clone`, {
597
- method: 'POST',
598
- body: JSON.stringify({ name }),
599
- });
600
- }
601
- /**
602
- * Vote on an app.
603
- */
604
- async voteApp(appId, vote) {
605
- return this.request(`/apps/${appId}/vote`, {
606
- method: 'POST',
607
- body: JSON.stringify({ vote }),
608
- });
609
- }
610
- /**
611
- * Toggle favorite on an app.
612
- */
613
- async favoriteApp(appId, favorite) {
614
- return this.request(`/apps/${appId}/favorite`, {
615
- method: 'POST',
616
- body: JSON.stringify({ favorite }),
617
- });
618
- }
619
- /**
620
- * Add a comment to an app.
621
- */
622
- async addAppComment(appId, content, parentId) {
623
- return this.request(`/apps/${appId}/comments`, {
624
- method: 'POST',
625
- body: JSON.stringify({ content, parent_id: parentId }),
626
- });
627
- }
628
- /**
629
- * Get workflows linked to an app.
630
- */
631
- async getAppWorkflows(appId) {
632
- return this.request(`/apps/${appId}/workflows`);
633
- }
634
- /**
635
- * Link a workflow to an app.
636
- */
637
- async linkAppWorkflow(appId, workflowHash, alias) {
638
- return this.request(`/apps/${appId}/workflows`, {
639
- method: 'POST',
640
- body: JSON.stringify({ workflow_hash: workflowHash, alias }),
641
- });
642
- }
643
- /**
644
- * Unlink a workflow from an app.
645
- */
646
- async unlinkAppWorkflow(appId, workflowHash) {
647
- return this.request(`/apps/${appId}/workflows/${workflowHash}`, {
648
- method: 'DELETE',
649
- });
650
- }
651
- // ============================================
652
- // App Code Editing (apps:manage scope)
653
- // ============================================
654
- /**
655
- * Edit app code using string replacement (find and replace).
656
- * Replaces old_string with new_string in the app's code.
657
- */
658
- async editAppCode(appId, input) {
659
- return this.request(`/apps/${appId}/code/edit`, {
660
- method: 'POST',
661
- body: JSON.stringify(input),
662
- });
663
- }
664
- /**
665
- * Append content to the end of app code.
666
- */
667
- async appendAppCode(appId, input) {
668
- return this.request(`/apps/${appId}/code/append`, {
669
- method: 'POST',
670
- body: JSON.stringify(input),
671
- });
672
- }
673
- /**
674
- * Prepend content to the beginning of app code.
675
- */
676
- async prependAppCode(appId, input) {
677
- return this.request(`/apps/${appId}/code/prepend`, {
678
- method: 'POST',
679
- body: JSON.stringify(input),
680
- });
681
- }
682
- /**
683
- * Insert content after a specific pattern in app code.
684
- */
685
- async insertAppCode(appId, input) {
686
- return this.request(`/apps/${appId}/code/insert`, {
687
- method: 'POST',
688
- body: JSON.stringify(input),
689
- });
690
- }
691
- // ============================================
692
- // Multi-File App Operations (apps:manage scope)
693
- // ============================================
694
- /**
695
- * List all files in a multi-file app.
696
- */
697
- async listAppFiles(appId) {
698
- return this.request(`/apps/${appId}/files`);
699
- }
700
- /**
701
- * Get a specific file from a multi-file app.
702
- */
703
- async getAppFile(appId, filePath) {
704
- return this.request(`/apps/${appId}/files/${encodeURIComponent(filePath)}`);
705
- }
706
- /**
707
- * Create a new file in a multi-file app.
708
- */
709
- async createAppFile(appId, input) {
710
- return this.request(`/apps/${appId}/files`, {
711
- method: 'POST',
712
- body: JSON.stringify(input),
713
- });
714
- }
715
- /**
716
- * Update an existing file in a multi-file app.
717
- */
718
- async updateAppFile(appId, filePath, input) {
719
- return this.request(`/apps/${appId}/files/${encodeURIComponent(filePath)}`, {
720
- method: 'PUT',
721
- body: JSON.stringify(input),
722
- });
723
- }
724
- /**
725
- * Delete a file from a multi-file app.
726
- */
727
- async deleteAppFile(appId, filePath) {
728
- return this.request(`/apps/${appId}/files/${encodeURIComponent(filePath)}`, {
729
- method: 'DELETE',
730
- });
731
- }
732
- /**
733
- * Rename a file in a multi-file app.
734
- */
735
- async renameAppFile(appId, filePath, input) {
736
- return this.request(`/apps/${appId}/files/${encodeURIComponent(filePath)}/rename`, {
737
- method: 'POST',
738
- body: JSON.stringify(input),
739
- });
740
- }
741
- /**
742
- * Set a file as the entry point for a multi-file app.
743
- */
744
- async setAppEntryFile(appId, filePath) {
745
- return this.request(`/apps/${appId}/files/${encodeURIComponent(filePath)}/set-entry`, {
746
- method: 'POST',
747
- });
748
- }
749
- // convertAppToMultiFile removed - all apps are multi-file by default
750
- // ============================================
751
- // Sharing & Public URLs (sharing:read / sharing:manage)
752
- // ============================================
753
- /**
754
- * Get the public URL for a workflow.
755
- */
756
- async getWorkflowPublicUrl(workflowId) {
757
- return this.request(`/workflows/${workflowId}/public-url`);
758
- }
759
- /**
760
- * List shared results for a workflow.
761
- */
762
- async listSharedResults(workflowId, options) {
763
- const params = new URLSearchParams();
764
- if (options?.sort)
765
- params.set('sort', options.sort);
766
- if (options?.limit)
767
- params.set('limit', options.limit.toString());
768
- if (options?.page)
769
- params.set('page', options.page.toString());
770
- const queryString = params.toString();
771
- return this.request(`/workflows/${workflowId}/shared-results${queryString ? `?${queryString}` : ''}`);
772
- }
773
- /**
774
- * Get a specific shared result.
775
- */
776
- async getSharedResult(workflowId, resultHash) {
777
- return this.request(`/workflows/${workflowId}/shared-results/${resultHash}`);
778
- }
779
- /**
780
- * Get comments for a shared result.
781
- */
782
- async getSharedResultComments(workflowId, resultHash) {
783
- return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/comments`);
784
- }
785
- /**
786
- * Create a shared result from an execution.
787
- */
788
- async createSharedResult(workflowId, input) {
789
- return this.request(`/workflows/${workflowId}/shared-results`, {
790
- method: 'POST',
791
- body: JSON.stringify(input),
792
- });
793
- }
794
- /**
795
- * Add a comment to a workflow.
796
- */
797
- async addWorkflowComment(workflowId, content, parentId) {
798
- return this.request(`/workflows/${workflowId}/comments`, {
799
- method: 'POST',
800
- body: JSON.stringify({ content, parent_id: parentId }),
801
- });
802
- }
803
- /**
804
- * Add a comment to a shared result.
805
- */
806
- async addSharedResultComment(workflowId, resultHash, content, parentId) {
807
- return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/comments`, {
808
- method: 'POST',
809
- body: JSON.stringify({ content, parent_id: parentId }),
810
- });
811
- }
812
- /**
813
- * Vote on a workflow.
814
- */
815
- async voteWorkflow(workflowId, vote) {
816
- return this.request(`/workflows/${workflowId}/vote`, {
817
- method: 'POST',
818
- body: JSON.stringify({ vote }),
819
- });
820
- }
821
- /**
822
- * Vote on a shared result.
823
- */
824
- async voteSharedResult(workflowId, resultHash, vote) {
825
- return this.request(`/workflows/${workflowId}/shared-results/${resultHash}/vote`, {
826
- method: 'POST',
827
- body: JSON.stringify({ vote }),
828
- });
829
- }
830
- // ============================================
831
- // Input Presets (presets:read / presets:manage)
832
- // ============================================
833
- /**
834
- * List input presets for a workflow.
835
- */
836
- async listInputPresets(workflowId, options) {
837
- const params = new URLSearchParams();
838
- if (options?.sort)
839
- params.set('sort', options.sort);
840
- if (options?.limit)
841
- params.set('limit', options.limit.toString());
842
- if (options?.page)
843
- params.set('page', options.page.toString());
844
- const queryString = params.toString();
845
- return this.request(`/workflows/${workflowId}/input-presets${queryString ? `?${queryString}` : ''}`);
846
- }
847
- /**
848
- * Get a specific input preset.
849
- */
850
- async getInputPreset(workflowId, presetHash) {
851
- return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`);
852
- }
853
- /**
854
- * Create a new input preset.
855
- */
856
- async createInputPreset(workflowId, input) {
857
- return this.request(`/workflows/${workflowId}/input-presets`, {
858
- method: 'POST',
859
- body: JSON.stringify(input),
860
- });
861
- }
862
- /**
863
- * Update an input preset.
864
- */
865
- async updateInputPreset(workflowId, presetHash, updates) {
866
- return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`, {
867
- method: 'PUT',
868
- body: JSON.stringify(updates),
869
- });
870
- }
871
- /**
872
- * Delete an input preset.
873
- */
874
- async deleteInputPreset(workflowId, presetHash) {
875
- return this.request(`/workflows/${workflowId}/input-presets/${presetHash}`, {
876
- method: 'DELETE',
877
- });
878
- }
879
- /**
880
- * Vote on an input preset.
881
- */
882
- async voteInputPreset(workflowId, presetHash, vote) {
883
- return this.request(`/workflows/${workflowId}/input-presets/${presetHash}/vote`, {
884
- method: 'POST',
885
- body: JSON.stringify({ vote }),
886
- });
887
- }
888
- /**
889
- * Toggle community inputs (input presets) for a workflow.
890
- */
891
- async toggleCommunityInputs(workflowId, enabled) {
892
- return this.request(`/workflows/${workflowId}/community-inputs`, {
893
- method: 'POST',
894
- body: JSON.stringify({ enabled }),
895
- });
896
- }
897
- // ============================================
898
- // Teams (teams:read)
899
- // ============================================
900
- /**
901
- * List teams the user belongs to.
902
- */
903
- async listUserTeams() {
904
- return this.request('/teams');
905
- }
906
- // ============================================
907
- // Knowledge Base (knowledge:read / knowledge:manage)
908
- // ============================================
909
- /**
910
- * List knowledge base categories.
911
- * @param filters - Optional filters for team_id or personal categories
912
- */
913
- async listKnowledgeCategories(filters) {
914
- const params = new URLSearchParams();
915
- if (filters?.team_id)
916
- params.set('team_id', filters.team_id.toString());
917
- if (filters?.personal)
918
- params.set('personal', '1');
919
- const queryString = params.toString();
920
- return this.request(`/knowledge/categories${queryString ? `?${queryString}` : ''}`);
921
- }
922
- /**
923
- * Get a specific knowledge base category.
924
- */
925
- async getKnowledgeCategory(categoryId) {
926
- return this.request(`/knowledge/categories/${categoryId}`);
927
- }
928
- /**
929
- * Create a new knowledge base category.
930
- */
931
- async createKnowledgeCategory(input) {
932
- return this.request('/knowledge/categories', {
933
- method: 'POST',
934
- body: JSON.stringify(input),
935
- });
936
- }
937
- /**
938
- * Update a knowledge base category.
939
- */
940
- async updateKnowledgeCategory(categoryId, updates) {
941
- return this.request(`/knowledge/categories/${categoryId}`, {
942
- method: 'PUT',
943
- body: JSON.stringify(updates),
944
- });
945
- }
946
- /**
947
- * Delete a knowledge base category.
948
- */
949
- async deleteKnowledgeCategory(categoryId) {
950
- return this.request(`/knowledge/categories/${categoryId}`, {
951
- method: 'DELETE',
952
- });
953
- }
954
- /**
955
- * List knowledge base documents.
956
- * @param filters - Optional filters for category, team, and status
957
- */
958
- async listKnowledgeDocuments(filters) {
959
- const params = new URLSearchParams();
960
- if (filters?.category_id)
961
- params.set('category_id', filters.category_id.toString());
962
- if (filters?.team_id !== undefined)
963
- params.set('team_id', filters.team_id.toString());
964
- if (filters?.status)
965
- params.set('status', filters.status);
966
- const queryString = params.toString();
967
- const endpoint = `/knowledge/documents${queryString ? `?${queryString}` : ''}`;
968
- return this.request(endpoint);
969
- }
970
- /**
971
- * Get a specific knowledge base document.
972
- */
973
- async getKnowledgeDocument(documentId) {
974
- return this.request(`/knowledge/documents/${documentId}`);
975
- }
976
- /**
977
- * Upload text content as a document.
978
- */
979
- async uploadTextDocument(input) {
980
- return this.request('/knowledge/documents/upload-text', {
981
- method: 'POST',
982
- body: JSON.stringify(input),
983
- });
984
- }
985
- /**
986
- * Upload a document from a URL.
987
- */
988
- async uploadDocumentFromUrl(input) {
989
- return this.request('/knowledge/documents/upload-from-url', {
990
- method: 'POST',
991
- body: JSON.stringify(input),
992
- });
993
- }
994
- /**
995
- * Move a document to a different category.
996
- */
997
- async moveDocumentToCategory(documentId, categoryId) {
998
- return this.request(`/knowledge/documents/${documentId}/category`, {
999
- method: 'PUT',
1000
- body: JSON.stringify({ category_id: categoryId }),
1001
- });
1002
- }
1003
- /**
1004
- * Transfer document ownership between personal and team.
1005
- * @param documentId - The document ID to transfer
1006
- * @param input - Transfer options (team_id and optional category_id)
1007
- */
1008
- async transferDocumentOwnership(documentId, input) {
1009
- return this.request(`/knowledge/documents/${documentId}/transfer`, {
1010
- method: 'PUT',
1011
- body: JSON.stringify(input),
1012
- });
1013
- }
1014
- /**
1015
- * Reprocess a failed or pending document.
1016
- */
1017
- async reprocessDocument(documentId) {
1018
- return this.request(`/knowledge/documents/${documentId}/reprocess`, {
1019
- method: 'POST',
1020
- });
1021
- }
1022
- /**
1023
- * Delete a knowledge base document.
1024
- */
1025
- async deleteKnowledgeDocument(documentId) {
1026
- return this.request(`/knowledge/documents/${documentId}`, {
1027
- method: 'DELETE',
1028
- });
1029
- }
1030
- /**
1031
- * Query the knowledge base using RAG.
1032
- */
1033
- async queryKnowledgeBase(input) {
1034
- return this.request('/knowledge/query', {
1035
- method: 'POST',
1036
- body: JSON.stringify(input),
1037
- });
1038
- }
1039
- /**
1040
- * Get knowledge base storage usage.
1041
- */
1042
- async getKnowledgeStorage() {
1043
- return this.request('/knowledge/storage');
1044
- }
1045
- // ============================================
1046
- // Agent Toolkit Operations
1047
- // ============================================
1048
- /**
1049
- * List user's own toolkits.
1050
- */
1051
- async listAgentToolkits(filters) {
1052
- const params = new URLSearchParams();
1053
- if (filters?.search)
1054
- params.set('search', filters.search);
1055
- if (filters?.category)
1056
- params.set('category', filters.category);
1057
- if (filters?.limit)
1058
- params.set('limit', filters.limit.toString());
1059
- if (filters?.page)
1060
- params.set('page', filters.page.toString());
1061
- const queryString = params.toString();
1062
- return this.request(`/agent-toolkits${queryString ? `?${queryString}` : ''}`);
1063
- }
1064
- /**
1065
- * Search public toolkits in the marketplace.
1066
- */
1067
- async searchPublicAgentToolkits(filters) {
1068
- const params = new URLSearchParams();
1069
- if (filters?.query)
1070
- params.set('query', filters.query);
1071
- if (filters?.category)
1072
- params.set('category', filters.category);
1073
- if (filters?.tags)
1074
- params.set('tags', filters.tags.join(','));
1075
- if (filters?.verified_only)
1076
- params.set('verified_only', 'true');
1077
- if (filters?.sort)
1078
- params.set('sort', filters.sort);
1079
- if (filters?.limit)
1080
- params.set('limit', filters.limit.toString());
1081
- if (filters?.page)
1082
- params.set('page', filters.page.toString());
1083
- const queryString = params.toString();
1084
- return this.request(`/agent-toolkits/search${queryString ? `?${queryString}` : ''}`);
1085
- }
1086
- /**
1087
- * Get detailed information about a toolkit.
1088
- */
1089
- async getAgentToolkit(toolkitId) {
1090
- return this.request(`/agent-toolkits/${toolkitId}`);
1091
- }
1092
- /**
1093
- * Create a new agent toolkit.
1094
- */
1095
- async createAgentToolkit(input) {
1096
- return this.request('/agent-toolkits', {
1097
- method: 'POST',
1098
- body: JSON.stringify(input),
1099
- });
1100
- }
1101
- /**
1102
- * Update an existing toolkit.
1103
- */
1104
- async updateAgentToolkit(toolkitId, input) {
1105
- return this.request(`/agent-toolkits/${toolkitId}`, {
1106
- method: 'PUT',
1107
- body: JSON.stringify(input),
1108
- });
1109
- }
1110
- /**
1111
- * Delete a toolkit.
1112
- */
1113
- async deleteAgentToolkit(toolkitId) {
1114
- return this.request(`/agent-toolkits/${toolkitId}`, {
1115
- method: 'DELETE',
1116
- });
1117
- }
1118
- /**
1119
- * Copy/duplicate a toolkit.
1120
- */
1121
- async copyAgentToolkit(toolkitId, name) {
1122
- return this.request(`/agent-toolkits/${toolkitId}/copy`, {
1123
- method: 'POST',
1124
- body: JSON.stringify({ name }),
1125
- });
1126
- }
1127
- /**
1128
- * Toggle toolkit visibility.
1129
- */
1130
- async toggleToolkitVisibility(toolkitId, visibility) {
1131
- return this.request(`/agent-toolkits/${toolkitId}/toggle-public`, {
1132
- method: 'POST',
1133
- body: JSON.stringify({ visibility }),
1134
- });
1135
- }
1136
- /**
1137
- * List tools in a toolkit.
1138
- */
1139
- async listToolkitTools(toolkitId) {
1140
- return this.request(`/agent-toolkits/${toolkitId}/tools`);
1141
- }
1142
- /**
1143
- * Get a specific tool in a toolkit.
1144
- */
1145
- async getToolkitTool(toolkitId, toolId) {
1146
- return this.request(`/agent-toolkits/${toolkitId}/tools/${toolId}`);
1147
- }
1148
- /**
1149
- * Create a new tool in a toolkit.
1150
- */
1151
- async createToolkitTool(toolkitId, input) {
1152
- return this.request(`/agent-toolkits/${toolkitId}/tools`, {
1153
- method: 'POST',
1154
- body: JSON.stringify(input),
1155
- });
1156
- }
1157
- /**
1158
- * Update a tool in a toolkit.
1159
- */
1160
- async updateToolkitTool(toolkitId, toolId, input) {
1161
- return this.request(`/agent-toolkits/${toolkitId}/tools/${toolId}`, {
1162
- method: 'PUT',
1163
- body: JSON.stringify(input),
1164
- });
1165
- }
1166
- /**
1167
- * Delete a tool from a toolkit.
1168
- */
1169
- async deleteToolkitTool(toolkitId, toolId) {
1170
- return this.request(`/agent-toolkits/${toolkitId}/tools/${toolId}`, {
1171
- method: 'DELETE',
1172
- });
1173
- }
1174
- /**
1175
- * Install a toolkit.
1176
- */
1177
- async installToolkit(toolkitId) {
1178
- return this.request(`/agent-toolkits/${toolkitId}/install`, {
1179
- method: 'POST',
1180
- });
1181
- }
1182
- /**
1183
- * Uninstall a toolkit.
1184
- */
1185
- async uninstallToolkit(installationId) {
1186
- return this.request(`/agent-toolkit-installations/${installationId}`, {
1187
- method: 'DELETE',
1188
- });
1189
- }
1190
- /**
1191
- * List installed toolkits.
1192
- */
1193
- async listInstalledToolkits() {
1194
- return this.request('/agent-toolkits/installed');
1195
- }
1196
- /**
1197
- * Get a toolkit installation.
1198
- */
1199
- async getToolkitInstallation(installationId) {
1200
- return this.request(`/agent-toolkit-installations/${installationId}`);
1201
- }
1202
- /**
1203
- * Update a toolkit installation (credential mapping).
1204
- */
1205
- async updateToolkitInstallation(installationId, credentialMapping) {
1206
- return this.request(`/agent-toolkit-installations/${installationId}`, {
1207
- method: 'PUT',
1208
- body: JSON.stringify({ credential_mapping: credentialMapping }),
1209
- });
1210
- }
1211
- /**
1212
- * Toggle toolkit installation active status.
1213
- */
1214
- async toggleToolkitActive(installationId, isActive) {
1215
- return this.request(`/agent-toolkit-installations/${installationId}/toggle-active`, {
1216
- method: 'POST',
1217
- body: JSON.stringify({ is_active: isActive }),
1218
- });
1219
- }
1220
- /**
1221
- * Check credentials for a toolkit installation.
1222
- */
1223
- async checkToolkitCredentials(installationId) {
1224
- return this.request(`/agent-toolkit-installations/${installationId}/check-credentials`);
1225
- }
1226
- /**
1227
- * Invoke a tool from an installed toolkit.
1228
- */
1229
- async invokeToolkitTool(input) {
1230
- return this.request(`/agent-toolkit-installations/${input.installation_id}/execute/${input.tool_name}`, {
1231
- method: 'POST',
1232
- body: JSON.stringify({ inputs: input.inputs }),
1233
- });
1234
- }
1235
- /**
1236
- * Get comments on a toolkit.
1237
- */
1238
- async getToolkitComments(toolkitId) {
1239
- return this.request(`/agent-toolkits/${toolkitId}/comments`);
1240
- }
1241
- /**
1242
- * Add a comment to a toolkit.
1243
- */
1244
- async addToolkitComment(toolkitId, content, parentId) {
1245
- return this.request(`/agent-toolkits/${toolkitId}/comments`, {
1246
- method: 'POST',
1247
- body: JSON.stringify({ content, parent_id: parentId }),
1248
- });
1249
- }
1250
- /**
1251
- * Vote on a toolkit.
1252
- */
1253
- async voteToolkit(toolkitId, vote) {
1254
- return this.request(`/agent-toolkits/${toolkitId}/vote`, {
1255
- method: 'POST',
1256
- body: JSON.stringify({ vote }),
1257
- });
1258
- }
1259
- /**
1260
- * Favorite a toolkit.
1261
- */
1262
- async favoriteToolkit(toolkitId, favorite) {
1263
- return this.request(`/agent-toolkits/${toolkitId}/favorite`, {
1264
- method: 'POST',
1265
- body: JSON.stringify({ favorite }),
1266
- });
1267
- }
1268
- }
6
+ export { FlowDotApiClient } from '@flowdot.ai/api';
1269
7
  //# sourceMappingURL=api-client.js.map