langflow-mcp-server 3.1.1 → 4.12.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 (73) hide show
  1. package/.env.example +19 -1
  2. package/README.md +350 -82
  3. package/dist/__tests__/fixtures/advanced-execution.d.ts.map +1 -1
  4. package/dist/__tests__/fixtures/advanced-execution.js +7 -4
  5. package/dist/__tests__/fixtures/advanced-execution.js.map +1 -1
  6. package/dist/__tests__/fixtures/api-keys.js.map +1 -1
  7. package/dist/__tests__/fixtures/auth.d.ts.map +1 -1
  8. package/dist/__tests__/fixtures/components.d.ts.map +1 -1
  9. package/dist/__tests__/fixtures/custom-components.js.map +1 -1
  10. package/dist/__tests__/fixtures/files.d.ts.map +1 -1
  11. package/dist/__tests__/fixtures/files.js.map +1 -1
  12. package/dist/__tests__/fixtures/flows.js.map +1 -1
  13. package/dist/__tests__/fixtures/folders.js.map +1 -1
  14. package/dist/__tests__/fixtures/knowledge-bases.d.ts.map +1 -1
  15. package/dist/__tests__/fixtures/knowledge-bases.js.map +1 -1
  16. package/dist/__tests__/fixtures/misc.js.map +1 -1
  17. package/dist/__tests__/fixtures/monitoring.js.map +1 -1
  18. package/dist/__tests__/fixtures/projects.js.map +1 -1
  19. package/dist/__tests__/fixtures/run.d.ts.map +1 -1
  20. package/dist/__tests__/fixtures/store.d.ts.map +1 -1
  21. package/dist/__tests__/fixtures/store.js.map +1 -1
  22. package/dist/__tests__/fixtures/users.js.map +1 -1
  23. package/dist/__tests__/fixtures/variables.js.map +1 -1
  24. package/dist/__tests__/fixtures/vertices.d.ts +1 -2
  25. package/dist/__tests__/fixtures/vertices.d.ts.map +1 -1
  26. package/dist/__tests__/fixtures/vertices.js +1 -5
  27. package/dist/__tests__/fixtures/vertices.js.map +1 -1
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +5 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/mcp/http.d.ts +69 -0
  33. package/dist/mcp/http.d.ts.map +1 -0
  34. package/dist/mcp/http.js +595 -0
  35. package/dist/mcp/http.js.map +1 -0
  36. package/dist/mcp/index.js +39 -5
  37. package/dist/mcp/index.js.map +1 -1
  38. package/dist/mcp/prompts.js.map +1 -1
  39. package/dist/mcp/resources.d.ts.map +1 -1
  40. package/dist/mcp/resources.js +6 -17
  41. package/dist/mcp/resources.js.map +1 -1
  42. package/dist/mcp/server-consolidated.d.ts +16 -0
  43. package/dist/mcp/server-consolidated.d.ts.map +1 -1
  44. package/dist/mcp/server-consolidated.js +771 -18
  45. package/dist/mcp/server-consolidated.js.map +1 -1
  46. package/dist/mcp/server.d.ts +2 -0
  47. package/dist/mcp/server.d.ts.map +1 -1
  48. package/dist/mcp/server.js +827 -20
  49. package/dist/mcp/server.js.map +1 -1
  50. package/dist/mcp/tools-consolidated.d.ts.map +1 -1
  51. package/dist/mcp/tools-consolidated.js +813 -47
  52. package/dist/mcp/tools-consolidated.js.map +1 -1
  53. package/dist/mcp/tools.d.ts.map +1 -1
  54. package/dist/mcp/tools.js +1998 -83
  55. package/dist/mcp/tools.js.map +1 -1
  56. package/dist/mcp/validation-consolidated.d.ts +876 -18
  57. package/dist/mcp/validation-consolidated.d.ts.map +1 -1
  58. package/dist/mcp/validation-consolidated.js +758 -21
  59. package/dist/mcp/validation-consolidated.js.map +1 -1
  60. package/dist/mcp/validation.d.ts +966 -19
  61. package/dist/mcp/validation.d.ts.map +1 -1
  62. package/dist/mcp/validation.js +722 -18
  63. package/dist/mcp/validation.js.map +1 -1
  64. package/dist/services/langflow-client.d.ts +154 -52
  65. package/dist/services/langflow-client.d.ts.map +1 -1
  66. package/dist/services/langflow-client.js +1305 -155
  67. package/dist/services/langflow-client.js.map +1 -1
  68. package/dist/types/index.d.ts +536 -10
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/dist/utils/logger.d.ts.map +1 -1
  71. package/dist/utils/logger.js +2 -3
  72. package/dist/utils/logger.js.map +1 -1
  73. package/package.json +17 -15
@@ -100,12 +100,12 @@ class LangflowClient {
100
100
  throw this.handleError(error, 'Failed to list components');
101
101
  }
102
102
  }
103
- async runFlow(flowIdOrName, inputRequest, stream = false) {
103
+ async runFlow(flowIdOrName, inputRequest, stream = false, context) {
104
104
  try {
105
- const response = await this.client.post(`/run/${encodeURIComponent(flowIdOrName)}`, {
106
- ...inputRequest,
107
- stream
108
- });
105
+ if (stream) {
106
+ throw new Error('Streaming run responses are not supported by this MCP client');
107
+ }
108
+ const response = await this.client.post(`/run/${encodeURIComponent(flowIdOrName)}`, { input_request: inputRequest, context }, { params: { stream } });
109
109
  return response.data;
110
110
  }
111
111
  catch (error) {
@@ -228,6 +228,15 @@ class LangflowClient {
228
228
  throw this.handleError(error, `Failed to update project ${projectId}`);
229
229
  }
230
230
  }
231
+ async upsertProject(projectId, body) {
232
+ try {
233
+ const response = await this.client.put(`/projects/${encodeURIComponent(projectId)}`, body);
234
+ return response.data;
235
+ }
236
+ catch (error) {
237
+ throw this.handleError(error, `Failed to upsert project ${projectId}`);
238
+ }
239
+ }
231
240
  async deleteProject(projectId) {
232
241
  try {
233
242
  await this.client.delete(`/projects/${encodeURIComponent(projectId)}`);
@@ -316,6 +325,36 @@ class LangflowClient {
316
325
  throw this.handleError(error, `Failed to cancel build job ${jobId}`);
317
326
  }
318
327
  }
328
+ async buildPublicFlow(flowId, request, params) {
329
+ try {
330
+ const response = await this.client.post('/build_public_tmp/' + encodeURIComponent(flowId) + '/flow', request, { params });
331
+ return response.data;
332
+ }
333
+ catch (error) {
334
+ throw this.handleError(error, 'Failed to build public flow ' + flowId);
335
+ }
336
+ }
337
+ async getPublicBuildEvents(jobId, eventDelivery = 'streaming') {
338
+ try {
339
+ const response = await this.client.get('/build_public_tmp/' + encodeURIComponent(jobId) + '/events', {
340
+ params: { event_delivery: eventDelivery },
341
+ responseType: eventDelivery === 'streaming' ? 'text' : 'json'
342
+ });
343
+ return response.data;
344
+ }
345
+ catch (error) {
346
+ throw this.handleError(error, 'Failed to get public build events for job ' + jobId);
347
+ }
348
+ }
349
+ async cancelPublicBuild(jobId) {
350
+ try {
351
+ const response = await this.client.post('/build_public_tmp/' + encodeURIComponent(jobId) + '/cancel');
352
+ return response.data;
353
+ }
354
+ catch (error) {
355
+ throw this.handleError(error, 'Failed to cancel public build job ' + jobId);
356
+ }
357
+ }
319
358
  async listKnowledgeBases() {
320
359
  try {
321
360
  const response = await this.client.get('/knowledge_bases');
@@ -470,7 +509,10 @@ class LangflowClient {
470
509
  }
471
510
  async listStoreComponents(params) {
472
511
  try {
473
- const response = await this.client.get('/store/components/', { params });
512
+ const response = await this.client.get('/store/components/', {
513
+ params,
514
+ paramsSerializer: { indexes: null }
515
+ });
474
516
  return response.data;
475
517
  }
476
518
  catch (error) {
@@ -551,8 +593,12 @@ class LangflowClient {
551
593
  }
552
594
  async getMonitorMessage(messageId) {
553
595
  try {
554
- const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
555
- return response.data;
596
+ const response = await this.client.get('/monitor/messages');
597
+ const message = response.data.find(m => m.id === messageId);
598
+ if (!message) {
599
+ throw new Error(`Monitor message ${messageId} not found`);
600
+ }
601
+ return message;
556
602
  }
557
603
  catch (error) {
558
604
  throw this.handleError(error, `Failed to get monitor message ${messageId}`);
@@ -569,7 +615,9 @@ class LangflowClient {
569
615
  }
570
616
  async getMonitorSessionMessages(sessionId) {
571
617
  try {
572
- const response = await this.client.get(`/monitor/messages/session/${encodeURIComponent(sessionId)}`);
618
+ const response = await this.client.get('/monitor/messages', {
619
+ params: { session_id: sessionId }
620
+ });
573
621
  return response.data;
574
622
  }
575
623
  catch (error) {
@@ -623,15 +671,6 @@ class LangflowClient {
623
671
  throw this.handleError(error, `Failed to build vertices for flow ${flowId}`);
624
672
  }
625
673
  }
626
- async getVertex(params) {
627
- try {
628
- const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`);
629
- return response.data;
630
- }
631
- catch (error) {
632
- throw this.handleError(error, `Failed to get vertex ${params.vertex_id}`);
633
- }
634
- }
635
674
  async streamVertexBuild(params) {
636
675
  try {
637
676
  const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.vertex_id)}/stream`);
@@ -668,15 +707,6 @@ class LangflowClient {
668
707
  throw this.handleError(error, 'Failed to get current user');
669
708
  }
670
709
  }
671
- async getUser(userId) {
672
- try {
673
- const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
674
- return response.data;
675
- }
676
- catch (error) {
677
- throw this.handleError(error, `Failed to get user ${userId}`);
678
- }
679
- }
680
710
  async updateUser(userId, updates) {
681
711
  try {
682
712
  const response = await this.client.patch(`/users/${encodeURIComponent(userId)}`, updates);
@@ -723,15 +753,6 @@ class LangflowClient {
723
753
  throw this.handleError(error, `Failed to delete API key ${apiKeyId}`);
724
754
  }
725
755
  }
726
- async listCustomComponents() {
727
- try {
728
- const response = await this.client.get('/custom_component');
729
- return response.data;
730
- }
731
- catch (error) {
732
- throw this.handleError(error, 'Failed to list custom components');
733
- }
734
- }
735
756
  async createCustomComponent(component) {
736
757
  try {
737
758
  const response = await this.client.post('/custom_component', component);
@@ -848,15 +869,7 @@ class LangflowClient {
848
869
  }
849
870
  async uploadKnowledgeBase(kbName, fileContent, fileName) {
850
871
  try {
851
- const formData = new form_data_1.default();
852
- formData.append('file', fileContent, fileName);
853
- const response = await this.client.post('/knowledge_bases/', formData, {
854
- params: { kb_name: kbName },
855
- headers: {
856
- ...formData.getHeaders()
857
- }
858
- });
859
- return response.data;
872
+ return await this.ingestKnowledgeBase(kbName, [{ buffer: fileContent, filename: fileName }]);
860
873
  }
861
874
  catch (error) {
862
875
  throw this.handleError(error, `Failed to upload knowledge base ${kbName}`);
@@ -873,17 +886,29 @@ class LangflowClient {
873
886
  }
874
887
  async healthCheck() {
875
888
  try {
876
- await this.client.get('/health');
889
+ await this.client.get('/health', { baseURL: this.config.baseUrl });
877
890
  return true;
878
891
  }
879
892
  catch (error) {
880
893
  return false;
881
894
  }
882
895
  }
896
+ async getHealthz() {
897
+ try {
898
+ const response = await this.client.get('/healthz', {
899
+ baseURL: this.config.baseUrl
900
+ });
901
+ return response.data;
902
+ }
903
+ catch (error) {
904
+ throw this.handleError(error, 'Failed to get readiness health status');
905
+ }
906
+ }
883
907
  async getLogs(stream = false) {
884
908
  try {
885
909
  const endpoint = stream ? '/logs-stream' : '/logs';
886
910
  const response = await this.client.get(endpoint, {
911
+ baseURL: this.config.baseUrl,
887
912
  responseType: stream ? 'stream' : 'json'
888
913
  });
889
914
  return response.data;
@@ -892,320 +917,1445 @@ class LangflowClient {
892
917
  throw this.handleError(error, 'Failed to get logs');
893
918
  }
894
919
  }
895
- async getMonitorMessageById(messageId) {
920
+ async deleteUser(userId) {
921
+ try {
922
+ await this.client.delete(`/users/${encodeURIComponent(userId)}`);
923
+ }
924
+ catch (error) {
925
+ throw this.handleError(error, `Failed to delete user ${userId}`);
926
+ }
927
+ }
928
+ async getConfig() {
929
+ try {
930
+ const response = await this.client.get('/config');
931
+ return response.data;
932
+ }
933
+ catch (error) {
934
+ throw this.handleError(error, 'Failed to get configuration');
935
+ }
936
+ }
937
+ async buildVertex(params) {
896
938
  try {
897
- const response = await this.client.get(`/monitor/messages/${encodeURIComponent(messageId)}`);
939
+ const response = await this.client.post(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`, params.inputs || {});
898
940
  return response.data;
899
941
  }
900
942
  catch (error) {
901
- throw this.handleError(error, 'Failed to get monitor message');
943
+ throw this.handleError(error, `Failed to build vertex ${params.vertex_id}`);
902
944
  }
903
945
  }
904
- async getMonitorTransactionById(transactionId) {
946
+ async getHealth() {
905
947
  try {
906
- const response = await this.client.get(`/monitor/transactions/${encodeURIComponent(transactionId)}`);
948
+ const response = await this.client.get('/health', { baseURL: this.config.baseUrl });
907
949
  return response.data;
908
950
  }
909
951
  catch (error) {
910
- throw this.handleError(error, 'Failed to get monitor transaction');
952
+ throw this.handleError(error, 'Failed to get health status');
911
953
  }
912
954
  }
913
- async getMonitorVertexBuilds(params) {
955
+ async updateStoreComponent(componentId, updates) {
914
956
  try {
915
- const response = await this.client.get('/monitor/vertices/builds', { params });
957
+ const response = await this.client.patch(`/store/components/${encodeURIComponent(componentId)}`, updates);
916
958
  return response.data;
917
959
  }
918
960
  catch (error) {
919
- throw this.handleError(error, 'Failed to get monitor vertex builds');
961
+ throw this.handleError(error, `Failed to update store component ${componentId}`);
920
962
  }
921
963
  }
922
- async getMonitorVertexBuildById(vertexBuildId) {
964
+ async runFlowSession(flowIdOrName, request, stream = false) {
923
965
  try {
924
- const response = await this.client.get(`/monitor/vertices/builds/${encodeURIComponent(vertexBuildId)}`);
966
+ if (stream) {
967
+ throw new Error('Streaming run session responses are not supported by this MCP client');
968
+ }
969
+ const { context, ...inputRequest } = request;
970
+ const response = await this.client.post(`/run/session/${encodeURIComponent(flowIdOrName)}`, { input_request: inputRequest, context }, { params: { stream } });
925
971
  return response.data;
926
972
  }
927
973
  catch (error) {
928
- throw this.handleError(error, 'Failed to get monitor vertex build');
974
+ throw this.handleError(error, `Failed to run flow session ${flowIdOrName}`);
929
975
  }
930
976
  }
931
- async uploadTextData(params) {
977
+ async getRegistration() {
932
978
  try {
933
- const response = await this.client.post(`/files/upload/${encodeURIComponent(params.flow_id)}/text`, {
934
- text: params.text_data,
935
- file_name: params.file_name
979
+ const response = await this.client.get('/api/v2/registration/', {
980
+ baseURL: this.config.baseUrl
936
981
  });
937
982
  return response.data;
938
983
  }
939
984
  catch (error) {
940
- throw this.handleError(error, `Failed to upload text data to flow ${params.flow_id}`);
985
+ throw this.handleError(error, 'Failed to get registration status');
941
986
  }
942
987
  }
943
- async installStoreComponent(componentId) {
988
+ async registerUser(email) {
944
989
  try {
945
- const response = await this.client.post(`/store/components/${componentId}/install`);
990
+ const response = await this.client.post('/api/v2/registration/', { email }, { baseURL: this.config.baseUrl });
946
991
  return response.data;
947
992
  }
948
993
  catch (error) {
949
- throw this.handleError(error, `Failed to install store component ${componentId}`);
994
+ throw this.handleError(error, 'Failed to register user');
950
995
  }
951
996
  }
952
- async updateCustomComponent(componentId, updates) {
997
+ async replaceFlow(flowId, body) {
953
998
  try {
954
- const response = await this.client.patch(`/custom_component/${encodeURIComponent(componentId)}`, updates);
999
+ const response = await this.client.put(`/flows/${encodeURIComponent(flowId)}`, body);
955
1000
  return response.data;
956
1001
  }
957
1002
  catch (error) {
958
- throw this.handleError(error, `Failed to update custom component ${componentId}`);
1003
+ throw this.handleError(error, `Failed to replace flow ${flowId}`);
959
1004
  }
960
1005
  }
961
- async deleteCustomComponent(componentId) {
1006
+ async expandFlows(body) {
962
1007
  try {
963
- await this.client.delete(`/custom_component/${encodeURIComponent(componentId)}`);
1008
+ const response = await this.client.post('/flows/expand/', body);
1009
+ return response.data;
964
1010
  }
965
1011
  catch (error) {
966
- throw this.handleError(error, `Failed to delete custom component ${componentId}`);
1012
+ throw this.handleError(error, 'Failed to expand flows');
967
1013
  }
968
1014
  }
969
- async deleteUser(userId) {
1015
+ async getFlowEvents(flowId, params) {
970
1016
  try {
971
- await this.client.delete(`/users/${encodeURIComponent(userId)}`);
1017
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/events`, { params });
1018
+ return response.data;
972
1019
  }
973
1020
  catch (error) {
974
- throw this.handleError(error, `Failed to delete user ${userId}`);
1021
+ throw this.handleError(error, `Failed to get events for flow ${flowId}`);
975
1022
  }
976
1023
  }
977
- async getConfig() {
1024
+ async createFlowEvent(flowId, body) {
978
1025
  try {
979
- const response = await this.client.get('/config');
1026
+ const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/events`, body);
980
1027
  return response.data;
981
1028
  }
982
1029
  catch (error) {
983
- throw this.handleError(error, 'Failed to get configuration');
1030
+ throw this.handleError(error, `Failed to create event for flow ${flowId}`);
984
1031
  }
985
1032
  }
986
- async updateConfig(config) {
1033
+ async listFlowVersions(flowId, params) {
987
1034
  try {
988
- const response = await this.client.patch('/config', config);
1035
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/versions/`, { params });
989
1036
  return response.data;
990
1037
  }
991
1038
  catch (error) {
992
- throw this.handleError(error, 'Failed to update configuration');
1039
+ throw this.handleError(error, `Failed to list versions for flow ${flowId}`);
993
1040
  }
994
1041
  }
995
- async getStats() {
1042
+ async createFlowVersion(flowId, body) {
996
1043
  try {
997
- const response = await this.client.get('/stats');
1044
+ const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/versions/`, body ?? {});
998
1045
  return response.data;
999
1046
  }
1000
1047
  catch (error) {
1001
- throw this.handleError(error, 'Failed to get statistics');
1048
+ throw this.handleError(error, `Failed to create version for flow ${flowId}`);
1002
1049
  }
1003
1050
  }
1004
- async exportFlow(flowId) {
1051
+ async getFlowVersion(flowId, versionId) {
1005
1052
  try {
1006
- const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/export`);
1053
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}`);
1007
1054
  return response.data;
1008
1055
  }
1009
1056
  catch (error) {
1010
- throw this.handleError(error, `Failed to export flow ${flowId}`);
1057
+ throw this.handleError(error, `Failed to get version ${versionId} for flow ${flowId}`);
1058
+ }
1059
+ }
1060
+ async deleteFlowVersion(flowId, versionId) {
1061
+ try {
1062
+ await this.client.delete(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}`);
1063
+ }
1064
+ catch (error) {
1065
+ throw this.handleError(error, `Failed to delete version ${versionId} for flow ${flowId}`);
1011
1066
  }
1012
1067
  }
1013
- async importFlow(flowData) {
1068
+ async activateFlowVersion(flowId, versionId, params) {
1014
1069
  try {
1015
- const response = await this.client.post('/flows/import', flowData);
1070
+ const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}/activate`, undefined, { params });
1016
1071
  return response.data;
1017
1072
  }
1018
1073
  catch (error) {
1019
- throw this.handleError(error, 'Failed to import flow');
1074
+ throw this.handleError(error, `Failed to activate version ${versionId} for flow ${flowId}`);
1020
1075
  }
1021
1076
  }
1022
- async cloneFlow(flowId, name) {
1077
+ async detectVariables(body) {
1023
1078
  try {
1024
- const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/clone`, { name });
1079
+ const response = await this.client.post('/variables/detections', body);
1025
1080
  return response.data;
1026
1081
  }
1027
1082
  catch (error) {
1028
- throw this.handleError(error, `Failed to clone flow ${flowId}`);
1083
+ throw this.handleError(error, 'Failed to detect variables');
1029
1084
  }
1030
1085
  }
1031
- async getFlowDependencies(flowId) {
1086
+ async saveStoreApiKey(apiKey) {
1032
1087
  try {
1033
- const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/dependencies`);
1088
+ const response = await this.client.post('/api_key/store', { api_key: apiKey });
1034
1089
  return response.data;
1035
1090
  }
1036
1091
  catch (error) {
1037
- throw this.handleError(error, `Failed to get flow dependencies ${flowId}`);
1092
+ throw this.handleError(error, 'Failed to save store API key');
1038
1093
  }
1039
1094
  }
1040
- async getAiNodes() {
1095
+ async updateCustomComponentCode(body) {
1041
1096
  try {
1042
- const response = await this.client.get('/ai_nodes');
1097
+ const response = await this.client.post('/custom_component/update', body);
1043
1098
  return response.data;
1044
1099
  }
1045
1100
  catch (error) {
1046
- throw this.handleError(error, 'Failed to get AI nodes');
1101
+ throw this.handleError(error, 'Failed to update custom component code');
1047
1102
  }
1048
1103
  }
1049
- async buildVertex(params) {
1104
+ async createStoreComponent(body) {
1050
1105
  try {
1051
- const response = await this.client.post(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`, params.inputs || {});
1106
+ const response = await this.client.post('/store/components/', body);
1052
1107
  return response.data;
1053
1108
  }
1054
1109
  catch (error) {
1055
- throw this.handleError(error, `Failed to build vertex ${params.vertex_id}`);
1110
+ throw this.handleError(error, 'Failed to create store component');
1056
1111
  }
1057
1112
  }
1058
- async cancelExecution(params) {
1113
+ async likeStoreComponent(componentId) {
1059
1114
  try {
1060
- const response = await this.client.post(`/executions/${encodeURIComponent(params.execution_id)}/cancel`);
1115
+ const response = await this.client.post(`/store/users/likes/${encodeURIComponent(componentId)}`);
1061
1116
  return response.data;
1062
1117
  }
1063
1118
  catch (error) {
1064
- throw this.handleError(error, `Failed to cancel execution ${params.execution_id}`);
1119
+ throw this.handleError(error, `Failed to like store component ${componentId}`);
1065
1120
  }
1066
1121
  }
1067
- async getExecutionResult(params) {
1122
+ async createResponse(body) {
1068
1123
  try {
1069
- const response = await this.client.get(`/executions/${encodeURIComponent(params.execution_id)}/result`);
1124
+ const response = await this.client.post('/responses', body);
1070
1125
  return response.data;
1071
1126
  }
1072
1127
  catch (error) {
1073
- throw this.handleError(error, `Failed to get execution result ${params.execution_id}`);
1128
+ throw this.handleError(error, 'Failed to create response');
1074
1129
  }
1075
1130
  }
1076
- async getFileMetadata(params) {
1131
+ async getSession() {
1077
1132
  try {
1078
- const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.file_name)}/metadata`);
1133
+ const response = await this.client.get('/session');
1079
1134
  return response.data;
1080
1135
  }
1081
1136
  catch (error) {
1082
- throw this.handleError(error, `Failed to get file metadata ${params.file_name}`);
1137
+ throw this.handleError(error, 'Failed to get session');
1083
1138
  }
1084
1139
  }
1085
- async getHealth() {
1140
+ async createUser(body) {
1086
1141
  try {
1087
- const response = await this.client.get('/health');
1142
+ const response = await this.client.post('/users/', body);
1088
1143
  return response.data;
1089
1144
  }
1090
1145
  catch (error) {
1091
- throw this.handleError(error, 'Failed to get health status');
1146
+ throw this.handleError(error, 'Failed to create user');
1092
1147
  }
1093
1148
  }
1094
- async getUserById(userId) {
1149
+ async getWebhookEvents(flowIdOrName, params) {
1095
1150
  try {
1096
- const response = await this.client.get(`/users/${encodeURIComponent(userId)}`);
1151
+ const response = await this.client.get(`/webhook-events/${encodeURIComponent(flowIdOrName)}`, { params });
1097
1152
  return response.data;
1098
1153
  }
1099
1154
  catch (error) {
1100
- throw this.handleError(error, `Failed to get user ${userId}`);
1155
+ throw this.handleError(error, `Failed to get webhook events for ${flowIdOrName}`);
1101
1156
  }
1102
1157
  }
1103
- async listFilesDetailed(params) {
1158
+ async getHealthCheck() {
1104
1159
  try {
1105
- const response = await this.client.get(`/files/${encodeURIComponent(params.flow_id)}/detailed`);
1160
+ const response = await this.client.get('/health_check', { baseURL: this.config.baseUrl });
1106
1161
  return response.data;
1107
1162
  }
1108
1163
  catch (error) {
1109
- throw this.handleError(error, `Failed to get detailed file list for flow ${params.flow_id}`);
1164
+ throw this.handleError(error, 'Failed to get health check');
1110
1165
  }
1111
1166
  }
1112
- async register(username, password, email) {
1167
+ async uploadFlowFileLegacy(flowId, file, fileName) {
1113
1168
  try {
1114
- const response = await this.client.post('/register', {
1115
- username,
1116
- password,
1117
- email
1169
+ const formData = new form_data_1.default();
1170
+ formData.append('file', file, fileName);
1171
+ const response = await this.client.post(`/upload/${encodeURIComponent(flowId)}`, formData, {
1172
+ headers: {
1173
+ ...formData.getHeaders()
1174
+ }
1118
1175
  });
1119
1176
  return response.data;
1120
1177
  }
1121
1178
  catch (error) {
1122
- throw this.handleError(error, 'Failed to register user');
1179
+ throw this.handleError(error, `Failed to upload legacy file to flow ${flowId}`);
1123
1180
  }
1124
1181
  }
1125
- async runAdvancedExecution(params) {
1182
+ async listFilesV2() {
1126
1183
  try {
1127
- const { flow_id, ...request } = params;
1128
- const response = await this.client.post(`/executions/${encodeURIComponent(flow_id)}/advanced`, request);
1184
+ const response = await this.client.get('/api/v2/files', { baseURL: this.config.baseUrl });
1129
1185
  return response.data;
1130
1186
  }
1131
1187
  catch (error) {
1132
- throw this.handleError(error, `Failed to execute advanced flow ${params.flow_id}`);
1188
+ throw this.handleError(error, 'Failed to list files (v2)');
1133
1189
  }
1134
1190
  }
1135
- async searchStoreComponents(query, params) {
1191
+ async uploadFileV2(file, fileName, params) {
1136
1192
  try {
1137
- const response = await this.client.get('/store/components/search', {
1138
- params: { q: query, ...params }
1193
+ const formData = new form_data_1.default();
1194
+ formData.append('file', file, fileName);
1195
+ const response = await this.client.post('/api/v2/files', formData, {
1196
+ baseURL: this.config.baseUrl,
1197
+ params,
1198
+ headers: {
1199
+ ...formData.getHeaders()
1200
+ }
1139
1201
  });
1140
1202
  return response.data;
1141
1203
  }
1142
1204
  catch (error) {
1143
- throw this.handleError(error, 'Failed to search store components');
1205
+ throw this.handleError(error, 'Failed to upload file (v2)');
1144
1206
  }
1145
1207
  }
1146
- async uninstallStoreComponent(componentId) {
1208
+ async getFileV2(fileId, params) {
1147
1209
  try {
1148
- const response = await this.client.delete(`/store/components/${componentId}/uninstall`);
1210
+ const response = await this.client.get(`/api/v2/files/${encodeURIComponent(fileId)}`, {
1211
+ baseURL: this.config.baseUrl,
1212
+ params
1213
+ });
1149
1214
  return response.data;
1150
1215
  }
1151
1216
  catch (error) {
1152
- throw this.handleError(error, `Failed to uninstall store component ${componentId}`);
1217
+ throw this.handleError(error, `Failed to get file ${fileId} (v2)`);
1153
1218
  }
1154
1219
  }
1155
- async updateStoreComponent(componentId, updates) {
1220
+ async renameFileV2(fileId, name) {
1156
1221
  try {
1157
- const response = await this.client.patch(`/store/components/${encodeURIComponent(componentId)}`, updates);
1222
+ const response = await this.client.put(`/api/v2/files/${encodeURIComponent(fileId)}`, undefined, {
1223
+ baseURL: this.config.baseUrl,
1224
+ params: { name }
1225
+ });
1158
1226
  return response.data;
1159
1227
  }
1160
1228
  catch (error) {
1161
- throw this.handleError(error, `Failed to update store component ${componentId}`);
1229
+ throw this.handleError(error, `Failed to rename file ${fileId} (v2)`);
1162
1230
  }
1163
1231
  }
1164
- async runFlowSession(flowIdOrName, request, stream = false) {
1232
+ async deleteFileV2(fileId) {
1165
1233
  try {
1166
- const response = await this.client.post(`/run/session/${encodeURIComponent(flowIdOrName)}`, { ...request, stream });
1234
+ const response = await this.client.delete(`/api/v2/files/${encodeURIComponent(fileId)}`, {
1235
+ baseURL: this.config.baseUrl
1236
+ });
1167
1237
  return response.data;
1168
1238
  }
1169
1239
  catch (error) {
1170
- throw this.handleError(error, `Failed to run flow session ${flowIdOrName}`);
1240
+ throw this.handleError(error, `Failed to delete file ${fileId} (v2)`);
1171
1241
  }
1172
1242
  }
1173
- async getRegistration() {
1243
+ async deleteAllFilesV2() {
1174
1244
  try {
1175
- const response = await this.client.get('/api/v2/registration/', {
1245
+ const response = await this.client.delete('/api/v2/files', { baseURL: this.config.baseUrl });
1246
+ return response.data;
1247
+ }
1248
+ catch (error) {
1249
+ throw this.handleError(error, 'Failed to delete all files (v2)');
1250
+ }
1251
+ }
1252
+ async batchDownloadFilesV2(fileIds) {
1253
+ try {
1254
+ const response = await this.client.post('/api/v2/files/batch/', fileIds, {
1176
1255
  baseURL: this.config.baseUrl
1177
1256
  });
1178
1257
  return response.data;
1179
1258
  }
1180
1259
  catch (error) {
1181
- throw this.handleError(error, 'Failed to get registration status');
1260
+ throw this.handleError(error, 'Failed to batch download files (v2)');
1182
1261
  }
1183
1262
  }
1184
- async registerUser(email) {
1263
+ async batchDeleteFilesV2(fileIds) {
1185
1264
  try {
1186
- const response = await this.client.post('/api/v2/registration/', { email }, { baseURL: this.config.baseUrl });
1265
+ const response = await this.client.delete('/api/v2/files/batch/', {
1266
+ baseURL: this.config.baseUrl,
1267
+ data: fileIds
1268
+ });
1187
1269
  return response.data;
1188
1270
  }
1189
1271
  catch (error) {
1190
- throw this.handleError(error, 'Failed to register user');
1272
+ throw this.handleError(error, 'Failed to batch delete files (v2)');
1273
+ }
1274
+ }
1275
+ async listKnowledgeBasesDetailed() {
1276
+ try {
1277
+ const response = await this.client.get('/knowledge_bases/');
1278
+ return response.data;
1279
+ }
1280
+ catch (error) {
1281
+ throw this.handleError(error, 'Failed to list knowledge bases (detailed)');
1282
+ }
1283
+ }
1284
+ async createKnowledgeBase(body) {
1285
+ try {
1286
+ const response = await this.client.post('/knowledge_bases', body);
1287
+ return response.data;
1288
+ }
1289
+ catch (error) {
1290
+ throw this.handleError(error, 'Failed to create knowledge base');
1291
+ }
1292
+ }
1293
+ async previewKnowledgeBaseChunks(files, body) {
1294
+ try {
1295
+ const formData = new form_data_1.default();
1296
+ files.forEach((file, idx) => {
1297
+ formData.append('files', file.buffer, file.filename || `file-${idx}`);
1298
+ });
1299
+ if (body) {
1300
+ Object.entries(body).forEach(([key, value]) => {
1301
+ formData.append(key, typeof value === 'string' ? value : JSON.stringify(value));
1302
+ });
1303
+ }
1304
+ const response = await this.client.post('/knowledge_bases/preview-chunks', formData, {
1305
+ headers: {
1306
+ ...formData.getHeaders()
1307
+ }
1308
+ });
1309
+ return response.data;
1310
+ }
1311
+ catch (error) {
1312
+ throw this.handleError(error, 'Failed to preview knowledge base chunks');
1313
+ }
1314
+ }
1315
+ async listKnowledgeBaseChunks(kbName, params) {
1316
+ try {
1317
+ const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/chunks`, { params });
1318
+ return response.data;
1319
+ }
1320
+ catch (error) {
1321
+ throw this.handleError(error, `Failed to list chunks for knowledge base ${kbName}`);
1322
+ }
1323
+ }
1324
+ async ingestKnowledgeBase(kbName, files, body) {
1325
+ try {
1326
+ const formData = new form_data_1.default();
1327
+ files.forEach((file, idx) => {
1328
+ formData.append('files', file.buffer, file.filename || `file-${idx}`);
1329
+ });
1330
+ if (body) {
1331
+ Object.entries(body).forEach(([key, value]) => {
1332
+ formData.append(key, typeof value === 'string' ? value : JSON.stringify(value));
1333
+ });
1334
+ }
1335
+ const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest`, formData, {
1336
+ headers: {
1337
+ ...formData.getHeaders()
1338
+ }
1339
+ });
1340
+ return response.data;
1341
+ }
1342
+ catch (error) {
1343
+ throw this.handleError(error, `Failed to ingest knowledge base ${kbName}`);
1344
+ }
1345
+ }
1346
+ async cancelKnowledgeBaseIngest(kbName) {
1347
+ try {
1348
+ const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/cancel`);
1349
+ return response.data;
1350
+ }
1351
+ catch (error) {
1352
+ throw this.handleError(error, `Failed to cancel ingest for knowledge base ${kbName}`);
1353
+ }
1354
+ }
1355
+ async updateMonitorMessage(messageId, body) {
1356
+ try {
1357
+ const response = await this.client.put(`/monitor/messages/${encodeURIComponent(messageId)}`, body);
1358
+ return response.data;
1359
+ }
1360
+ catch (error) {
1361
+ throw this.handleError(error, `Failed to update monitor message ${messageId}`);
1362
+ }
1363
+ }
1364
+ async deleteMonitorSessionMessages(sessionId) {
1365
+ try {
1366
+ const response = await this.client.delete(`/monitor/messages/session/${encodeURIComponent(sessionId)}`);
1367
+ return response.data;
1368
+ }
1369
+ catch (error) {
1370
+ throw this.handleError(error, `Failed to delete messages for session ${sessionId}`);
1371
+ }
1372
+ }
1373
+ async deleteMonitorSessions(sessionIds) {
1374
+ try {
1375
+ const response = await this.client.delete('/monitor/messages/sessions', { data: sessionIds });
1376
+ return response.data;
1377
+ }
1378
+ catch (error) {
1379
+ throw this.handleError(error, 'Failed to delete monitor sessions');
1380
+ }
1381
+ }
1382
+ async getSharedMessages(params) {
1383
+ try {
1384
+ const response = await this.client.get('/monitor/messages/shared', { params });
1385
+ return response.data;
1386
+ }
1387
+ catch (error) {
1388
+ throw this.handleError(error, 'Failed to get shared messages');
1191
1389
  }
1192
1390
  }
1193
- async validateConnection(connectionData) {
1391
+ async getSharedSessions(sourceFlowId) {
1194
1392
  try {
1195
- const response = await this.client.post('/validate/connection', connectionData);
1393
+ const response = await this.client.get('/monitor/messages/shared/sessions', {
1394
+ params: { source_flow_id: sourceFlowId }
1395
+ });
1396
+ return response.data;
1397
+ }
1398
+ catch (error) {
1399
+ throw this.handleError(error, 'Failed to get shared sessions');
1400
+ }
1401
+ }
1402
+ async updateSharedMessage(messageId, sourceFlowId, body) {
1403
+ try {
1404
+ const response = await this.client.put(`/monitor/messages/shared/${encodeURIComponent(messageId)}`, body, { params: { source_flow_id: sourceFlowId } });
1405
+ return response.data;
1406
+ }
1407
+ catch (error) {
1408
+ throw this.handleError(error, `Failed to update shared message ${messageId}`);
1409
+ }
1410
+ }
1411
+ async migrateSharedSession(oldSessionId, params) {
1412
+ try {
1413
+ const response = await this.client.patch(`/monitor/messages/shared/session/${encodeURIComponent(oldSessionId)}`, null, { params });
1414
+ return response.data;
1415
+ }
1416
+ catch (error) {
1417
+ throw this.handleError(error, `Failed to migrate shared session ${oldSessionId}`);
1418
+ }
1419
+ }
1420
+ async deleteSharedSession(sessionId, sourceFlowId) {
1421
+ try {
1422
+ const response = await this.client.delete(`/monitor/messages/shared/session/${encodeURIComponent(sessionId)}`, { params: { source_flow_id: sourceFlowId } });
1423
+ return response.data;
1424
+ }
1425
+ catch (error) {
1426
+ throw this.handleError(error, `Failed to delete shared session ${sessionId}`);
1427
+ }
1428
+ }
1429
+ async listTraces(params) {
1430
+ try {
1431
+ const response = await this.client.get('/monitor/traces', { params });
1432
+ return response.data;
1433
+ }
1434
+ catch (error) {
1435
+ throw this.handleError(error, 'Failed to list traces');
1436
+ }
1437
+ }
1438
+ async deleteTraces(flowId) {
1439
+ try {
1440
+ const response = await this.client.delete('/monitor/traces', { params: { flow_id: flowId } });
1196
1441
  return response.data;
1197
1442
  }
1198
1443
  catch (error) {
1199
- throw this.handleError(error, 'Failed to validate connection');
1444
+ throw this.handleError(error, `Failed to delete traces for flow ${flowId}`);
1200
1445
  }
1201
1446
  }
1202
- async validateFlow(params) {
1447
+ async getTrace(traceId) {
1203
1448
  try {
1204
- const response = await this.client.post(`/flows/${encodeURIComponent(params.flow_id)}/validate`);
1449
+ const response = await this.client.get(`/monitor/traces/${encodeURIComponent(traceId)}`);
1450
+ return response.data;
1451
+ }
1452
+ catch (error) {
1453
+ throw this.handleError(error, `Failed to get trace ${traceId}`);
1454
+ }
1455
+ }
1456
+ async deleteTrace(traceId) {
1457
+ try {
1458
+ await this.client.delete(`/monitor/traces/${encodeURIComponent(traceId)}`);
1459
+ }
1460
+ catch (error) {
1461
+ throw this.handleError(error, `Failed to delete trace ${traceId}`);
1462
+ }
1463
+ }
1464
+ async listModels(params) {
1465
+ try {
1466
+ const response = await this.client.get('/models', { params });
1467
+ return response.data;
1468
+ }
1469
+ catch (error) {
1470
+ throw this.handleError(error, 'Failed to list models');
1471
+ }
1472
+ }
1473
+ async listModelProviders(params) {
1474
+ try {
1475
+ const response = await this.client.get('/models/providers', { params });
1476
+ return response.data;
1477
+ }
1478
+ catch (error) {
1479
+ throw this.handleError(error, 'Failed to list model providers');
1480
+ }
1481
+ }
1482
+ async listModelProviderDescriptors(params) {
1483
+ try {
1484
+ const response = await this.client.get('/models/provider-descriptors', { params });
1485
+ return response.data;
1486
+ }
1487
+ catch (error) {
1488
+ throw this.handleError(error, 'Failed to list model provider descriptors');
1489
+ }
1490
+ }
1491
+ async listEnabledProviders(params) {
1492
+ try {
1493
+ const response = await this.client.get('/models/enabled_providers', {
1494
+ params,
1495
+ paramsSerializer: { indexes: null }
1496
+ });
1497
+ return response.data;
1498
+ }
1499
+ catch (error) {
1500
+ throw this.handleError(error, 'Failed to list enabled providers');
1501
+ }
1502
+ }
1503
+ async listEnabledModels(params) {
1504
+ try {
1505
+ const response = await this.client.get('/models/enabled_models', {
1506
+ params,
1507
+ paramsSerializer: { indexes: null }
1508
+ });
1509
+ return response.data;
1510
+ }
1511
+ catch (error) {
1512
+ throw this.handleError(error, 'Failed to list enabled models');
1513
+ }
1514
+ }
1515
+ async setEnabledModels(body) {
1516
+ try {
1517
+ const response = await this.client.post('/models/enabled_models', body);
1518
+ return response.data;
1519
+ }
1520
+ catch (error) {
1521
+ throw this.handleError(error, 'Failed to set enabled models');
1522
+ }
1523
+ }
1524
+ async getDefaultModel(params) {
1525
+ try {
1526
+ const response = await this.client.get('/models/default_model', { params });
1527
+ return response.data;
1528
+ }
1529
+ catch (error) {
1530
+ throw this.handleError(error, 'Failed to get default model');
1531
+ }
1532
+ }
1533
+ async setDefaultModel(body) {
1534
+ try {
1535
+ const response = await this.client.post('/models/default_model', body);
1536
+ return response.data;
1537
+ }
1538
+ catch (error) {
1539
+ throw this.handleError(error, 'Failed to set default model');
1540
+ }
1541
+ }
1542
+ async deleteDefaultModel(params) {
1543
+ try {
1544
+ const response = await this.client.delete('/models/default_model', { params });
1545
+ return response.data;
1546
+ }
1547
+ catch (error) {
1548
+ throw this.handleError(error, 'Failed to delete default model');
1549
+ }
1550
+ }
1551
+ async getProviderVariableMapping(params) {
1552
+ try {
1553
+ const response = await this.client.get('/models/provider-variable-mapping', { params });
1554
+ return response.data;
1555
+ }
1556
+ catch (error) {
1557
+ throw this.handleError(error, 'Failed to get provider variable mapping');
1558
+ }
1559
+ }
1560
+ async validateModelProvider(body) {
1561
+ try {
1562
+ const response = await this.client.post('/models/validate-provider', body);
1563
+ return response.data;
1564
+ }
1565
+ catch (error) {
1566
+ throw this.handleError(error, 'Failed to validate model provider');
1567
+ }
1568
+ }
1569
+ async getModelProviderPolicy() {
1570
+ try {
1571
+ const response = await this.client.get('/model-provider-policy');
1572
+ return response.data;
1573
+ }
1574
+ catch (error) {
1575
+ throw this.handleError(error, 'Failed to get model provider policy');
1576
+ }
1577
+ }
1578
+ async replaceModelProviderPolicy(body) {
1579
+ try {
1580
+ const response = await this.client.put('/model-provider-policy', body);
1581
+ return response.data;
1582
+ }
1583
+ catch (error) {
1584
+ throw this.handleError(error, 'Failed to replace model provider policy');
1585
+ }
1586
+ }
1587
+ async getCatalogComponentPolicy() {
1588
+ try {
1589
+ const response = await this.client.get('/catalog-policy/components');
1590
+ return response.data;
1591
+ }
1592
+ catch (error) {
1593
+ throw this.handleError(error, 'Failed to get catalog component policy');
1594
+ }
1595
+ }
1596
+ async replaceCatalogComponentPolicy(body) {
1597
+ try {
1598
+ const response = await this.client.put('/catalog-policy/components', body);
1599
+ return response.data;
1600
+ }
1601
+ catch (error) {
1602
+ throw this.handleError(error, 'Failed to replace catalog component policy');
1603
+ }
1604
+ }
1605
+ async getCatalogTemplatePolicy() {
1606
+ try {
1607
+ const response = await this.client.get('/catalog-policy/templates');
1608
+ return response.data;
1609
+ }
1610
+ catch (error) {
1611
+ throw this.handleError(error, 'Failed to get catalog template policy');
1612
+ }
1613
+ }
1614
+ async replaceCatalogTemplatePolicy(body) {
1615
+ try {
1616
+ const response = await this.client.put('/catalog-policy/templates', body);
1617
+ return response.data;
1618
+ }
1619
+ catch (error) {
1620
+ throw this.handleError(error, 'Failed to replace catalog template policy');
1621
+ }
1622
+ }
1623
+ async getCatalogPolicyUsage() {
1624
+ try {
1625
+ const response = await this.client.get('/catalog-policy/usage');
1626
+ return response.data;
1627
+ }
1628
+ catch (error) {
1629
+ throw this.handleError(error, 'Failed to get catalog policy usage');
1630
+ }
1631
+ }
1632
+ async getCatalogPolicyUsageFlows(params) {
1633
+ try {
1634
+ const response = await this.client.get('/catalog-policy/usage/flows', { params });
1635
+ return response.data;
1636
+ }
1637
+ catch (error) {
1638
+ throw this.handleError(error, 'Failed to get catalog policy usage flows');
1639
+ }
1640
+ }
1641
+ async getPolicyBundle() {
1642
+ try {
1643
+ const response = await this.client.get('/policy-bundle');
1644
+ return response.data;
1645
+ }
1646
+ catch (error) {
1647
+ throw this.handleError(error, 'Failed to get policy bundle');
1648
+ }
1649
+ }
1650
+ async replacePolicyBundle(body) {
1651
+ try {
1652
+ const response = await this.client.put('/policy-bundle', body);
1653
+ return response.data;
1654
+ }
1655
+ catch (error) {
1656
+ throw this.handleError(error, 'Failed to replace policy bundle');
1657
+ }
1658
+ }
1659
+ async listPolicyBundleHistory(params) {
1660
+ try {
1661
+ const response = await this.client.get('/policy-bundle/history', { params });
1662
+ return response.data;
1663
+ }
1664
+ catch (error) {
1665
+ throw this.handleError(error, 'Failed to list policy bundle history');
1666
+ }
1667
+ }
1668
+ async rollbackPolicyBundle(revision, body) {
1669
+ try {
1670
+ const response = await this.client.post(`/policy-bundle/rollback/${encodeURIComponent(revision)}`, body);
1671
+ return response.data;
1672
+ }
1673
+ catch (error) {
1674
+ throw this.handleError(error, `Failed to roll back policy bundle revision ${revision}`);
1675
+ }
1676
+ }
1677
+ async getLanguageModelOptions(params) {
1678
+ try {
1679
+ const response = await this.client.get('/model_options/language', { params });
1680
+ return response.data;
1681
+ }
1682
+ catch (error) {
1683
+ throw this.handleError(error, 'Failed to get language model options');
1684
+ }
1685
+ }
1686
+ async getEmbeddingModelOptions(params) {
1687
+ try {
1688
+ const response = await this.client.get('/model_options/embedding', { params });
1689
+ return response.data;
1690
+ }
1691
+ catch (error) {
1692
+ throw this.handleError(error, 'Failed to get embedding model options');
1693
+ }
1694
+ }
1695
+ async agenticAssist(body) {
1696
+ try {
1697
+ const response = await this.client.post('/agentic/assist', body);
1698
+ return response.data;
1699
+ }
1700
+ catch (error) {
1701
+ throw this.handleError(error, 'Failed to run agentic assist');
1702
+ }
1703
+ }
1704
+ async agenticAssistStream(body) {
1705
+ try {
1706
+ const response = await this.client.post('/agentic/assist/stream', body, {
1707
+ responseType: 'text'
1708
+ });
1709
+ return response.data;
1710
+ }
1711
+ catch (error) {
1712
+ throw this.handleError(error, 'Failed to run streaming agentic assist');
1713
+ }
1714
+ }
1715
+ async agenticAssistRun(body) {
1716
+ try {
1717
+ const response = await this.client.post('/agentic/assist/run', body, {
1718
+ responseType: 'text'
1719
+ });
1720
+ return response.data;
1721
+ }
1722
+ catch (error) {
1723
+ throw this.handleError(error, 'Failed to run headless agentic assist');
1724
+ }
1725
+ }
1726
+ async agenticCheckConfig() {
1727
+ try {
1728
+ const response = await this.client.get('/agentic/check-config');
1729
+ return response.data;
1730
+ }
1731
+ catch (error) {
1732
+ throw this.handleError(error, 'Failed to check agentic config');
1733
+ }
1734
+ }
1735
+ async agenticExecute(flowName, body) {
1736
+ try {
1737
+ const response = await this.client.post(`/agentic/execute/${encodeURIComponent(flowName)}`, body);
1738
+ return response.data;
1739
+ }
1740
+ catch (error) {
1741
+ throw this.handleError(error, `Failed to run agentic execute for flow ${flowName}`);
1742
+ }
1743
+ }
1744
+ async getWorkflowResult(params) {
1745
+ try {
1746
+ const response = await this.client.get('/api/v2/workflows', {
1747
+ baseURL: this.config.baseUrl,
1748
+ params
1749
+ });
1750
+ return response.data;
1751
+ }
1752
+ catch (error) {
1753
+ throw this.handleError(error, 'Failed to get workflow result');
1754
+ }
1755
+ }
1756
+ async runWorkflow(body) {
1757
+ try {
1758
+ const response = await this.client.post('/api/v2/workflows', body, {
1759
+ baseURL: this.config.baseUrl
1760
+ });
1761
+ return response.data;
1762
+ }
1763
+ catch (error) {
1764
+ throw this.handleError(error, 'Failed to run workflow');
1765
+ }
1766
+ }
1767
+ async stopWorkflow(jobId) {
1768
+ try {
1769
+ const response = await this.client.post('/api/v2/workflows/stop', { job_id: jobId }, { baseURL: this.config.baseUrl });
1770
+ return response.data;
1771
+ }
1772
+ catch (error) {
1773
+ throw this.handleError(error, `Failed to stop workflow ${jobId}`);
1774
+ }
1775
+ }
1776
+ async listMcpServers(params) {
1777
+ try {
1778
+ const response = await this.client.get('/api/v2/mcp/servers', {
1779
+ baseURL: this.config.baseUrl,
1780
+ params
1781
+ });
1782
+ return response.data;
1783
+ }
1784
+ catch (error) {
1785
+ throw this.handleError(error, 'Failed to list MCP servers');
1786
+ }
1787
+ }
1788
+ async getMcpServer(serverName) {
1789
+ try {
1790
+ const response = await this.client.get(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, {
1791
+ baseURL: this.config.baseUrl
1792
+ });
1793
+ return response.data;
1794
+ }
1795
+ catch (error) {
1796
+ throw this.handleError(error, `Failed to get MCP server ${serverName}`);
1797
+ }
1798
+ }
1799
+ async createMcpServer(serverName, body) {
1800
+ try {
1801
+ const response = await this.client.post(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, body, { baseURL: this.config.baseUrl });
1802
+ return response.data;
1803
+ }
1804
+ catch (error) {
1805
+ throw this.handleError(error, `Failed to create MCP server ${serverName}`);
1806
+ }
1807
+ }
1808
+ async updateMcpServer(serverName, body) {
1809
+ try {
1810
+ const response = await this.client.patch(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, body, { baseURL: this.config.baseUrl });
1811
+ return response.data;
1812
+ }
1813
+ catch (error) {
1814
+ throw this.handleError(error, `Failed to update MCP server ${serverName}`);
1815
+ }
1816
+ }
1817
+ async deleteMcpServer(serverName) {
1818
+ try {
1819
+ const response = await this.client.delete(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, { baseURL: this.config.baseUrl });
1820
+ return response.data;
1821
+ }
1822
+ catch (error) {
1823
+ throw this.handleError(error, `Failed to delete MCP server ${serverName}`);
1824
+ }
1825
+ }
1826
+ async getMcpProjectConfig(projectId, params) {
1827
+ try {
1828
+ const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}`, { params });
1829
+ return response.data;
1830
+ }
1831
+ catch (error) {
1832
+ throw this.handleError(error, `Failed to get MCP project config ${projectId}`);
1833
+ }
1834
+ }
1835
+ async updateMcpProjectConfig(projectId, body) {
1836
+ try {
1837
+ const response = await this.client.patch(`/mcp/project/${encodeURIComponent(projectId)}`, body);
1838
+ return response.data;
1839
+ }
1840
+ catch (error) {
1841
+ throw this.handleError(error, `Failed to update MCP project config ${projectId}`);
1842
+ }
1843
+ }
1844
+ async getMcpProjectInstalled(projectId) {
1845
+ try {
1846
+ const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}/installed`);
1847
+ return response.data;
1848
+ }
1849
+ catch (error) {
1850
+ throw this.handleError(error, `Failed to get MCP project installed ${projectId}`);
1851
+ }
1852
+ }
1853
+ async installMcpProject(projectId, body) {
1854
+ try {
1855
+ const response = await this.client.post(`/mcp/project/${encodeURIComponent(projectId)}/install`, body);
1856
+ return response.data;
1857
+ }
1858
+ catch (error) {
1859
+ throw this.handleError(error, `Failed to install MCP project ${projectId}`);
1860
+ }
1861
+ }
1862
+ async getMcpProjectComposerUrl(projectId) {
1863
+ try {
1864
+ const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}/composer-url`);
1865
+ return response.data;
1866
+ }
1867
+ catch (error) {
1868
+ throw this.handleError(error, `Failed to get MCP project composer URL ${projectId}`);
1869
+ }
1870
+ }
1871
+ async listAuthzRoles(params) {
1872
+ try {
1873
+ const response = await this.client.get('/authz/roles', { params });
1874
+ return response.data;
1875
+ }
1876
+ catch (error) {
1877
+ throw this.handleError(error, 'Failed to list authz roles');
1878
+ }
1879
+ }
1880
+ async getAuthzRole(roleId) {
1881
+ try {
1882
+ const response = await this.client.get(`/authz/roles/${encodeURIComponent(roleId)}`);
1883
+ return response.data;
1884
+ }
1885
+ catch (error) {
1886
+ throw this.handleError(error, `Failed to get authz role ${roleId}`);
1887
+ }
1888
+ }
1889
+ async createAuthzRole(body) {
1890
+ try {
1891
+ const response = await this.client.post('/authz/roles', body);
1892
+ return response.data;
1893
+ }
1894
+ catch (error) {
1895
+ throw this.handleError(error, 'Failed to create authz role');
1896
+ }
1897
+ }
1898
+ async updateAuthzRole(roleId, body) {
1899
+ try {
1900
+ const response = await this.client.patch(`/authz/roles/${encodeURIComponent(roleId)}`, body);
1901
+ return response.data;
1902
+ }
1903
+ catch (error) {
1904
+ throw this.handleError(error, `Failed to update authz role ${roleId}`);
1905
+ }
1906
+ }
1907
+ async deleteAuthzRole(roleId) {
1908
+ try {
1909
+ await this.client.delete(`/authz/roles/${encodeURIComponent(roleId)}`);
1910
+ }
1911
+ catch (error) {
1912
+ throw this.handleError(error, `Failed to delete authz role ${roleId}`);
1913
+ }
1914
+ }
1915
+ async listAuthzRoleAssignments(params) {
1916
+ try {
1917
+ const response = await this.client.get('/authz/role-assignments', { params });
1918
+ return response.data;
1919
+ }
1920
+ catch (error) {
1921
+ throw this.handleError(error, 'Failed to list authz role assignments');
1922
+ }
1923
+ }
1924
+ async createAuthzRoleAssignment(body) {
1925
+ try {
1926
+ const response = await this.client.post('/authz/role-assignments', body);
1927
+ return response.data;
1928
+ }
1929
+ catch (error) {
1930
+ throw this.handleError(error, 'Failed to create authz role assignment');
1931
+ }
1932
+ }
1933
+ async deleteAuthzRoleAssignment(assignmentId) {
1934
+ try {
1935
+ await this.client.delete(`/authz/role-assignments/${encodeURIComponent(assignmentId)}`);
1936
+ }
1937
+ catch (error) {
1938
+ throw this.handleError(error, `Failed to delete authz role assignment ${assignmentId}`);
1939
+ }
1940
+ }
1941
+ async listAuthzTeams(params) {
1942
+ try {
1943
+ const response = await this.client.get('/authz/teams', { params });
1944
+ return response.data;
1945
+ }
1946
+ catch (error) {
1947
+ throw this.handleError(error, 'Failed to list authz teams');
1948
+ }
1949
+ }
1950
+ async getAuthzTeam(teamId) {
1951
+ try {
1952
+ const response = await this.client.get(`/authz/teams/${encodeURIComponent(teamId)}`);
1953
+ return response.data;
1954
+ }
1955
+ catch (error) {
1956
+ throw this.handleError(error, `Failed to get authz team ${teamId}`);
1957
+ }
1958
+ }
1959
+ async createAuthzTeam(body) {
1960
+ try {
1961
+ const response = await this.client.post('/authz/teams', body);
1962
+ return response.data;
1963
+ }
1964
+ catch (error) {
1965
+ throw this.handleError(error, 'Failed to create authz team');
1966
+ }
1967
+ }
1968
+ async updateAuthzTeam(teamId, body) {
1969
+ try {
1970
+ const response = await this.client.patch(`/authz/teams/${encodeURIComponent(teamId)}`, body);
1971
+ return response.data;
1972
+ }
1973
+ catch (error) {
1974
+ throw this.handleError(error, `Failed to update authz team ${teamId}`);
1975
+ }
1976
+ }
1977
+ async deleteAuthzTeam(teamId) {
1978
+ try {
1979
+ await this.client.delete(`/authz/teams/${encodeURIComponent(teamId)}`);
1980
+ }
1981
+ catch (error) {
1982
+ throw this.handleError(error, `Failed to delete authz team ${teamId}`);
1983
+ }
1984
+ }
1985
+ async listAuthzTeamMembers(teamId, params) {
1986
+ try {
1987
+ const response = await this.client.get(`/authz/teams/${encodeURIComponent(teamId)}/members`, { params });
1988
+ return response.data;
1989
+ }
1990
+ catch (error) {
1991
+ throw this.handleError(error, `Failed to list members for authz team ${teamId}`);
1992
+ }
1993
+ }
1994
+ async addAuthzTeamMember(teamId, body) {
1995
+ try {
1996
+ const response = await this.client.post(`/authz/teams/${encodeURIComponent(teamId)}/members`, body);
1997
+ return response.data;
1998
+ }
1999
+ catch (error) {
2000
+ throw this.handleError(error, `Failed to add member to authz team ${teamId}`);
2001
+ }
2002
+ }
2003
+ async removeAuthzTeamMember(teamId, userId) {
2004
+ try {
2005
+ await this.client.delete(`/authz/teams/${encodeURIComponent(teamId)}/members/${encodeURIComponent(userId)}`);
2006
+ }
2007
+ catch (error) {
2008
+ throw this.handleError(error, `Failed to remove member ${userId} from authz team ${teamId}`);
2009
+ }
2010
+ }
2011
+ async listAuthzShares(params) {
2012
+ try {
2013
+ const response = await this.client.get('/authz/shares', { params });
2014
+ return response.data;
2015
+ }
2016
+ catch (error) {
2017
+ throw this.handleError(error, 'Failed to list authz shares');
2018
+ }
2019
+ }
2020
+ async getAuthzShare(shareId) {
2021
+ try {
2022
+ const response = await this.client.get(`/authz/shares/${encodeURIComponent(shareId)}`);
2023
+ return response.data;
2024
+ }
2025
+ catch (error) {
2026
+ throw this.handleError(error, `Failed to get authz share ${shareId}`);
2027
+ }
2028
+ }
2029
+ async createAuthzShare(body) {
2030
+ try {
2031
+ const response = await this.client.post('/authz/shares', body);
2032
+ return response.data;
2033
+ }
2034
+ catch (error) {
2035
+ throw this.handleError(error, 'Failed to create authz share');
2036
+ }
2037
+ }
2038
+ async updateAuthzShare(shareId, body) {
2039
+ try {
2040
+ const response = await this.client.patch(`/authz/shares/${encodeURIComponent(shareId)}`, body);
2041
+ return response.data;
2042
+ }
2043
+ catch (error) {
2044
+ throw this.handleError(error, `Failed to update authz share ${shareId}`);
2045
+ }
2046
+ }
2047
+ async deleteAuthzShare(shareId) {
2048
+ try {
2049
+ await this.client.delete(`/authz/shares/${encodeURIComponent(shareId)}`);
2050
+ }
2051
+ catch (error) {
2052
+ throw this.handleError(error, `Failed to delete authz share ${shareId}`);
2053
+ }
2054
+ }
2055
+ async getAuthzAudit(params) {
2056
+ try {
2057
+ const response = await this.client.get('/authz/audit', {
2058
+ params,
2059
+ paramsSerializer: { indexes: null }
2060
+ });
2061
+ return response.data;
2062
+ }
2063
+ catch (error) {
2064
+ throw this.handleError(error, 'Failed to get authz audit log');
2065
+ }
2066
+ }
2067
+ async getMyPermissions(body) {
2068
+ try {
2069
+ const response = await this.client.post('/authz/me/permissions', body);
2070
+ return response.data;
2071
+ }
2072
+ catch (error) {
2073
+ throw this.handleError(error, 'Failed to get effective permissions');
2074
+ }
2075
+ }
2076
+ async createMemoryBase(body) {
2077
+ try {
2078
+ const response = await this.client.post('/memories', body);
2079
+ return response.data;
2080
+ }
2081
+ catch (error) {
2082
+ throw this.handleError(error, 'Failed to create memory base');
2083
+ }
2084
+ }
2085
+ async listMemoryBases(params) {
2086
+ try {
2087
+ const response = await this.client.get('/memories', { params });
2088
+ return response.data;
2089
+ }
2090
+ catch (error) {
2091
+ throw this.handleError(error, 'Failed to list memory bases');
2092
+ }
2093
+ }
2094
+ async getMemoryBase(memoryBaseId) {
2095
+ try {
2096
+ const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}`);
2097
+ return response.data;
2098
+ }
2099
+ catch (error) {
2100
+ throw this.handleError(error, `Failed to get memory base ${memoryBaseId}`);
2101
+ }
2102
+ }
2103
+ async listMemoryBaseSessions(memoryBaseId, params) {
2104
+ try {
2105
+ const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/sessions`, { params });
2106
+ return response.data;
2107
+ }
2108
+ catch (error) {
2109
+ throw this.handleError(error, `Failed to list sessions for memory base ${memoryBaseId}`);
2110
+ }
2111
+ }
2112
+ async listMemoryBaseMessages(memoryBaseId, params) {
2113
+ try {
2114
+ const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/messages`, { params });
2115
+ return response.data;
2116
+ }
2117
+ catch (error) {
2118
+ throw this.handleError(error, `Failed to list messages for memory base ${memoryBaseId}`);
2119
+ }
2120
+ }
2121
+ async updateMemoryBase(memoryBaseId, body) {
2122
+ try {
2123
+ const response = await this.client.patch(`/memories/${encodeURIComponent(memoryBaseId)}`, body);
2124
+ return response.data;
2125
+ }
2126
+ catch (error) {
2127
+ throw this.handleError(error, `Failed to update memory base ${memoryBaseId}`);
2128
+ }
2129
+ }
2130
+ async deleteMemoryBase(memoryBaseId) {
2131
+ try {
2132
+ await this.client.delete(`/memories/${encodeURIComponent(memoryBaseId)}`);
2133
+ }
2134
+ catch (error) {
2135
+ throw this.handleError(error, `Failed to delete memory base ${memoryBaseId}`);
2136
+ }
2137
+ }
2138
+ async flushMemoryBase(memoryBaseId, body) {
2139
+ try {
2140
+ const response = await this.client.post(`/memories/${encodeURIComponent(memoryBaseId)}/flush`, body);
2141
+ return response.data;
2142
+ }
2143
+ catch (error) {
2144
+ throw this.handleError(error, `Failed to flush memory base ${memoryBaseId}`);
2145
+ }
2146
+ }
2147
+ async checkMemoryBaseMismatch(memoryBaseId) {
2148
+ try {
2149
+ const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/mismatch`);
2150
+ return response.data;
2151
+ }
2152
+ catch (error) {
2153
+ throw this.handleError(error, `Failed to check mismatch for memory base ${memoryBaseId}`);
2154
+ }
2155
+ }
2156
+ async regenerateMemoryBase(memoryBaseId) {
2157
+ try {
2158
+ const response = await this.client.post(`/memories/${encodeURIComponent(memoryBaseId)}/regenerate`);
2159
+ return response.data;
2160
+ }
2161
+ catch (error) {
2162
+ throw this.handleError(error, `Failed to regenerate memory base ${memoryBaseId}`);
2163
+ }
2164
+ }
2165
+ async testKnowledgeBaseConnection(body) {
2166
+ try {
2167
+ const response = await this.client.post('/knowledge_bases/test-connection', body);
2168
+ return response.data;
2169
+ }
2170
+ catch (error) {
2171
+ throw this.handleError(error, 'Failed to test knowledge base connection');
2172
+ }
2173
+ }
2174
+ async listKnowledgeBaseConnectors() {
2175
+ try {
2176
+ const response = await this.client.get('/knowledge_bases/connectors');
2177
+ return response.data;
2178
+ }
2179
+ catch (error) {
2180
+ throw this.handleError(error, 'Failed to list knowledge base connectors');
2181
+ }
2182
+ }
2183
+ async ingestKnowledgeBaseFolder(kbName, body) {
2184
+ try {
2185
+ const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest/folder`, body);
2186
+ return response.data;
2187
+ }
2188
+ catch (error) {
2189
+ throw this.handleError(error, `Failed to ingest folder into knowledge base ${kbName}`);
2190
+ }
2191
+ }
2192
+ async ingestKnowledgeBaseConnector(kbName, body) {
2193
+ try {
2194
+ const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest/connector`, body);
2195
+ return response.data;
2196
+ }
2197
+ catch (error) {
2198
+ throw this.handleError(error, `Failed to ingest connector into knowledge base ${kbName}`);
2199
+ }
2200
+ }
2201
+ async getKnowledgeBaseMetadataKeys(kbName) {
2202
+ try {
2203
+ const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/metadata/keys`);
2204
+ return response.data;
2205
+ }
2206
+ catch (error) {
2207
+ throw this.handleError(error, `Failed to get metadata keys for knowledge base ${kbName}`);
2208
+ }
2209
+ }
2210
+ async listKnowledgeBaseRuns(kbName, params) {
2211
+ try {
2212
+ const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/runs`, { params });
2213
+ return response.data;
2214
+ }
2215
+ catch (error) {
2216
+ throw this.handleError(error, `Failed to list ingestion runs for knowledge base ${kbName}`);
2217
+ }
2218
+ }
2219
+ async getKnowledgeBaseRun(kbName, runId) {
2220
+ try {
2221
+ const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/runs/${encodeURIComponent(runId)}`);
2222
+ return response.data;
2223
+ }
2224
+ catch (error) {
2225
+ throw this.handleError(error, `Failed to get ingestion run ${runId} for knowledge base ${kbName}`);
2226
+ }
2227
+ }
2228
+ async reloadExtensionBundle(extensionId, bundleName) {
2229
+ try {
2230
+ const response = await this.client.post(`/extensions/${encodeURIComponent(extensionId)}/bundles/${encodeURIComponent(bundleName)}/reload`);
2231
+ return response.data;
2232
+ }
2233
+ catch (error) {
2234
+ throw this.handleError(error, `Failed to reload extension bundle ${bundleName}`);
2235
+ }
2236
+ }
2237
+ async getExtensionEvents(params) {
2238
+ try {
2239
+ const response = await this.client.get('/extensions/events', { params });
2240
+ return response.data;
2241
+ }
2242
+ catch (error) {
2243
+ throw this.handleError(error, 'Failed to get extension events');
2244
+ }
2245
+ }
2246
+ async getAgenticFile(params) {
2247
+ try {
2248
+ const response = await this.client.get('/agentic/files', {
2249
+ params,
2250
+ responseType: params.download ? 'arraybuffer' : 'text'
2251
+ });
2252
+ if (params.download) {
2253
+ return {
2254
+ path: params.path,
2255
+ encoding: 'base64',
2256
+ content: Buffer.from(response.data).toString('base64')
2257
+ };
2258
+ }
2259
+ return { path: params.path, content: response.data };
2260
+ }
2261
+ catch (error) {
2262
+ throw this.handleError(error, `Failed to get agentic file ${params.path}`);
2263
+ }
2264
+ }
2265
+ async resetAgenticSession(params) {
2266
+ try {
2267
+ const response = await this.client.post('/agentic/sessions/reset', undefined, { params });
2268
+ return response.data;
2269
+ }
2270
+ catch (error) {
2271
+ throw this.handleError(error, 'Failed to reset agentic session');
2272
+ }
2273
+ }
2274
+ async getFlowNoteTranslations(flowId) {
2275
+ try {
2276
+ const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/note_translations`);
2277
+ return response.data;
2278
+ }
2279
+ catch (error) {
2280
+ throw this.handleError(error, `Failed to get note translations for flow ${flowId}`);
2281
+ }
2282
+ }
2283
+ async getJobQueueMetrics() {
2284
+ try {
2285
+ const response = await this.client.get('/monitor/job_queue');
2286
+ return response.data;
2287
+ }
2288
+ catch (error) {
2289
+ throw this.handleError(error, 'Failed to get job queue metrics');
2290
+ }
2291
+ }
2292
+ async listA2aAgents() {
2293
+ try {
2294
+ const response = await this.client.get('/a2a/agents');
2295
+ return response.data;
2296
+ }
2297
+ catch (error) {
2298
+ throw this.handleError(error, 'Failed to list A2A agents');
2299
+ }
2300
+ }
2301
+ async getA2aAgentCard(flowId) {
2302
+ try {
2303
+ const response = await this.client.get(`/a2a/${encodeURIComponent(flowId)}/.well-known/agent-card.json`);
2304
+ return response.data;
2305
+ }
2306
+ catch (error) {
2307
+ throw this.handleError(error, `Failed to get A2A agent card for flow ${flowId}`);
2308
+ }
2309
+ }
2310
+ async invokeA2aJsonrpc(flowId, body) {
2311
+ try {
2312
+ const response = await this.client.post(`/a2a/${encodeURIComponent(flowId)}/jsonrpc`, body);
2313
+ return response.data;
2314
+ }
2315
+ catch (error) {
2316
+ throw this.handleError(error, `Failed to invoke A2A JSON-RPC for flow ${flowId}`);
2317
+ }
2318
+ }
2319
+ async listPendingWorkflows(params) {
2320
+ try {
2321
+ const response = await this.client.get('/api/v2/workflows/pending', {
2322
+ baseURL: this.config.baseUrl,
2323
+ params
2324
+ });
2325
+ return response.data;
2326
+ }
2327
+ catch (error) {
2328
+ throw this.handleError(error, 'Failed to list pending workflows');
2329
+ }
2330
+ }
2331
+ async getWorkflowEvents(jobId) {
2332
+ try {
2333
+ const response = await this.client.get(`/api/v2/workflows/${encodeURIComponent(jobId)}/events`, { baseURL: this.config.baseUrl, responseType: 'text' });
2334
+ return response.data;
2335
+ }
2336
+ catch (error) {
2337
+ throw this.handleError(error, `Failed to get events for workflow ${jobId}`);
2338
+ }
2339
+ }
2340
+ async resumeWorkflow(jobId, body) {
2341
+ try {
2342
+ const response = await this.client.post(`/api/v2/workflows/${encodeURIComponent(jobId)}/resume`, body, { baseURL: this.config.baseUrl });
2343
+ return response.data;
2344
+ }
2345
+ catch (error) {
2346
+ throw this.handleError(error, `Failed to resume workflow ${jobId}`);
2347
+ }
2348
+ }
2349
+ async runPublicWorkflow(body) {
2350
+ try {
2351
+ const response = await this.client.post('/api/v2/workflows/public', body, {
2352
+ baseURL: this.config.baseUrl,
2353
+ responseType: 'text'
2354
+ });
1205
2355
  return response.data;
1206
2356
  }
1207
2357
  catch (error) {
1208
- throw this.handleError(error, `Failed to validate flow ${params.flow_id}`);
2358
+ throw this.handleError(error, 'Failed to run public workflow');
1209
2359
  }
1210
2360
  }
1211
2361
  handleError(error, message) {