langflow-mcp-server 3.1.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -79
- package/dist/__tests__/fixtures/vertices.d.ts +1 -2
- package/dist/__tests__/fixtures/vertices.d.ts.map +1 -1
- package/dist/__tests__/fixtures/vertices.js +1 -5
- package/dist/__tests__/fixtures/vertices.js.map +1 -1
- package/dist/mcp/server-consolidated.d.ts +13 -0
- package/dist/mcp/server-consolidated.d.ts.map +1 -1
- package/dist/mcp/server-consolidated.js +713 -44
- package/dist/mcp/server-consolidated.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +749 -50
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools-consolidated.d.ts.map +1 -1
- package/dist/mcp/tools-consolidated.js +722 -43
- package/dist/mcp/tools-consolidated.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1701 -66
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/validation-consolidated.d.ts +681 -9
- package/dist/mcp/validation-consolidated.d.ts.map +1 -1
- package/dist/mcp/validation-consolidated.js +635 -15
- package/dist/mcp/validation-consolidated.js.map +1 -1
- package/dist/mcp/validation.d.ts +769 -11
- package/dist/mcp/validation.d.ts.map +1 -1
- package/dist/mcp/validation.js +600 -11
- package/dist/mcp/validation.js.map +1 -1
- package/dist/services/langflow-client.d.ts +133 -51
- package/dist/services/langflow-client.d.ts.map +1 -1
- package/dist/services/langflow-client.js +1102 -154
- package/dist/services/langflow-client.js.map +1 -1
- package/dist/types/index.d.ts +395 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +16 -13
|
@@ -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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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) {
|
|
@@ -551,8 +551,12 @@ class LangflowClient {
|
|
|
551
551
|
}
|
|
552
552
|
async getMonitorMessage(messageId) {
|
|
553
553
|
try {
|
|
554
|
-
const response = await this.client.get(
|
|
555
|
-
|
|
554
|
+
const response = await this.client.get('/monitor/messages');
|
|
555
|
+
const message = response.data.find(m => m.id === messageId);
|
|
556
|
+
if (!message) {
|
|
557
|
+
throw new Error(`Monitor message ${messageId} not found`);
|
|
558
|
+
}
|
|
559
|
+
return message;
|
|
556
560
|
}
|
|
557
561
|
catch (error) {
|
|
558
562
|
throw this.handleError(error, `Failed to get monitor message ${messageId}`);
|
|
@@ -569,7 +573,9 @@ class LangflowClient {
|
|
|
569
573
|
}
|
|
570
574
|
async getMonitorSessionMessages(sessionId) {
|
|
571
575
|
try {
|
|
572
|
-
const response = await this.client.get(
|
|
576
|
+
const response = await this.client.get('/monitor/messages', {
|
|
577
|
+
params: { session_id: sessionId }
|
|
578
|
+
});
|
|
573
579
|
return response.data;
|
|
574
580
|
}
|
|
575
581
|
catch (error) {
|
|
@@ -623,15 +629,6 @@ class LangflowClient {
|
|
|
623
629
|
throw this.handleError(error, `Failed to build vertices for flow ${flowId}`);
|
|
624
630
|
}
|
|
625
631
|
}
|
|
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
632
|
async streamVertexBuild(params) {
|
|
636
633
|
try {
|
|
637
634
|
const response = await this.client.get(`/build/${encodeURIComponent(params.flow_id)}/${encodeURIComponent(params.vertex_id)}/stream`);
|
|
@@ -668,15 +665,6 @@ class LangflowClient {
|
|
|
668
665
|
throw this.handleError(error, 'Failed to get current user');
|
|
669
666
|
}
|
|
670
667
|
}
|
|
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
668
|
async updateUser(userId, updates) {
|
|
681
669
|
try {
|
|
682
670
|
const response = await this.client.patch(`/users/${encodeURIComponent(userId)}`, updates);
|
|
@@ -723,15 +711,6 @@ class LangflowClient {
|
|
|
723
711
|
throw this.handleError(error, `Failed to delete API key ${apiKeyId}`);
|
|
724
712
|
}
|
|
725
713
|
}
|
|
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
714
|
async createCustomComponent(component) {
|
|
736
715
|
try {
|
|
737
716
|
const response = await this.client.post('/custom_component', component);
|
|
@@ -848,15 +827,7 @@ class LangflowClient {
|
|
|
848
827
|
}
|
|
849
828
|
async uploadKnowledgeBase(kbName, fileContent, fileName) {
|
|
850
829
|
try {
|
|
851
|
-
|
|
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;
|
|
830
|
+
return await this.ingestKnowledgeBase(kbName, [{ buffer: fileContent, filename: fileName }]);
|
|
860
831
|
}
|
|
861
832
|
catch (error) {
|
|
862
833
|
throw this.handleError(error, `Failed to upload knowledge base ${kbName}`);
|
|
@@ -873,7 +844,7 @@ class LangflowClient {
|
|
|
873
844
|
}
|
|
874
845
|
async healthCheck() {
|
|
875
846
|
try {
|
|
876
|
-
await this.client.get('/health');
|
|
847
|
+
await this.client.get('/health', { baseURL: this.config.baseUrl });
|
|
877
848
|
return true;
|
|
878
849
|
}
|
|
879
850
|
catch (error) {
|
|
@@ -892,320 +863,1297 @@ class LangflowClient {
|
|
|
892
863
|
throw this.handleError(error, 'Failed to get logs');
|
|
893
864
|
}
|
|
894
865
|
}
|
|
895
|
-
async
|
|
866
|
+
async deleteUser(userId) {
|
|
867
|
+
try {
|
|
868
|
+
await this.client.delete(`/users/${encodeURIComponent(userId)}`);
|
|
869
|
+
}
|
|
870
|
+
catch (error) {
|
|
871
|
+
throw this.handleError(error, `Failed to delete user ${userId}`);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
async getConfig() {
|
|
875
|
+
try {
|
|
876
|
+
const response = await this.client.get('/config');
|
|
877
|
+
return response.data;
|
|
878
|
+
}
|
|
879
|
+
catch (error) {
|
|
880
|
+
throw this.handleError(error, 'Failed to get configuration');
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
async buildVertex(params) {
|
|
896
884
|
try {
|
|
897
|
-
const response = await this.client.
|
|
885
|
+
const response = await this.client.post(`/build/${encodeURIComponent(params.flow_id)}/vertices/${encodeURIComponent(params.vertex_id)}`, params.inputs || {});
|
|
898
886
|
return response.data;
|
|
899
887
|
}
|
|
900
888
|
catch (error) {
|
|
901
|
-
throw this.handleError(error,
|
|
889
|
+
throw this.handleError(error, `Failed to build vertex ${params.vertex_id}`);
|
|
902
890
|
}
|
|
903
891
|
}
|
|
904
|
-
async
|
|
892
|
+
async getHealth() {
|
|
905
893
|
try {
|
|
906
|
-
const response = await this.client.get(
|
|
894
|
+
const response = await this.client.get('/health', { baseURL: this.config.baseUrl });
|
|
907
895
|
return response.data;
|
|
908
896
|
}
|
|
909
897
|
catch (error) {
|
|
910
|
-
throw this.handleError(error, 'Failed to get
|
|
898
|
+
throw this.handleError(error, 'Failed to get health status');
|
|
911
899
|
}
|
|
912
900
|
}
|
|
913
|
-
async
|
|
901
|
+
async updateStoreComponent(componentId, updates) {
|
|
914
902
|
try {
|
|
915
|
-
const response = await this.client.
|
|
903
|
+
const response = await this.client.patch(`/store/components/${encodeURIComponent(componentId)}`, updates);
|
|
916
904
|
return response.data;
|
|
917
905
|
}
|
|
918
906
|
catch (error) {
|
|
919
|
-
throw this.handleError(error,
|
|
907
|
+
throw this.handleError(error, `Failed to update store component ${componentId}`);
|
|
920
908
|
}
|
|
921
909
|
}
|
|
922
|
-
async
|
|
910
|
+
async runFlowSession(flowIdOrName, request, stream = false) {
|
|
923
911
|
try {
|
|
924
|
-
|
|
912
|
+
if (stream) {
|
|
913
|
+
throw new Error('Streaming run session responses are not supported by this MCP client');
|
|
914
|
+
}
|
|
915
|
+
const { context, ...inputRequest } = request;
|
|
916
|
+
const response = await this.client.post(`/run/session/${encodeURIComponent(flowIdOrName)}`, { input_request: inputRequest, context }, { params: { stream } });
|
|
925
917
|
return response.data;
|
|
926
918
|
}
|
|
927
919
|
catch (error) {
|
|
928
|
-
throw this.handleError(error,
|
|
920
|
+
throw this.handleError(error, `Failed to run flow session ${flowIdOrName}`);
|
|
929
921
|
}
|
|
930
922
|
}
|
|
931
|
-
async
|
|
923
|
+
async getRegistration() {
|
|
932
924
|
try {
|
|
933
|
-
const response = await this.client.
|
|
934
|
-
|
|
935
|
-
file_name: params.file_name
|
|
925
|
+
const response = await this.client.get('/api/v2/registration/', {
|
|
926
|
+
baseURL: this.config.baseUrl
|
|
936
927
|
});
|
|
937
928
|
return response.data;
|
|
938
929
|
}
|
|
939
930
|
catch (error) {
|
|
940
|
-
throw this.handleError(error,
|
|
931
|
+
throw this.handleError(error, 'Failed to get registration status');
|
|
941
932
|
}
|
|
942
933
|
}
|
|
943
|
-
async
|
|
934
|
+
async registerUser(email) {
|
|
944
935
|
try {
|
|
945
|
-
const response = await this.client.post(
|
|
936
|
+
const response = await this.client.post('/api/v2/registration/', { email }, { baseURL: this.config.baseUrl });
|
|
946
937
|
return response.data;
|
|
947
938
|
}
|
|
948
939
|
catch (error) {
|
|
949
|
-
throw this.handleError(error,
|
|
940
|
+
throw this.handleError(error, 'Failed to register user');
|
|
950
941
|
}
|
|
951
942
|
}
|
|
952
|
-
async
|
|
943
|
+
async replaceFlow(flowId, body) {
|
|
953
944
|
try {
|
|
954
|
-
const response = await this.client.
|
|
945
|
+
const response = await this.client.put(`/flows/${encodeURIComponent(flowId)}`, body);
|
|
955
946
|
return response.data;
|
|
956
947
|
}
|
|
957
948
|
catch (error) {
|
|
958
|
-
throw this.handleError(error, `Failed to
|
|
949
|
+
throw this.handleError(error, `Failed to replace flow ${flowId}`);
|
|
959
950
|
}
|
|
960
951
|
}
|
|
961
|
-
async
|
|
952
|
+
async expandFlows(body) {
|
|
962
953
|
try {
|
|
963
|
-
await this.client.
|
|
954
|
+
const response = await this.client.post('/flows/expand/', body);
|
|
955
|
+
return response.data;
|
|
964
956
|
}
|
|
965
957
|
catch (error) {
|
|
966
|
-
throw this.handleError(error,
|
|
958
|
+
throw this.handleError(error, 'Failed to expand flows');
|
|
967
959
|
}
|
|
968
960
|
}
|
|
969
|
-
async
|
|
961
|
+
async getFlowEvents(flowId, params) {
|
|
970
962
|
try {
|
|
971
|
-
await this.client.
|
|
963
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/events`, { params });
|
|
964
|
+
return response.data;
|
|
972
965
|
}
|
|
973
966
|
catch (error) {
|
|
974
|
-
throw this.handleError(error, `Failed to
|
|
967
|
+
throw this.handleError(error, `Failed to get events for flow ${flowId}`);
|
|
975
968
|
}
|
|
976
969
|
}
|
|
977
|
-
async
|
|
970
|
+
async createFlowEvent(flowId, body) {
|
|
978
971
|
try {
|
|
979
|
-
const response = await this.client.
|
|
972
|
+
const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/events`, body);
|
|
980
973
|
return response.data;
|
|
981
974
|
}
|
|
982
975
|
catch (error) {
|
|
983
|
-
throw this.handleError(error,
|
|
976
|
+
throw this.handleError(error, `Failed to create event for flow ${flowId}`);
|
|
984
977
|
}
|
|
985
978
|
}
|
|
986
|
-
async
|
|
979
|
+
async listFlowVersions(flowId, params) {
|
|
987
980
|
try {
|
|
988
|
-
const response = await this.client.
|
|
981
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/versions/`, { params });
|
|
989
982
|
return response.data;
|
|
990
983
|
}
|
|
991
984
|
catch (error) {
|
|
992
|
-
throw this.handleError(error,
|
|
985
|
+
throw this.handleError(error, `Failed to list versions for flow ${flowId}`);
|
|
993
986
|
}
|
|
994
987
|
}
|
|
995
|
-
async
|
|
988
|
+
async createFlowVersion(flowId, body) {
|
|
996
989
|
try {
|
|
997
|
-
const response = await this.client.
|
|
990
|
+
const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/versions/`, body ?? {});
|
|
998
991
|
return response.data;
|
|
999
992
|
}
|
|
1000
993
|
catch (error) {
|
|
1001
|
-
throw this.handleError(error,
|
|
994
|
+
throw this.handleError(error, `Failed to create version for flow ${flowId}`);
|
|
1002
995
|
}
|
|
1003
996
|
}
|
|
1004
|
-
async
|
|
997
|
+
async getFlowVersion(flowId, versionId) {
|
|
1005
998
|
try {
|
|
1006
|
-
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/
|
|
999
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}`);
|
|
1007
1000
|
return response.data;
|
|
1008
1001
|
}
|
|
1009
1002
|
catch (error) {
|
|
1010
|
-
throw this.handleError(error, `Failed to
|
|
1003
|
+
throw this.handleError(error, `Failed to get version ${versionId} for flow ${flowId}`);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
async deleteFlowVersion(flowId, versionId) {
|
|
1007
|
+
try {
|
|
1008
|
+
await this.client.delete(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}`);
|
|
1009
|
+
}
|
|
1010
|
+
catch (error) {
|
|
1011
|
+
throw this.handleError(error, `Failed to delete version ${versionId} for flow ${flowId}`);
|
|
1011
1012
|
}
|
|
1012
1013
|
}
|
|
1013
|
-
async
|
|
1014
|
+
async activateFlowVersion(flowId, versionId, params) {
|
|
1014
1015
|
try {
|
|
1015
|
-
const response = await this.client.post(
|
|
1016
|
+
const response = await this.client.post(`/flows/${encodeURIComponent(flowId)}/versions/${encodeURIComponent(versionId)}/activate`, undefined, { params });
|
|
1016
1017
|
return response.data;
|
|
1017
1018
|
}
|
|
1018
1019
|
catch (error) {
|
|
1019
|
-
throw this.handleError(error,
|
|
1020
|
+
throw this.handleError(error, `Failed to activate version ${versionId} for flow ${flowId}`);
|
|
1020
1021
|
}
|
|
1021
1022
|
}
|
|
1022
|
-
async
|
|
1023
|
+
async detectVariables(body) {
|
|
1023
1024
|
try {
|
|
1024
|
-
const response = await this.client.post(
|
|
1025
|
+
const response = await this.client.post('/variables/detections', body);
|
|
1025
1026
|
return response.data;
|
|
1026
1027
|
}
|
|
1027
1028
|
catch (error) {
|
|
1028
|
-
throw this.handleError(error,
|
|
1029
|
+
throw this.handleError(error, 'Failed to detect variables');
|
|
1029
1030
|
}
|
|
1030
1031
|
}
|
|
1031
|
-
async
|
|
1032
|
+
async saveStoreApiKey(apiKey) {
|
|
1032
1033
|
try {
|
|
1033
|
-
const response = await this.client.
|
|
1034
|
+
const response = await this.client.post('/api_key/store', { api_key: apiKey });
|
|
1034
1035
|
return response.data;
|
|
1035
1036
|
}
|
|
1036
1037
|
catch (error) {
|
|
1037
|
-
throw this.handleError(error,
|
|
1038
|
+
throw this.handleError(error, 'Failed to save store API key');
|
|
1038
1039
|
}
|
|
1039
1040
|
}
|
|
1040
|
-
async
|
|
1041
|
+
async updateCustomComponentCode(body) {
|
|
1041
1042
|
try {
|
|
1042
|
-
const response = await this.client.
|
|
1043
|
+
const response = await this.client.post('/custom_component/update', body);
|
|
1043
1044
|
return response.data;
|
|
1044
1045
|
}
|
|
1045
1046
|
catch (error) {
|
|
1046
|
-
throw this.handleError(error, 'Failed to
|
|
1047
|
+
throw this.handleError(error, 'Failed to update custom component code');
|
|
1047
1048
|
}
|
|
1048
1049
|
}
|
|
1049
|
-
async
|
|
1050
|
+
async createStoreComponent(body) {
|
|
1050
1051
|
try {
|
|
1051
|
-
const response = await this.client.post(
|
|
1052
|
+
const response = await this.client.post('/store/components/', body);
|
|
1052
1053
|
return response.data;
|
|
1053
1054
|
}
|
|
1054
1055
|
catch (error) {
|
|
1055
|
-
throw this.handleError(error,
|
|
1056
|
+
throw this.handleError(error, 'Failed to create store component');
|
|
1056
1057
|
}
|
|
1057
1058
|
}
|
|
1058
|
-
async
|
|
1059
|
+
async likeStoreComponent(componentId) {
|
|
1059
1060
|
try {
|
|
1060
|
-
const response = await this.client.post(`/
|
|
1061
|
+
const response = await this.client.post(`/store/users/likes/${encodeURIComponent(componentId)}`);
|
|
1061
1062
|
return response.data;
|
|
1062
1063
|
}
|
|
1063
1064
|
catch (error) {
|
|
1064
|
-
throw this.handleError(error, `Failed to
|
|
1065
|
+
throw this.handleError(error, `Failed to like store component ${componentId}`);
|
|
1065
1066
|
}
|
|
1066
1067
|
}
|
|
1067
|
-
async
|
|
1068
|
+
async createResponse(body) {
|
|
1068
1069
|
try {
|
|
1069
|
-
const response = await this.client.
|
|
1070
|
+
const response = await this.client.post('/responses', body);
|
|
1070
1071
|
return response.data;
|
|
1071
1072
|
}
|
|
1072
1073
|
catch (error) {
|
|
1073
|
-
throw this.handleError(error,
|
|
1074
|
+
throw this.handleError(error, 'Failed to create response');
|
|
1074
1075
|
}
|
|
1075
1076
|
}
|
|
1076
|
-
async
|
|
1077
|
+
async getSession() {
|
|
1077
1078
|
try {
|
|
1078
|
-
const response = await this.client.get(
|
|
1079
|
+
const response = await this.client.get('/session');
|
|
1079
1080
|
return response.data;
|
|
1080
1081
|
}
|
|
1081
1082
|
catch (error) {
|
|
1082
|
-
throw this.handleError(error,
|
|
1083
|
+
throw this.handleError(error, 'Failed to get session');
|
|
1083
1084
|
}
|
|
1084
1085
|
}
|
|
1085
|
-
async
|
|
1086
|
+
async createUser(body) {
|
|
1086
1087
|
try {
|
|
1087
|
-
const response = await this.client.
|
|
1088
|
+
const response = await this.client.post('/users/', body);
|
|
1088
1089
|
return response.data;
|
|
1089
1090
|
}
|
|
1090
1091
|
catch (error) {
|
|
1091
|
-
throw this.handleError(error, 'Failed to
|
|
1092
|
+
throw this.handleError(error, 'Failed to create user');
|
|
1092
1093
|
}
|
|
1093
1094
|
}
|
|
1094
|
-
async
|
|
1095
|
+
async getWebhookEvents(flowIdOrName, params) {
|
|
1095
1096
|
try {
|
|
1096
|
-
const response = await this.client.get(`/
|
|
1097
|
+
const response = await this.client.get(`/webhook-events/${encodeURIComponent(flowIdOrName)}`, { params });
|
|
1097
1098
|
return response.data;
|
|
1098
1099
|
}
|
|
1099
1100
|
catch (error) {
|
|
1100
|
-
throw this.handleError(error, `Failed to get
|
|
1101
|
+
throw this.handleError(error, `Failed to get webhook events for ${flowIdOrName}`);
|
|
1101
1102
|
}
|
|
1102
1103
|
}
|
|
1103
|
-
async
|
|
1104
|
+
async getHealthCheck() {
|
|
1104
1105
|
try {
|
|
1105
|
-
const response = await this.client.get(
|
|
1106
|
+
const response = await this.client.get('/health_check', { baseURL: this.config.baseUrl });
|
|
1106
1107
|
return response.data;
|
|
1107
1108
|
}
|
|
1108
1109
|
catch (error) {
|
|
1109
|
-
throw this.handleError(error,
|
|
1110
|
+
throw this.handleError(error, 'Failed to get health check');
|
|
1110
1111
|
}
|
|
1111
1112
|
}
|
|
1112
|
-
async
|
|
1113
|
+
async uploadFlowFileLegacy(flowId, file, fileName) {
|
|
1113
1114
|
try {
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1115
|
+
const formData = new form_data_1.default();
|
|
1116
|
+
formData.append('file', file, fileName);
|
|
1117
|
+
const response = await this.client.post(`/upload/${encodeURIComponent(flowId)}`, formData, {
|
|
1118
|
+
headers: {
|
|
1119
|
+
...formData.getHeaders()
|
|
1120
|
+
}
|
|
1118
1121
|
});
|
|
1119
1122
|
return response.data;
|
|
1120
1123
|
}
|
|
1121
1124
|
catch (error) {
|
|
1122
|
-
throw this.handleError(error,
|
|
1125
|
+
throw this.handleError(error, `Failed to upload legacy file to flow ${flowId}`);
|
|
1123
1126
|
}
|
|
1124
1127
|
}
|
|
1125
|
-
async
|
|
1128
|
+
async listFilesV2() {
|
|
1126
1129
|
try {
|
|
1127
|
-
const
|
|
1128
|
-
const response = await this.client.post(`/executions/${encodeURIComponent(flow_id)}/advanced`, request);
|
|
1130
|
+
const response = await this.client.get('/api/v2/files', { baseURL: this.config.baseUrl });
|
|
1129
1131
|
return response.data;
|
|
1130
1132
|
}
|
|
1131
1133
|
catch (error) {
|
|
1132
|
-
throw this.handleError(error,
|
|
1134
|
+
throw this.handleError(error, 'Failed to list files (v2)');
|
|
1133
1135
|
}
|
|
1134
1136
|
}
|
|
1135
|
-
async
|
|
1137
|
+
async uploadFileV2(file, fileName, params) {
|
|
1136
1138
|
try {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
+
const formData = new form_data_1.default();
|
|
1140
|
+
formData.append('file', file, fileName);
|
|
1141
|
+
const response = await this.client.post('/api/v2/files', formData, {
|
|
1142
|
+
baseURL: this.config.baseUrl,
|
|
1143
|
+
params,
|
|
1144
|
+
headers: {
|
|
1145
|
+
...formData.getHeaders()
|
|
1146
|
+
}
|
|
1139
1147
|
});
|
|
1140
1148
|
return response.data;
|
|
1141
1149
|
}
|
|
1142
1150
|
catch (error) {
|
|
1143
|
-
throw this.handleError(error, 'Failed to
|
|
1151
|
+
throw this.handleError(error, 'Failed to upload file (v2)');
|
|
1144
1152
|
}
|
|
1145
1153
|
}
|
|
1146
|
-
async
|
|
1154
|
+
async getFileV2(fileId, params) {
|
|
1147
1155
|
try {
|
|
1148
|
-
const response = await this.client.
|
|
1156
|
+
const response = await this.client.get(`/api/v2/files/${encodeURIComponent(fileId)}`, {
|
|
1157
|
+
baseURL: this.config.baseUrl,
|
|
1158
|
+
params
|
|
1159
|
+
});
|
|
1149
1160
|
return response.data;
|
|
1150
1161
|
}
|
|
1151
1162
|
catch (error) {
|
|
1152
|
-
throw this.handleError(error, `Failed to
|
|
1163
|
+
throw this.handleError(error, `Failed to get file ${fileId} (v2)`);
|
|
1153
1164
|
}
|
|
1154
1165
|
}
|
|
1155
|
-
async
|
|
1166
|
+
async renameFileV2(fileId, name) {
|
|
1156
1167
|
try {
|
|
1157
|
-
const response = await this.client.
|
|
1168
|
+
const response = await this.client.put(`/api/v2/files/${encodeURIComponent(fileId)}`, undefined, {
|
|
1169
|
+
baseURL: this.config.baseUrl,
|
|
1170
|
+
params: { name }
|
|
1171
|
+
});
|
|
1158
1172
|
return response.data;
|
|
1159
1173
|
}
|
|
1160
1174
|
catch (error) {
|
|
1161
|
-
throw this.handleError(error, `Failed to
|
|
1175
|
+
throw this.handleError(error, `Failed to rename file ${fileId} (v2)`);
|
|
1162
1176
|
}
|
|
1163
1177
|
}
|
|
1164
|
-
async
|
|
1178
|
+
async deleteFileV2(fileId) {
|
|
1165
1179
|
try {
|
|
1166
|
-
const response = await this.client.
|
|
1180
|
+
const response = await this.client.delete(`/api/v2/files/${encodeURIComponent(fileId)}`, {
|
|
1181
|
+
baseURL: this.config.baseUrl
|
|
1182
|
+
});
|
|
1167
1183
|
return response.data;
|
|
1168
1184
|
}
|
|
1169
1185
|
catch (error) {
|
|
1170
|
-
throw this.handleError(error, `Failed to
|
|
1186
|
+
throw this.handleError(error, `Failed to delete file ${fileId} (v2)`);
|
|
1171
1187
|
}
|
|
1172
1188
|
}
|
|
1173
|
-
async
|
|
1189
|
+
async deleteAllFilesV2() {
|
|
1174
1190
|
try {
|
|
1175
|
-
const response = await this.client.
|
|
1191
|
+
const response = await this.client.delete('/api/v2/files', { baseURL: this.config.baseUrl });
|
|
1192
|
+
return response.data;
|
|
1193
|
+
}
|
|
1194
|
+
catch (error) {
|
|
1195
|
+
throw this.handleError(error, 'Failed to delete all files (v2)');
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
async batchDownloadFilesV2(fileIds) {
|
|
1199
|
+
try {
|
|
1200
|
+
const response = await this.client.post('/api/v2/files/batch/', fileIds, {
|
|
1176
1201
|
baseURL: this.config.baseUrl
|
|
1177
1202
|
});
|
|
1178
1203
|
return response.data;
|
|
1179
1204
|
}
|
|
1180
1205
|
catch (error) {
|
|
1181
|
-
throw this.handleError(error, 'Failed to
|
|
1206
|
+
throw this.handleError(error, 'Failed to batch download files (v2)');
|
|
1182
1207
|
}
|
|
1183
1208
|
}
|
|
1184
|
-
async
|
|
1209
|
+
async batchDeleteFilesV2(fileIds) {
|
|
1185
1210
|
try {
|
|
1186
|
-
const response = await this.client.
|
|
1211
|
+
const response = await this.client.delete('/api/v2/files/batch/', {
|
|
1212
|
+
baseURL: this.config.baseUrl,
|
|
1213
|
+
data: fileIds
|
|
1214
|
+
});
|
|
1187
1215
|
return response.data;
|
|
1188
1216
|
}
|
|
1189
1217
|
catch (error) {
|
|
1190
|
-
throw this.handleError(error, 'Failed to
|
|
1218
|
+
throw this.handleError(error, 'Failed to batch delete files (v2)');
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
async listKnowledgeBasesDetailed() {
|
|
1222
|
+
try {
|
|
1223
|
+
const response = await this.client.get('/knowledge_bases/');
|
|
1224
|
+
return response.data;
|
|
1225
|
+
}
|
|
1226
|
+
catch (error) {
|
|
1227
|
+
throw this.handleError(error, 'Failed to list knowledge bases (detailed)');
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
async createKnowledgeBase(body) {
|
|
1231
|
+
try {
|
|
1232
|
+
const response = await this.client.post('/knowledge_bases', body);
|
|
1233
|
+
return response.data;
|
|
1234
|
+
}
|
|
1235
|
+
catch (error) {
|
|
1236
|
+
throw this.handleError(error, 'Failed to create knowledge base');
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
async previewKnowledgeBaseChunks(files, body) {
|
|
1240
|
+
try {
|
|
1241
|
+
const formData = new form_data_1.default();
|
|
1242
|
+
files.forEach((file, idx) => {
|
|
1243
|
+
formData.append('files', file.buffer, file.filename || `file-${idx}`);
|
|
1244
|
+
});
|
|
1245
|
+
if (body) {
|
|
1246
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
1247
|
+
formData.append(key, typeof value === 'string' ? value : JSON.stringify(value));
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
const response = await this.client.post('/knowledge_bases/preview-chunks', formData, {
|
|
1251
|
+
headers: {
|
|
1252
|
+
...formData.getHeaders()
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
return response.data;
|
|
1256
|
+
}
|
|
1257
|
+
catch (error) {
|
|
1258
|
+
throw this.handleError(error, 'Failed to preview knowledge base chunks');
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
async listKnowledgeBaseChunks(kbName, params) {
|
|
1262
|
+
try {
|
|
1263
|
+
const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/chunks`, { params });
|
|
1264
|
+
return response.data;
|
|
1265
|
+
}
|
|
1266
|
+
catch (error) {
|
|
1267
|
+
throw this.handleError(error, `Failed to list chunks for knowledge base ${kbName}`);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
async ingestKnowledgeBase(kbName, files, body) {
|
|
1271
|
+
try {
|
|
1272
|
+
const formData = new form_data_1.default();
|
|
1273
|
+
files.forEach((file, idx) => {
|
|
1274
|
+
formData.append('files', file.buffer, file.filename || `file-${idx}`);
|
|
1275
|
+
});
|
|
1276
|
+
if (body) {
|
|
1277
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
1278
|
+
formData.append(key, typeof value === 'string' ? value : JSON.stringify(value));
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest`, formData, {
|
|
1282
|
+
headers: {
|
|
1283
|
+
...formData.getHeaders()
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
return response.data;
|
|
1287
|
+
}
|
|
1288
|
+
catch (error) {
|
|
1289
|
+
throw this.handleError(error, `Failed to ingest knowledge base ${kbName}`);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
async cancelKnowledgeBaseIngest(kbName) {
|
|
1293
|
+
try {
|
|
1294
|
+
const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/cancel`);
|
|
1295
|
+
return response.data;
|
|
1296
|
+
}
|
|
1297
|
+
catch (error) {
|
|
1298
|
+
throw this.handleError(error, `Failed to cancel ingest for knowledge base ${kbName}`);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
async updateMonitorMessage(messageId, body) {
|
|
1302
|
+
try {
|
|
1303
|
+
const response = await this.client.put(`/monitor/messages/${encodeURIComponent(messageId)}`, body);
|
|
1304
|
+
return response.data;
|
|
1305
|
+
}
|
|
1306
|
+
catch (error) {
|
|
1307
|
+
throw this.handleError(error, `Failed to update monitor message ${messageId}`);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
async deleteMonitorSessionMessages(sessionId) {
|
|
1311
|
+
try {
|
|
1312
|
+
const response = await this.client.delete(`/monitor/messages/session/${encodeURIComponent(sessionId)}`);
|
|
1313
|
+
return response.data;
|
|
1314
|
+
}
|
|
1315
|
+
catch (error) {
|
|
1316
|
+
throw this.handleError(error, `Failed to delete messages for session ${sessionId}`);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
async deleteMonitorSessions(sessionIds) {
|
|
1320
|
+
try {
|
|
1321
|
+
const response = await this.client.delete('/monitor/messages/sessions', { data: sessionIds });
|
|
1322
|
+
return response.data;
|
|
1323
|
+
}
|
|
1324
|
+
catch (error) {
|
|
1325
|
+
throw this.handleError(error, 'Failed to delete monitor sessions');
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
async getSharedMessages(params) {
|
|
1329
|
+
try {
|
|
1330
|
+
const response = await this.client.get('/monitor/messages/shared', { params });
|
|
1331
|
+
return response.data;
|
|
1332
|
+
}
|
|
1333
|
+
catch (error) {
|
|
1334
|
+
throw this.handleError(error, 'Failed to get shared messages');
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
async getSharedSessions(sourceFlowId) {
|
|
1338
|
+
try {
|
|
1339
|
+
const response = await this.client.get('/monitor/messages/shared/sessions', {
|
|
1340
|
+
params: { source_flow_id: sourceFlowId }
|
|
1341
|
+
});
|
|
1342
|
+
return response.data;
|
|
1343
|
+
}
|
|
1344
|
+
catch (error) {
|
|
1345
|
+
throw this.handleError(error, 'Failed to get shared sessions');
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
async updateSharedMessage(messageId, sourceFlowId, body) {
|
|
1349
|
+
try {
|
|
1350
|
+
const response = await this.client.put(`/monitor/messages/shared/${encodeURIComponent(messageId)}`, body, { params: { source_flow_id: sourceFlowId } });
|
|
1351
|
+
return response.data;
|
|
1352
|
+
}
|
|
1353
|
+
catch (error) {
|
|
1354
|
+
throw this.handleError(error, `Failed to update shared message ${messageId}`);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
async migrateSharedSession(oldSessionId, params) {
|
|
1358
|
+
try {
|
|
1359
|
+
const response = await this.client.patch(`/monitor/messages/shared/session/${encodeURIComponent(oldSessionId)}`, null, { params });
|
|
1360
|
+
return response.data;
|
|
1361
|
+
}
|
|
1362
|
+
catch (error) {
|
|
1363
|
+
throw this.handleError(error, `Failed to migrate shared session ${oldSessionId}`);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
async deleteSharedSession(sessionId, sourceFlowId) {
|
|
1367
|
+
try {
|
|
1368
|
+
const response = await this.client.delete(`/monitor/messages/shared/session/${encodeURIComponent(sessionId)}`, { params: { source_flow_id: sourceFlowId } });
|
|
1369
|
+
return response.data;
|
|
1370
|
+
}
|
|
1371
|
+
catch (error) {
|
|
1372
|
+
throw this.handleError(error, `Failed to delete shared session ${sessionId}`);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
async listTraces(params) {
|
|
1376
|
+
try {
|
|
1377
|
+
const response = await this.client.get('/monitor/traces', { params });
|
|
1378
|
+
return response.data;
|
|
1379
|
+
}
|
|
1380
|
+
catch (error) {
|
|
1381
|
+
throw this.handleError(error, 'Failed to list traces');
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
async deleteTraces(flowId) {
|
|
1385
|
+
try {
|
|
1386
|
+
const response = await this.client.delete('/monitor/traces', { params: { flow_id: flowId } });
|
|
1387
|
+
return response.data;
|
|
1388
|
+
}
|
|
1389
|
+
catch (error) {
|
|
1390
|
+
throw this.handleError(error, `Failed to delete traces for flow ${flowId}`);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
async getTrace(traceId) {
|
|
1394
|
+
try {
|
|
1395
|
+
const response = await this.client.get(`/monitor/traces/${encodeURIComponent(traceId)}`);
|
|
1396
|
+
return response.data;
|
|
1397
|
+
}
|
|
1398
|
+
catch (error) {
|
|
1399
|
+
throw this.handleError(error, `Failed to get trace ${traceId}`);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
async deleteTrace(traceId) {
|
|
1403
|
+
try {
|
|
1404
|
+
await this.client.delete(`/monitor/traces/${encodeURIComponent(traceId)}`);
|
|
1405
|
+
}
|
|
1406
|
+
catch (error) {
|
|
1407
|
+
throw this.handleError(error, `Failed to delete trace ${traceId}`);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
async listModels(params) {
|
|
1411
|
+
try {
|
|
1412
|
+
const response = await this.client.get('/models', { params });
|
|
1413
|
+
return response.data;
|
|
1414
|
+
}
|
|
1415
|
+
catch (error) {
|
|
1416
|
+
throw this.handleError(error, 'Failed to list models');
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
async listModelProviders() {
|
|
1420
|
+
try {
|
|
1421
|
+
const response = await this.client.get('/models/providers');
|
|
1422
|
+
return response.data;
|
|
1423
|
+
}
|
|
1424
|
+
catch (error) {
|
|
1425
|
+
throw this.handleError(error, 'Failed to list model providers');
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
async listEnabledProviders(params) {
|
|
1429
|
+
try {
|
|
1430
|
+
const response = await this.client.get('/models/enabled_providers', { params });
|
|
1431
|
+
return response.data;
|
|
1432
|
+
}
|
|
1433
|
+
catch (error) {
|
|
1434
|
+
throw this.handleError(error, 'Failed to list enabled providers');
|
|
1191
1435
|
}
|
|
1192
1436
|
}
|
|
1193
|
-
async
|
|
1437
|
+
async listEnabledModels(params) {
|
|
1194
1438
|
try {
|
|
1195
|
-
const response = await this.client.
|
|
1439
|
+
const response = await this.client.get('/models/enabled_models', { params });
|
|
1196
1440
|
return response.data;
|
|
1197
1441
|
}
|
|
1198
1442
|
catch (error) {
|
|
1199
|
-
throw this.handleError(error, 'Failed to
|
|
1443
|
+
throw this.handleError(error, 'Failed to list enabled models');
|
|
1200
1444
|
}
|
|
1201
1445
|
}
|
|
1202
|
-
async
|
|
1446
|
+
async setEnabledModels(body) {
|
|
1203
1447
|
try {
|
|
1204
|
-
const response = await this.client.post(
|
|
1448
|
+
const response = await this.client.post('/models/enabled_models', body);
|
|
1449
|
+
return response.data;
|
|
1450
|
+
}
|
|
1451
|
+
catch (error) {
|
|
1452
|
+
throw this.handleError(error, 'Failed to set enabled models');
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
async getDefaultModel(params) {
|
|
1456
|
+
try {
|
|
1457
|
+
const response = await this.client.get('/models/default_model', { params });
|
|
1458
|
+
return response.data;
|
|
1459
|
+
}
|
|
1460
|
+
catch (error) {
|
|
1461
|
+
throw this.handleError(error, 'Failed to get default model');
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
async setDefaultModel(body) {
|
|
1465
|
+
try {
|
|
1466
|
+
const response = await this.client.post('/models/default_model', body);
|
|
1467
|
+
return response.data;
|
|
1468
|
+
}
|
|
1469
|
+
catch (error) {
|
|
1470
|
+
throw this.handleError(error, 'Failed to set default model');
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
async deleteDefaultModel(params) {
|
|
1474
|
+
try {
|
|
1475
|
+
const response = await this.client.delete('/models/default_model', { params });
|
|
1476
|
+
return response.data;
|
|
1477
|
+
}
|
|
1478
|
+
catch (error) {
|
|
1479
|
+
throw this.handleError(error, 'Failed to delete default model');
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
async getProviderVariableMapping() {
|
|
1483
|
+
try {
|
|
1484
|
+
const response = await this.client.get('/models/provider-variable-mapping');
|
|
1485
|
+
return response.data;
|
|
1486
|
+
}
|
|
1487
|
+
catch (error) {
|
|
1488
|
+
throw this.handleError(error, 'Failed to get provider variable mapping');
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
async validateModelProvider(body) {
|
|
1492
|
+
try {
|
|
1493
|
+
const response = await this.client.post('/models/validate-provider', body);
|
|
1494
|
+
return response.data;
|
|
1495
|
+
}
|
|
1496
|
+
catch (error) {
|
|
1497
|
+
throw this.handleError(error, 'Failed to validate model provider');
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
async getLanguageModelOptions() {
|
|
1501
|
+
try {
|
|
1502
|
+
const response = await this.client.get('/model_options/language');
|
|
1503
|
+
return response.data;
|
|
1504
|
+
}
|
|
1505
|
+
catch (error) {
|
|
1506
|
+
throw this.handleError(error, 'Failed to get language model options');
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
async getEmbeddingModelOptions() {
|
|
1510
|
+
try {
|
|
1511
|
+
const response = await this.client.get('/model_options/embedding');
|
|
1512
|
+
return response.data;
|
|
1513
|
+
}
|
|
1514
|
+
catch (error) {
|
|
1515
|
+
throw this.handleError(error, 'Failed to get embedding model options');
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
async agenticAssist(body) {
|
|
1519
|
+
try {
|
|
1520
|
+
const response = await this.client.post('/agentic/assist', body);
|
|
1521
|
+
return response.data;
|
|
1522
|
+
}
|
|
1523
|
+
catch (error) {
|
|
1524
|
+
throw this.handleError(error, 'Failed to run agentic assist');
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
async agenticCheckConfig() {
|
|
1528
|
+
try {
|
|
1529
|
+
const response = await this.client.get('/agentic/check-config');
|
|
1530
|
+
return response.data;
|
|
1531
|
+
}
|
|
1532
|
+
catch (error) {
|
|
1533
|
+
throw this.handleError(error, 'Failed to check agentic config');
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
async agenticExecute(flowName, body) {
|
|
1537
|
+
try {
|
|
1538
|
+
const response = await this.client.post(`/agentic/execute/${encodeURIComponent(flowName)}`, body);
|
|
1539
|
+
return response.data;
|
|
1540
|
+
}
|
|
1541
|
+
catch (error) {
|
|
1542
|
+
throw this.handleError(error, `Failed to run agentic execute for flow ${flowName}`);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
async getWorkflowResult(params) {
|
|
1546
|
+
try {
|
|
1547
|
+
const response = await this.client.get('/api/v2/workflows', {
|
|
1548
|
+
baseURL: this.config.baseUrl,
|
|
1549
|
+
params
|
|
1550
|
+
});
|
|
1551
|
+
return response.data;
|
|
1552
|
+
}
|
|
1553
|
+
catch (error) {
|
|
1554
|
+
throw this.handleError(error, 'Failed to get workflow result');
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
async runWorkflow(body) {
|
|
1558
|
+
try {
|
|
1559
|
+
const response = await this.client.post('/api/v2/workflows', body, {
|
|
1560
|
+
baseURL: this.config.baseUrl
|
|
1561
|
+
});
|
|
1562
|
+
return response.data;
|
|
1563
|
+
}
|
|
1564
|
+
catch (error) {
|
|
1565
|
+
throw this.handleError(error, 'Failed to run workflow');
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
async stopWorkflow(jobId) {
|
|
1569
|
+
try {
|
|
1570
|
+
const response = await this.client.post('/api/v2/workflows/stop', { job_id: jobId }, { baseURL: this.config.baseUrl });
|
|
1571
|
+
return response.data;
|
|
1572
|
+
}
|
|
1573
|
+
catch (error) {
|
|
1574
|
+
throw this.handleError(error, `Failed to stop workflow ${jobId}`);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
async listMcpServers(params) {
|
|
1578
|
+
try {
|
|
1579
|
+
const response = await this.client.get('/api/v2/mcp/servers', {
|
|
1580
|
+
baseURL: this.config.baseUrl,
|
|
1581
|
+
params
|
|
1582
|
+
});
|
|
1583
|
+
return response.data;
|
|
1584
|
+
}
|
|
1585
|
+
catch (error) {
|
|
1586
|
+
throw this.handleError(error, 'Failed to list MCP servers');
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
async getMcpServer(serverName) {
|
|
1590
|
+
try {
|
|
1591
|
+
const response = await this.client.get(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, {
|
|
1592
|
+
baseURL: this.config.baseUrl
|
|
1593
|
+
});
|
|
1594
|
+
return response.data;
|
|
1595
|
+
}
|
|
1596
|
+
catch (error) {
|
|
1597
|
+
throw this.handleError(error, `Failed to get MCP server ${serverName}`);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
async createMcpServer(serverName, body) {
|
|
1601
|
+
try {
|
|
1602
|
+
const response = await this.client.post(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, body, { baseURL: this.config.baseUrl });
|
|
1603
|
+
return response.data;
|
|
1604
|
+
}
|
|
1605
|
+
catch (error) {
|
|
1606
|
+
throw this.handleError(error, `Failed to create MCP server ${serverName}`);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
async updateMcpServer(serverName, body) {
|
|
1610
|
+
try {
|
|
1611
|
+
const response = await this.client.patch(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, body, { baseURL: this.config.baseUrl });
|
|
1612
|
+
return response.data;
|
|
1613
|
+
}
|
|
1614
|
+
catch (error) {
|
|
1615
|
+
throw this.handleError(error, `Failed to update MCP server ${serverName}`);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
async deleteMcpServer(serverName) {
|
|
1619
|
+
try {
|
|
1620
|
+
const response = await this.client.delete(`/api/v2/mcp/servers/${encodeURIComponent(serverName)}`, { baseURL: this.config.baseUrl });
|
|
1621
|
+
return response.data;
|
|
1622
|
+
}
|
|
1623
|
+
catch (error) {
|
|
1624
|
+
throw this.handleError(error, `Failed to delete MCP server ${serverName}`);
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
async getMcpProjectConfig(projectId, params) {
|
|
1628
|
+
try {
|
|
1629
|
+
const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}`, { params });
|
|
1630
|
+
return response.data;
|
|
1631
|
+
}
|
|
1632
|
+
catch (error) {
|
|
1633
|
+
throw this.handleError(error, `Failed to get MCP project config ${projectId}`);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
async updateMcpProjectConfig(projectId, body) {
|
|
1637
|
+
try {
|
|
1638
|
+
const response = await this.client.patch(`/mcp/project/${encodeURIComponent(projectId)}`, body);
|
|
1639
|
+
return response.data;
|
|
1640
|
+
}
|
|
1641
|
+
catch (error) {
|
|
1642
|
+
throw this.handleError(error, `Failed to update MCP project config ${projectId}`);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
async getMcpProjectInstalled(projectId) {
|
|
1646
|
+
try {
|
|
1647
|
+
const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}/installed`);
|
|
1648
|
+
return response.data;
|
|
1649
|
+
}
|
|
1650
|
+
catch (error) {
|
|
1651
|
+
throw this.handleError(error, `Failed to get MCP project installed ${projectId}`);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
async installMcpProject(projectId, body) {
|
|
1655
|
+
try {
|
|
1656
|
+
const response = await this.client.post(`/mcp/project/${encodeURIComponent(projectId)}/install`, body);
|
|
1657
|
+
return response.data;
|
|
1658
|
+
}
|
|
1659
|
+
catch (error) {
|
|
1660
|
+
throw this.handleError(error, `Failed to install MCP project ${projectId}`);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
async getMcpProjectComposerUrl(projectId) {
|
|
1664
|
+
try {
|
|
1665
|
+
const response = await this.client.get(`/mcp/project/${encodeURIComponent(projectId)}/composer-url`);
|
|
1666
|
+
return response.data;
|
|
1667
|
+
}
|
|
1668
|
+
catch (error) {
|
|
1669
|
+
throw this.handleError(error, `Failed to get MCP project composer URL ${projectId}`);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
async listAuthzRoles(params) {
|
|
1673
|
+
try {
|
|
1674
|
+
const response = await this.client.get('/authz/roles', { params });
|
|
1675
|
+
return response.data;
|
|
1676
|
+
}
|
|
1677
|
+
catch (error) {
|
|
1678
|
+
throw this.handleError(error, 'Failed to list authz roles');
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
async getAuthzRole(roleId) {
|
|
1682
|
+
try {
|
|
1683
|
+
const response = await this.client.get(`/authz/roles/${encodeURIComponent(roleId)}`);
|
|
1684
|
+
return response.data;
|
|
1685
|
+
}
|
|
1686
|
+
catch (error) {
|
|
1687
|
+
throw this.handleError(error, `Failed to get authz role ${roleId}`);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
async createAuthzRole(body) {
|
|
1691
|
+
try {
|
|
1692
|
+
const response = await this.client.post('/authz/roles', body);
|
|
1693
|
+
return response.data;
|
|
1694
|
+
}
|
|
1695
|
+
catch (error) {
|
|
1696
|
+
throw this.handleError(error, 'Failed to create authz role');
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
async updateAuthzRole(roleId, body) {
|
|
1700
|
+
try {
|
|
1701
|
+
const response = await this.client.patch(`/authz/roles/${encodeURIComponent(roleId)}`, body);
|
|
1702
|
+
return response.data;
|
|
1703
|
+
}
|
|
1704
|
+
catch (error) {
|
|
1705
|
+
throw this.handleError(error, `Failed to update authz role ${roleId}`);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
async deleteAuthzRole(roleId) {
|
|
1709
|
+
try {
|
|
1710
|
+
await this.client.delete(`/authz/roles/${encodeURIComponent(roleId)}`);
|
|
1711
|
+
}
|
|
1712
|
+
catch (error) {
|
|
1713
|
+
throw this.handleError(error, `Failed to delete authz role ${roleId}`);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
async listAuthzRoleAssignments(params) {
|
|
1717
|
+
try {
|
|
1718
|
+
const response = await this.client.get('/authz/role-assignments', { params });
|
|
1719
|
+
return response.data;
|
|
1720
|
+
}
|
|
1721
|
+
catch (error) {
|
|
1722
|
+
throw this.handleError(error, 'Failed to list authz role assignments');
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
async createAuthzRoleAssignment(body) {
|
|
1726
|
+
try {
|
|
1727
|
+
const response = await this.client.post('/authz/role-assignments', body);
|
|
1728
|
+
return response.data;
|
|
1729
|
+
}
|
|
1730
|
+
catch (error) {
|
|
1731
|
+
throw this.handleError(error, 'Failed to create authz role assignment');
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
async deleteAuthzRoleAssignment(assignmentId) {
|
|
1735
|
+
try {
|
|
1736
|
+
await this.client.delete(`/authz/role-assignments/${encodeURIComponent(assignmentId)}`);
|
|
1737
|
+
}
|
|
1738
|
+
catch (error) {
|
|
1739
|
+
throw this.handleError(error, `Failed to delete authz role assignment ${assignmentId}`);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
async listAuthzTeams(params) {
|
|
1743
|
+
try {
|
|
1744
|
+
const response = await this.client.get('/authz/teams', { params });
|
|
1745
|
+
return response.data;
|
|
1746
|
+
}
|
|
1747
|
+
catch (error) {
|
|
1748
|
+
throw this.handleError(error, 'Failed to list authz teams');
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
async getAuthzTeam(teamId) {
|
|
1752
|
+
try {
|
|
1753
|
+
const response = await this.client.get(`/authz/teams/${encodeURIComponent(teamId)}`);
|
|
1754
|
+
return response.data;
|
|
1755
|
+
}
|
|
1756
|
+
catch (error) {
|
|
1757
|
+
throw this.handleError(error, `Failed to get authz team ${teamId}`);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
async createAuthzTeam(body) {
|
|
1761
|
+
try {
|
|
1762
|
+
const response = await this.client.post('/authz/teams', body);
|
|
1763
|
+
return response.data;
|
|
1764
|
+
}
|
|
1765
|
+
catch (error) {
|
|
1766
|
+
throw this.handleError(error, 'Failed to create authz team');
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
async updateAuthzTeam(teamId, body) {
|
|
1770
|
+
try {
|
|
1771
|
+
const response = await this.client.patch(`/authz/teams/${encodeURIComponent(teamId)}`, body);
|
|
1772
|
+
return response.data;
|
|
1773
|
+
}
|
|
1774
|
+
catch (error) {
|
|
1775
|
+
throw this.handleError(error, `Failed to update authz team ${teamId}`);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
async deleteAuthzTeam(teamId) {
|
|
1779
|
+
try {
|
|
1780
|
+
await this.client.delete(`/authz/teams/${encodeURIComponent(teamId)}`);
|
|
1781
|
+
}
|
|
1782
|
+
catch (error) {
|
|
1783
|
+
throw this.handleError(error, `Failed to delete authz team ${teamId}`);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
async listAuthzTeamMembers(teamId, params) {
|
|
1787
|
+
try {
|
|
1788
|
+
const response = await this.client.get(`/authz/teams/${encodeURIComponent(teamId)}/members`, { params });
|
|
1789
|
+
return response.data;
|
|
1790
|
+
}
|
|
1791
|
+
catch (error) {
|
|
1792
|
+
throw this.handleError(error, `Failed to list members for authz team ${teamId}`);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
async addAuthzTeamMember(teamId, body) {
|
|
1796
|
+
try {
|
|
1797
|
+
const response = await this.client.post(`/authz/teams/${encodeURIComponent(teamId)}/members`, body);
|
|
1798
|
+
return response.data;
|
|
1799
|
+
}
|
|
1800
|
+
catch (error) {
|
|
1801
|
+
throw this.handleError(error, `Failed to add member to authz team ${teamId}`);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
async removeAuthzTeamMember(teamId, userId) {
|
|
1805
|
+
try {
|
|
1806
|
+
await this.client.delete(`/authz/teams/${encodeURIComponent(teamId)}/members/${encodeURIComponent(userId)}`);
|
|
1807
|
+
}
|
|
1808
|
+
catch (error) {
|
|
1809
|
+
throw this.handleError(error, `Failed to remove member ${userId} from authz team ${teamId}`);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
async listAuthzShares(params) {
|
|
1813
|
+
try {
|
|
1814
|
+
const response = await this.client.get('/authz/shares', { params });
|
|
1815
|
+
return response.data;
|
|
1816
|
+
}
|
|
1817
|
+
catch (error) {
|
|
1818
|
+
throw this.handleError(error, 'Failed to list authz shares');
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
async getAuthzShare(shareId) {
|
|
1822
|
+
try {
|
|
1823
|
+
const response = await this.client.get(`/authz/shares/${encodeURIComponent(shareId)}`);
|
|
1824
|
+
return response.data;
|
|
1825
|
+
}
|
|
1826
|
+
catch (error) {
|
|
1827
|
+
throw this.handleError(error, `Failed to get authz share ${shareId}`);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
async createAuthzShare(body) {
|
|
1831
|
+
try {
|
|
1832
|
+
const response = await this.client.post('/authz/shares', body);
|
|
1833
|
+
return response.data;
|
|
1834
|
+
}
|
|
1835
|
+
catch (error) {
|
|
1836
|
+
throw this.handleError(error, 'Failed to create authz share');
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
async updateAuthzShare(shareId, body) {
|
|
1840
|
+
try {
|
|
1841
|
+
const response = await this.client.patch(`/authz/shares/${encodeURIComponent(shareId)}`, body);
|
|
1842
|
+
return response.data;
|
|
1843
|
+
}
|
|
1844
|
+
catch (error) {
|
|
1845
|
+
throw this.handleError(error, `Failed to update authz share ${shareId}`);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
async deleteAuthzShare(shareId) {
|
|
1849
|
+
try {
|
|
1850
|
+
await this.client.delete(`/authz/shares/${encodeURIComponent(shareId)}`);
|
|
1851
|
+
}
|
|
1852
|
+
catch (error) {
|
|
1853
|
+
throw this.handleError(error, `Failed to delete authz share ${shareId}`);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
async getAuthzAudit(params) {
|
|
1857
|
+
try {
|
|
1858
|
+
const response = await this.client.get('/authz/audit', { params });
|
|
1859
|
+
return response.data;
|
|
1860
|
+
}
|
|
1861
|
+
catch (error) {
|
|
1862
|
+
throw this.handleError(error, 'Failed to get authz audit log');
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
async getMyPermissions(body) {
|
|
1866
|
+
try {
|
|
1867
|
+
const response = await this.client.post('/authz/me/permissions', body);
|
|
1868
|
+
return response.data;
|
|
1869
|
+
}
|
|
1870
|
+
catch (error) {
|
|
1871
|
+
throw this.handleError(error, 'Failed to get effective permissions');
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
async createMemoryBase(body) {
|
|
1875
|
+
try {
|
|
1876
|
+
const response = await this.client.post('/memories', body);
|
|
1877
|
+
return response.data;
|
|
1878
|
+
}
|
|
1879
|
+
catch (error) {
|
|
1880
|
+
throw this.handleError(error, 'Failed to create memory base');
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
async listMemoryBases(params) {
|
|
1884
|
+
try {
|
|
1885
|
+
const response = await this.client.get('/memories', { params });
|
|
1886
|
+
return response.data;
|
|
1887
|
+
}
|
|
1888
|
+
catch (error) {
|
|
1889
|
+
throw this.handleError(error, 'Failed to list memory bases');
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
async getMemoryBase(memoryBaseId) {
|
|
1893
|
+
try {
|
|
1894
|
+
const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}`);
|
|
1895
|
+
return response.data;
|
|
1896
|
+
}
|
|
1897
|
+
catch (error) {
|
|
1898
|
+
throw this.handleError(error, `Failed to get memory base ${memoryBaseId}`);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
async listMemoryBaseSessions(memoryBaseId, params) {
|
|
1902
|
+
try {
|
|
1903
|
+
const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/sessions`, { params });
|
|
1904
|
+
return response.data;
|
|
1905
|
+
}
|
|
1906
|
+
catch (error) {
|
|
1907
|
+
throw this.handleError(error, `Failed to list sessions for memory base ${memoryBaseId}`);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
async listMemoryBaseMessages(memoryBaseId, params) {
|
|
1911
|
+
try {
|
|
1912
|
+
const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/messages`, { params });
|
|
1913
|
+
return response.data;
|
|
1914
|
+
}
|
|
1915
|
+
catch (error) {
|
|
1916
|
+
throw this.handleError(error, `Failed to list messages for memory base ${memoryBaseId}`);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
async updateMemoryBase(memoryBaseId, body) {
|
|
1920
|
+
try {
|
|
1921
|
+
const response = await this.client.patch(`/memories/${encodeURIComponent(memoryBaseId)}`, body);
|
|
1922
|
+
return response.data;
|
|
1923
|
+
}
|
|
1924
|
+
catch (error) {
|
|
1925
|
+
throw this.handleError(error, `Failed to update memory base ${memoryBaseId}`);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
async deleteMemoryBase(memoryBaseId) {
|
|
1929
|
+
try {
|
|
1930
|
+
await this.client.delete(`/memories/${encodeURIComponent(memoryBaseId)}`);
|
|
1931
|
+
}
|
|
1932
|
+
catch (error) {
|
|
1933
|
+
throw this.handleError(error, `Failed to delete memory base ${memoryBaseId}`);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
async flushMemoryBase(memoryBaseId, body) {
|
|
1937
|
+
try {
|
|
1938
|
+
const response = await this.client.post(`/memories/${encodeURIComponent(memoryBaseId)}/flush`, body);
|
|
1939
|
+
return response.data;
|
|
1940
|
+
}
|
|
1941
|
+
catch (error) {
|
|
1942
|
+
throw this.handleError(error, `Failed to flush memory base ${memoryBaseId}`);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
async checkMemoryBaseMismatch(memoryBaseId) {
|
|
1946
|
+
try {
|
|
1947
|
+
const response = await this.client.get(`/memories/${encodeURIComponent(memoryBaseId)}/mismatch`);
|
|
1948
|
+
return response.data;
|
|
1949
|
+
}
|
|
1950
|
+
catch (error) {
|
|
1951
|
+
throw this.handleError(error, `Failed to check mismatch for memory base ${memoryBaseId}`);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
async regenerateMemoryBase(memoryBaseId) {
|
|
1955
|
+
try {
|
|
1956
|
+
const response = await this.client.post(`/memories/${encodeURIComponent(memoryBaseId)}/regenerate`);
|
|
1957
|
+
return response.data;
|
|
1958
|
+
}
|
|
1959
|
+
catch (error) {
|
|
1960
|
+
throw this.handleError(error, `Failed to regenerate memory base ${memoryBaseId}`);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
async testKnowledgeBaseConnection(body) {
|
|
1964
|
+
try {
|
|
1965
|
+
const response = await this.client.post('/knowledge_bases/test-connection', body);
|
|
1966
|
+
return response.data;
|
|
1967
|
+
}
|
|
1968
|
+
catch (error) {
|
|
1969
|
+
throw this.handleError(error, 'Failed to test knowledge base connection');
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
async listKnowledgeBaseConnectors() {
|
|
1973
|
+
try {
|
|
1974
|
+
const response = await this.client.get('/knowledge_bases/connectors');
|
|
1975
|
+
return response.data;
|
|
1976
|
+
}
|
|
1977
|
+
catch (error) {
|
|
1978
|
+
throw this.handleError(error, 'Failed to list knowledge base connectors');
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
async ingestKnowledgeBaseFolder(kbName, body) {
|
|
1982
|
+
try {
|
|
1983
|
+
const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest/folder`, body);
|
|
1984
|
+
return response.data;
|
|
1985
|
+
}
|
|
1986
|
+
catch (error) {
|
|
1987
|
+
throw this.handleError(error, `Failed to ingest folder into knowledge base ${kbName}`);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
async ingestKnowledgeBaseConnector(kbName, body) {
|
|
1991
|
+
try {
|
|
1992
|
+
const response = await this.client.post(`/knowledge_bases/${encodeURIComponent(kbName)}/ingest/connector`, body);
|
|
1993
|
+
return response.data;
|
|
1994
|
+
}
|
|
1995
|
+
catch (error) {
|
|
1996
|
+
throw this.handleError(error, `Failed to ingest connector into knowledge base ${kbName}`);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
async getKnowledgeBaseMetadataKeys(kbName) {
|
|
2000
|
+
try {
|
|
2001
|
+
const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/metadata/keys`);
|
|
2002
|
+
return response.data;
|
|
2003
|
+
}
|
|
2004
|
+
catch (error) {
|
|
2005
|
+
throw this.handleError(error, `Failed to get metadata keys for knowledge base ${kbName}`);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
async listKnowledgeBaseRuns(kbName, params) {
|
|
2009
|
+
try {
|
|
2010
|
+
const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/runs`, { params });
|
|
2011
|
+
return response.data;
|
|
2012
|
+
}
|
|
2013
|
+
catch (error) {
|
|
2014
|
+
throw this.handleError(error, `Failed to list ingestion runs for knowledge base ${kbName}`);
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
async getKnowledgeBaseRun(kbName, runId) {
|
|
2018
|
+
try {
|
|
2019
|
+
const response = await this.client.get(`/knowledge_bases/${encodeURIComponent(kbName)}/runs/${encodeURIComponent(runId)}`);
|
|
2020
|
+
return response.data;
|
|
2021
|
+
}
|
|
2022
|
+
catch (error) {
|
|
2023
|
+
throw this.handleError(error, `Failed to get ingestion run ${runId} for knowledge base ${kbName}`);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
async reloadExtensionBundle(extensionId, bundleName) {
|
|
2027
|
+
try {
|
|
2028
|
+
const response = await this.client.post(`/extensions/${encodeURIComponent(extensionId)}/bundles/${encodeURIComponent(bundleName)}/reload`);
|
|
2029
|
+
return response.data;
|
|
2030
|
+
}
|
|
2031
|
+
catch (error) {
|
|
2032
|
+
throw this.handleError(error, `Failed to reload extension bundle ${bundleName}`);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
async getExtensionEvents(params) {
|
|
2036
|
+
try {
|
|
2037
|
+
const response = await this.client.get('/extensions/events', { params });
|
|
2038
|
+
return response.data;
|
|
2039
|
+
}
|
|
2040
|
+
catch (error) {
|
|
2041
|
+
throw this.handleError(error, 'Failed to get extension events');
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
async getAgenticFile(params) {
|
|
2045
|
+
try {
|
|
2046
|
+
const response = await this.client.get('/agentic/files', {
|
|
2047
|
+
params,
|
|
2048
|
+
responseType: params.download ? 'arraybuffer' : 'text'
|
|
2049
|
+
});
|
|
2050
|
+
if (params.download) {
|
|
2051
|
+
return {
|
|
2052
|
+
path: params.path,
|
|
2053
|
+
encoding: 'base64',
|
|
2054
|
+
content: Buffer.from(response.data).toString('base64')
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
return { path: params.path, content: response.data };
|
|
2058
|
+
}
|
|
2059
|
+
catch (error) {
|
|
2060
|
+
throw this.handleError(error, `Failed to get agentic file ${params.path}`);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
async resetAgenticSession(params) {
|
|
2064
|
+
try {
|
|
2065
|
+
const response = await this.client.post('/agentic/sessions/reset', undefined, { params });
|
|
2066
|
+
return response.data;
|
|
2067
|
+
}
|
|
2068
|
+
catch (error) {
|
|
2069
|
+
throw this.handleError(error, 'Failed to reset agentic session');
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
async getFlowNoteTranslations(flowId) {
|
|
2073
|
+
try {
|
|
2074
|
+
const response = await this.client.get(`/flows/${encodeURIComponent(flowId)}/note_translations`);
|
|
2075
|
+
return response.data;
|
|
2076
|
+
}
|
|
2077
|
+
catch (error) {
|
|
2078
|
+
throw this.handleError(error, `Failed to get note translations for flow ${flowId}`);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
async getJobQueueMetrics() {
|
|
2082
|
+
try {
|
|
2083
|
+
const response = await this.client.get('/monitor/job_queue');
|
|
2084
|
+
return response.data;
|
|
2085
|
+
}
|
|
2086
|
+
catch (error) {
|
|
2087
|
+
throw this.handleError(error, 'Failed to get job queue metrics');
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
async listA2aAgents() {
|
|
2091
|
+
try {
|
|
2092
|
+
const response = await this.client.get('/a2a/agents');
|
|
2093
|
+
return response.data;
|
|
2094
|
+
}
|
|
2095
|
+
catch (error) {
|
|
2096
|
+
throw this.handleError(error, 'Failed to list A2A agents');
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
async getA2aAgentCard(flowId) {
|
|
2100
|
+
try {
|
|
2101
|
+
const response = await this.client.get(`/a2a/${encodeURIComponent(flowId)}/.well-known/agent-card.json`);
|
|
2102
|
+
return response.data;
|
|
2103
|
+
}
|
|
2104
|
+
catch (error) {
|
|
2105
|
+
throw this.handleError(error, `Failed to get A2A agent card for flow ${flowId}`);
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
async invokeA2aJsonrpc(flowId, body) {
|
|
2109
|
+
try {
|
|
2110
|
+
const response = await this.client.post(`/a2a/${encodeURIComponent(flowId)}/jsonrpc`, body);
|
|
2111
|
+
return response.data;
|
|
2112
|
+
}
|
|
2113
|
+
catch (error) {
|
|
2114
|
+
throw this.handleError(error, `Failed to invoke A2A JSON-RPC for flow ${flowId}`);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
async listPendingWorkflows(params) {
|
|
2118
|
+
try {
|
|
2119
|
+
const response = await this.client.get('/api/v2/workflows/pending', {
|
|
2120
|
+
baseURL: this.config.baseUrl,
|
|
2121
|
+
params
|
|
2122
|
+
});
|
|
2123
|
+
return response.data;
|
|
2124
|
+
}
|
|
2125
|
+
catch (error) {
|
|
2126
|
+
throw this.handleError(error, 'Failed to list pending workflows');
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
async getWorkflowEvents(jobId) {
|
|
2130
|
+
try {
|
|
2131
|
+
const response = await this.client.get(`/api/v2/workflows/${encodeURIComponent(jobId)}/events`, { baseURL: this.config.baseUrl, responseType: 'text' });
|
|
2132
|
+
return response.data;
|
|
2133
|
+
}
|
|
2134
|
+
catch (error) {
|
|
2135
|
+
throw this.handleError(error, `Failed to get events for workflow ${jobId}`);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
async resumeWorkflow(jobId, body) {
|
|
2139
|
+
try {
|
|
2140
|
+
const response = await this.client.post(`/api/v2/workflows/${encodeURIComponent(jobId)}/resume`, body, { baseURL: this.config.baseUrl });
|
|
2141
|
+
return response.data;
|
|
2142
|
+
}
|
|
2143
|
+
catch (error) {
|
|
2144
|
+
throw this.handleError(error, `Failed to resume workflow ${jobId}`);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
async runPublicWorkflow(body) {
|
|
2148
|
+
try {
|
|
2149
|
+
const response = await this.client.post('/api/v2/workflows/public', body, {
|
|
2150
|
+
baseURL: this.config.baseUrl,
|
|
2151
|
+
responseType: 'text'
|
|
2152
|
+
});
|
|
1205
2153
|
return response.data;
|
|
1206
2154
|
}
|
|
1207
2155
|
catch (error) {
|
|
1208
|
-
throw this.handleError(error,
|
|
2156
|
+
throw this.handleError(error, 'Failed to run public workflow');
|
|
1209
2157
|
}
|
|
1210
2158
|
}
|
|
1211
2159
|
handleError(error, message) {
|