@skillful-ai/piece-skillful-agents 0.0.2 → 0.0.4
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/package.json +1 -1
- package/src/lib/actions/run-agent.js +20 -38
- package/src/lib/actions/run-agent.js.map +1 -1
- package/src/lib/common.d.ts +14 -1
- package/src/lib/common.js +27 -1
- package/src/lib/common.js.map +1 -1
- package/src/lib/constants.d.ts +5 -0
- package/src/lib/constants.js +11 -0
- package/src/lib/constants.js.map +1 -0
- package/skillful-ai-piece-skillful-agents-0.0.2.tgz +0 -0
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const common_1 = require("../common");
|
|
7
7
|
exports.runAgent = (0, pieces_framework_1.createAction)({
|
|
8
|
-
name: '
|
|
8
|
+
name: 'run_skillful_agent',
|
|
9
9
|
displayName: 'Run Agent',
|
|
10
10
|
description: 'Execute a Skillful agent with a message and receive a response.',
|
|
11
11
|
props: {
|
|
@@ -70,48 +70,30 @@ exports.runAgent = (0, pieces_framework_1.createAction)({
|
|
|
70
70
|
},
|
|
71
71
|
run(context) {
|
|
72
72
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var _a;
|
|
74
73
|
const { agentId, message, testMode } = context.propsValue;
|
|
75
74
|
const serverUrl = context.server.publicUrl;
|
|
76
75
|
const token = context.server.token;
|
|
77
76
|
if (!agentId || !message) {
|
|
78
|
-
|
|
79
|
-
success: false,
|
|
80
|
-
error: 'Agent ID and message are required'
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
// Use single chat endpoint (no chatHistoryId = new chat)
|
|
85
|
-
const response = yield common_1.skillfulAgentsCommon.chatWithAgent({
|
|
86
|
-
serverUrl,
|
|
87
|
-
token,
|
|
88
|
-
agentId,
|
|
89
|
-
message,
|
|
90
|
-
isTestMode: testMode || false
|
|
91
|
-
});
|
|
92
|
-
if (response.status === 200) {
|
|
93
|
-
const chatResponse = response.body;
|
|
94
|
-
return {
|
|
95
|
-
success: true,
|
|
96
|
-
message: chatResponse.message,
|
|
97
|
-
chatHistoryId: chatResponse.chatHistoryId,
|
|
98
|
-
agentId: agentId,
|
|
99
|
-
userMessage: message,
|
|
100
|
-
testMode: testMode || false
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
throw new Error(`Message send failed: ${response.status} ${((_a = response.body) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
return {
|
|
109
|
-
success: false,
|
|
110
|
-
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
111
|
-
agentId: agentId,
|
|
112
|
-
userMessage: message
|
|
113
|
-
};
|
|
77
|
+
throw new Error('Agent ID and message are required');
|
|
114
78
|
}
|
|
79
|
+
// Use streaming to avoid API gateway timeouts
|
|
80
|
+
// httpClient will throw automatically for non-200 responses
|
|
81
|
+
const response = yield common_1.skillfulAgentsCommon.chatWithAgentStream({
|
|
82
|
+
serverUrl,
|
|
83
|
+
token,
|
|
84
|
+
agentId,
|
|
85
|
+
message,
|
|
86
|
+
isTestMode: testMode || false
|
|
87
|
+
});
|
|
88
|
+
const chatResponse = response.body;
|
|
89
|
+
return {
|
|
90
|
+
success: true,
|
|
91
|
+
message: chatResponse.message,
|
|
92
|
+
chatHistoryId: chatResponse.chatHistoryId,
|
|
93
|
+
agentId: agentId,
|
|
94
|
+
userMessage: message,
|
|
95
|
+
testMode: testMode || false
|
|
96
|
+
};
|
|
115
97
|
});
|
|
116
98
|
},
|
|
117
99
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-agent.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skillful-agents/src/lib/actions/run-agent.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,sCAAgD;AAGnC,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"run-agent.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skillful-agents/src/lib/actions/run-agent.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,sCAAgD;AAGnC,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,iEAAiE;IAC9E,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,CAAO,KAAK,EAAE,GAAG,EAAE,EAAE;;gBAC5B,IAAI,CAAC,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,0CAAE,KAAK,CAAA,EAAE,CAAC;oBACxB,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,uBAAuB;qBACrC,CAAA;gBACH,CAAC;gBAED,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,6BAAoB,CAAC,UAAU,CAAC;wBACrD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS;wBAC/B,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK;qBACxB,CAAC,CAAA;oBAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;wBAC5B,MAAM,MAAM,GAAoB,QAAQ,CAAC,IAAI,CAAA;wBAC7C,MAAM,OAAO,GAA0B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;4BAC5D,KAAK,EAAE,GAAG,KAAK,CA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D,CAAC;YAED,8CAA8C;YAC9C,4DAA4D;YAC5D,MAAM,QAAQ,GAAG,MAAM,6BAAoB,CAAC,mBAAmB,CAAC;gBAC9D,SAAS;gBACT,KAAK;gBACL,OAAO;gBACP,OAAO;gBACP,UAAU,EAAE,QAAQ,IAAI,KAAK;aAC9B,CAAC,CAAA;YAEF,MAAM,YAAY,GAAyB,QAAQ,CAAC,IAAI,CAAA;YAExD,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,aAAa,EAAE,YAAY,CAAC,aAAa;gBACzC,OAAO,EAAE,OAAO;gBAChB,WAAW,EAAE,OAAO;gBACpB,QAAQ,EAAE,QAAQ,IAAI,KAAK;aAC5B,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
package/src/lib/common.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const skillfulAgentsCommon: {
|
|
|
23
23
|
agentId: string;
|
|
24
24
|
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
25
25
|
/**
|
|
26
|
-
* Chat with an agent (handles both new and existing conversations)
|
|
26
|
+
* Chat with an agent (non-streaming - handles both new and existing conversations)
|
|
27
27
|
* If chatHistoryId is provided, continues existing conversation
|
|
28
28
|
* If chatHistoryId is omitted, starts new conversation
|
|
29
29
|
*/
|
|
@@ -35,4 +35,17 @@ export declare const skillfulAgentsCommon: {
|
|
|
35
35
|
chatHistoryId?: string;
|
|
36
36
|
isTestMode?: boolean;
|
|
37
37
|
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
38
|
+
/**
|
|
39
|
+
* Chat with an agent using streaming (avoids API gateway timeouts)
|
|
40
|
+
* If chatHistoryId is provided, continues existing conversation
|
|
41
|
+
* If chatHistoryId is omitted, starts new conversation
|
|
42
|
+
*/
|
|
43
|
+
chatWithAgentStream(params: {
|
|
44
|
+
serverUrl: string;
|
|
45
|
+
token: string;
|
|
46
|
+
agentId: string;
|
|
47
|
+
message: string;
|
|
48
|
+
chatHistoryId?: string;
|
|
49
|
+
isTestMode?: boolean;
|
|
50
|
+
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
38
51
|
};
|
package/src/lib/common.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.skillfulAgentsCommon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
6
7
|
/**
|
|
7
8
|
* Common utilities for Skillful Agents piece
|
|
8
9
|
* Handles communication with the SKAI Agents bridge service
|
|
@@ -43,7 +44,7 @@ exports.skillfulAgentsCommon = {
|
|
|
43
44
|
});
|
|
44
45
|
},
|
|
45
46
|
/**
|
|
46
|
-
* Chat with an agent (handles both new and existing conversations)
|
|
47
|
+
* Chat with an agent (non-streaming - handles both new and existing conversations)
|
|
47
48
|
* If chatHistoryId is provided, continues existing conversation
|
|
48
49
|
* If chatHistoryId is omitted, starts new conversation
|
|
49
50
|
*/
|
|
@@ -62,6 +63,31 @@ exports.skillfulAgentsCommon = {
|
|
|
62
63
|
chatHistoryId: params.chatHistoryId,
|
|
63
64
|
isTestMode: params.isTestMode || false
|
|
64
65
|
},
|
|
66
|
+
timeout: constants_1.SKILLFUL_AGENTS_HTTP_TIMEOUT, // 18 minutes (2 minutes less than 20-minute flow timeout)
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Chat with an agent using streaming (avoids API gateway timeouts)
|
|
72
|
+
* If chatHistoryId is provided, continues existing conversation
|
|
73
|
+
* If chatHistoryId is omitted, starts new conversation
|
|
74
|
+
*/
|
|
75
|
+
chatWithAgentStream(params) {
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
78
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
79
|
+
url: `${exports.skillfulAgentsCommon.getBaseUrl(params.serverUrl)}/chat/stream`,
|
|
80
|
+
authentication: {
|
|
81
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
82
|
+
token: params.token,
|
|
83
|
+
},
|
|
84
|
+
body: {
|
|
85
|
+
agentId: params.agentId,
|
|
86
|
+
message: params.message,
|
|
87
|
+
chatHistoryId: params.chatHistoryId,
|
|
88
|
+
isTestMode: params.isTestMode || false
|
|
89
|
+
},
|
|
90
|
+
timeout: constants_1.SKILLFUL_AGENTS_HTTP_TIMEOUT, // 18 minutes (2 minutes less than 20-minute flow timeout)
|
|
65
91
|
});
|
|
66
92
|
});
|
|
67
93
|
}
|
package/src/lib/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/skillful-agents/src/lib/common.ts"],"names":[],"mappings":";;;;AAAA,+DAAwF;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/skillful-agents/src/lib/common.ts"],"names":[],"mappings":";;;;AAAA,+DAAwF;AACxF,2CAA0D;AAE1D;;;GAGG;AAEU,QAAA,oBAAoB,GAAG;IAClC;;OAEG;IACH,UAAU,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,GAAG,SAAS,gBAAgB;IAE/D;;OAEG;IACG,UAAU,CAAC,MAA4C;;YAC3D,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAClC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,4BAAoB,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;gBAC3D,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;aACF,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;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B;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,aAAa,EAAE,MAAM,CAAC,aAAa;oBACnC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;iBACvC;gBACD,OAAO,EAAE,wCAA4B,EAAE,0DAA0D;aAClG,CAAC,CAAA;QACJ,CAAC;KAAA;CACF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skillful Agents piece timeout constants
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SKILLFUL_AGENTS_HTTP_TIMEOUT_SAFE = exports.SKILLFUL_AGENTS_HTTP_TIMEOUT = void 0;
|
|
7
|
+
// 18 minutes for HTTP requests (2 minutes less than 20-minute flow timeout for graceful error handling)
|
|
8
|
+
exports.SKILLFUL_AGENTS_HTTP_TIMEOUT = 18 * 60 * 1000; // 1,080,000ms
|
|
9
|
+
// Alternative: 17 minutes for even safer buffer
|
|
10
|
+
exports.SKILLFUL_AGENTS_HTTP_TIMEOUT_SAFE = 17 * 60 * 1000; // 1,020,000ms
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/skillful-agents/src/lib/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,wGAAwG;AAC3F,QAAA,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,cAAc;AAEzE,gDAAgD;AACnC,QAAA,iCAAiC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,cAAc"}
|
|
Binary file
|