@skillful-ai/piece-skillful-agents 0.0.1 → 0.0.3
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 +31 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +20 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/run-agent.d.ts +5 -0
- package/src/lib/actions/run-agent.js +118 -0
- package/src/lib/actions/run-agent.js.map +1 -0
- package/src/lib/common.d.ts +38 -0
- package/src/lib/common.js +69 -0
- package/src/lib/common.js.map +1 -0
- package/src/lib/types.d.ts +49 -0
- package/src/lib/types.js +7 -0
- package/src/lib/types.js.map +1 -0
- package/.eslintrc.json +0 -18
- package/project.json +0 -46
- package/src/index.ts +0 -17
- package/src/lib/actions/run-agent.ts +0 -114
- package/src/lib/common.ts +0 -70
- package/src/lib/types.ts +0 -55
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -9
package/package.json
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skillful-ai/piece-skillful-agents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"
|
|
8
|
+
"@ai-sdk/anthropic": "1.2.12",
|
|
9
|
+
"@ai-sdk/google": "1.2.19",
|
|
10
|
+
"@ai-sdk/openai": "1.3.22",
|
|
11
|
+
"@ai-sdk/replicate": "0.2.8",
|
|
12
|
+
"@sinclair/typebox": "0.34.11",
|
|
13
|
+
"ai": "4.3.16",
|
|
14
|
+
"axios": "1.8.3",
|
|
15
|
+
"axios-retry": "4.4.1",
|
|
16
|
+
"deepmerge-ts": "7.1.0",
|
|
17
|
+
"fast-glob": "3.3.3",
|
|
18
|
+
"mime-types": "2.1.35",
|
|
19
|
+
"nanoid": "3.3.8",
|
|
20
|
+
"semver": "7.6.0",
|
|
21
|
+
"tslib": "^2.3.0",
|
|
22
|
+
"zod": "3.25.76",
|
|
23
|
+
"@activepieces/pieces-common": "0.6.0",
|
|
24
|
+
"@activepieces/pieces-framework": "0.15.0",
|
|
25
|
+
"@activepieces/shared": "0.17.2"
|
|
26
|
+
},
|
|
27
|
+
"overrides": {
|
|
28
|
+
"@tryfabric/martian": {
|
|
29
|
+
"@notionhq/client": "$@notionhq/client"
|
|
30
|
+
},
|
|
31
|
+
"vite": {
|
|
32
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"resolutions": {
|
|
36
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
9
37
|
}
|
|
10
|
-
}
|
|
38
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const skillfulAgents: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").PieceAuthProperty>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skillfulAgents = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const shared_1 = require("@activepieces/shared");
|
|
6
|
+
const run_agent_1 = require("./lib/actions/run-agent");
|
|
7
|
+
exports.skillfulAgents = (0, pieces_framework_1.createPiece)({
|
|
8
|
+
displayName: "Skillful Agents",
|
|
9
|
+
auth: pieces_framework_1.PieceAuth.None(),
|
|
10
|
+
minimumSupportedRelease: '0.66.0',
|
|
11
|
+
logoUrl: "https://app.skillfulai.io/images/logo.png",
|
|
12
|
+
authors: ['skillful-ai'],
|
|
13
|
+
description: "Interact with Skillful AI agents for advanced conversational AI and task automation",
|
|
14
|
+
actions: [
|
|
15
|
+
run_agent_1.runAgent
|
|
16
|
+
],
|
|
17
|
+
triggers: [],
|
|
18
|
+
categories: [shared_1.PieceCategory.UNIVERSAL_AI],
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/skillful-agents/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,iDAAqD;AACrD,uDAAmD;AAEtC,QAAA,cAAc,GAAG,IAAA,8BAAW,EAAC;IACxC,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,4BAAS,CAAC,IAAI,EAAE;IACtB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,2CAA2C;IACpD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,WAAW,EAAE,qFAAqF;IAClG,OAAO,EAAE;QACP,oBAAQ;KACT;IACD,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;CACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const runAgent: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
agentId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
message: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
+
testMode: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runAgent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.runAgent = (0, pieces_framework_1.createAction)({
|
|
8
|
+
name: 'run_skillful_agent',
|
|
9
|
+
displayName: 'Run Agent',
|
|
10
|
+
description: 'Execute a Skillful agent with a message and receive a response.',
|
|
11
|
+
props: {
|
|
12
|
+
agentId: pieces_framework_1.Property.Dropdown({
|
|
13
|
+
displayName: 'Skillful Agent',
|
|
14
|
+
description: 'Select the Skillful agent to run',
|
|
15
|
+
required: true,
|
|
16
|
+
refreshers: [],
|
|
17
|
+
options: (_auth, ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
var _a;
|
|
19
|
+
if (!((_a = ctx === null || ctx === void 0 ? void 0 : ctx.server) === null || _a === void 0 ? void 0 : _a.token)) {
|
|
20
|
+
return {
|
|
21
|
+
disabled: true,
|
|
22
|
+
options: [],
|
|
23
|
+
placeholder: 'Server token required'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const response = yield common_1.skillfulAgentsCommon.listAgents({
|
|
28
|
+
serverUrl: ctx.server.publicUrl,
|
|
29
|
+
token: ctx.server.token
|
|
30
|
+
});
|
|
31
|
+
if (response.status === 200) {
|
|
32
|
+
const agents = response.body;
|
|
33
|
+
const options = agents.map((agent) => ({
|
|
34
|
+
label: `${agent.name}${agent.description ? ` - ${agent.description}` : ''}`,
|
|
35
|
+
value: agent.id
|
|
36
|
+
}));
|
|
37
|
+
return {
|
|
38
|
+
disabled: false,
|
|
39
|
+
options: options
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return {
|
|
44
|
+
disabled: true,
|
|
45
|
+
options: [],
|
|
46
|
+
placeholder: `Failed to load agents: ${response.status}`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
disabled: true,
|
|
53
|
+
options: [],
|
|
54
|
+
placeholder: 'Error loading agents'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
message: pieces_framework_1.Property.LongText({
|
|
60
|
+
displayName: 'Message',
|
|
61
|
+
description: 'The input message or prompt for the agent',
|
|
62
|
+
required: true,
|
|
63
|
+
}),
|
|
64
|
+
testMode: pieces_framework_1.Property.Checkbox({
|
|
65
|
+
displayName: 'Test Mode',
|
|
66
|
+
description: 'Enable test mode - agent execution won\'t consume your usage allowance',
|
|
67
|
+
required: false,
|
|
68
|
+
defaultValue: false,
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
run(context) {
|
|
72
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var _a;
|
|
74
|
+
const { agentId, message, testMode } = context.propsValue;
|
|
75
|
+
const serverUrl = context.server.publicUrl;
|
|
76
|
+
const token = context.server.token;
|
|
77
|
+
if (!agentId || !message) {
|
|
78
|
+
return {
|
|
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
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=run-agent.js.map
|
|
@@ -0,0 +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,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,CA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+
export declare const skillfulAgentsCommon: {
|
|
6
|
+
/**
|
|
7
|
+
* Base URL for SKAI agents bridge service endpoints
|
|
8
|
+
*/
|
|
9
|
+
getBaseUrl: (serverUrl: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* List all available agents for the authenticated user
|
|
12
|
+
*/
|
|
13
|
+
listAgents(params: {
|
|
14
|
+
serverUrl: string;
|
|
15
|
+
token: string;
|
|
16
|
+
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Get a specific agent by ID
|
|
19
|
+
*/
|
|
20
|
+
getAgent(params: {
|
|
21
|
+
serverUrl: string;
|
|
22
|
+
token: string;
|
|
23
|
+
agentId: string;
|
|
24
|
+
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
25
|
+
/**
|
|
26
|
+
* Chat with an agent (handles both new and existing conversations)
|
|
27
|
+
* If chatHistoryId is provided, continues existing conversation
|
|
28
|
+
* If chatHistoryId is omitted, starts new conversation
|
|
29
|
+
*/
|
|
30
|
+
chatWithAgent(params: {
|
|
31
|
+
serverUrl: string;
|
|
32
|
+
token: string;
|
|
33
|
+
agentId: string;
|
|
34
|
+
message: string;
|
|
35
|
+
chatHistoryId?: string;
|
|
36
|
+
isTestMode?: boolean;
|
|
37
|
+
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skillfulAgentsCommon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
/**
|
|
7
|
+
* Common utilities for Skillful Agents piece
|
|
8
|
+
* Handles communication with the SKAI Agents bridge service
|
|
9
|
+
*/
|
|
10
|
+
exports.skillfulAgentsCommon = {
|
|
11
|
+
/**
|
|
12
|
+
* Base URL for SKAI agents bridge service endpoints
|
|
13
|
+
*/
|
|
14
|
+
getBaseUrl: (serverUrl) => `${serverUrl}v1/skai-agents`,
|
|
15
|
+
/**
|
|
16
|
+
* List all available agents for the authenticated user
|
|
17
|
+
*/
|
|
18
|
+
listAgents(params) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
21
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
22
|
+
url: `${exports.skillfulAgentsCommon.getBaseUrl(params.serverUrl)}`,
|
|
23
|
+
authentication: {
|
|
24
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
25
|
+
token: params.token,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Get a specific agent by ID
|
|
32
|
+
*/
|
|
33
|
+
getAgent(params) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
36
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
37
|
+
url: `${exports.skillfulAgentsCommon.getBaseUrl(params.serverUrl)}/${params.agentId}`,
|
|
38
|
+
authentication: {
|
|
39
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
40
|
+
token: params.token,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Chat with an agent (handles both new and existing conversations)
|
|
47
|
+
* If chatHistoryId is provided, continues existing conversation
|
|
48
|
+
* If chatHistoryId is omitted, starts new conversation
|
|
49
|
+
*/
|
|
50
|
+
chatWithAgent(params) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
53
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
54
|
+
url: `${exports.skillfulAgentsCommon.getBaseUrl(params.serverUrl)}/chat`,
|
|
55
|
+
authentication: {
|
|
56
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
57
|
+
token: params.token,
|
|
58
|
+
},
|
|
59
|
+
body: {
|
|
60
|
+
agentId: params.agentId,
|
|
61
|
+
message: params.message,
|
|
62
|
+
chatHistoryId: params.chatHistoryId,
|
|
63
|
+
isTestMode: params.isTestMode || false
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/skillful-agents/src/lib/common.ts"],"names":[],"mappings":";;;;AAAA,+DAAwF;AAExF;;;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;;OAEG;IACG,QAAQ,CAAC,MAA6D;;YAC1E,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAClC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,4BAAoB,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE;gBAC7E,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;aACF,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;;;OAIG;IACG,aAAa,CAAC,MAOnB;;YACC,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAClC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,4BAAoB,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO;gBAChE,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM,CAAC,KAAK;iBACpB;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;aACF,CAAC,CAAA;QACJ,CAAC;KAAA;CACF,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Skillful Agents piece
|
|
3
|
+
* These types match the SKAI API response formats
|
|
4
|
+
*/
|
|
5
|
+
export interface SkillfulAgent {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
logoUrl: string;
|
|
10
|
+
isDraft?: boolean;
|
|
11
|
+
isMinted?: boolean;
|
|
12
|
+
type: string;
|
|
13
|
+
ownerUserId?: string;
|
|
14
|
+
config?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface SkillfulChatResponse {
|
|
17
|
+
message: string;
|
|
18
|
+
chatHistoryId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentDropdownOption {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Context passed to actions from piece execution
|
|
26
|
+
*/
|
|
27
|
+
export interface ActionContext {
|
|
28
|
+
server: {
|
|
29
|
+
publicUrl: string;
|
|
30
|
+
token: string;
|
|
31
|
+
};
|
|
32
|
+
propsValue: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Base parameters for all agent operations
|
|
36
|
+
*/
|
|
37
|
+
export interface BaseAgentParams {
|
|
38
|
+
serverUrl: string;
|
|
39
|
+
token: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parameters for chat operations
|
|
43
|
+
*/
|
|
44
|
+
export interface ChatParams extends BaseAgentParams {
|
|
45
|
+
agentId: string;
|
|
46
|
+
message: string;
|
|
47
|
+
chatHistoryId?: string;
|
|
48
|
+
isTestMode?: boolean;
|
|
49
|
+
}
|
package/src/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/skillful-agents/src/lib/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
package/.eslintrc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["../../../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
package/project.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pieces-skillful-agents",
|
|
3
|
-
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/pieces/custom/skillful-agents/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"release": {
|
|
7
|
-
"version": {
|
|
8
|
-
"manifestRootsToUpdate": ["dist/{projectRoot}"],
|
|
9
|
-
"currentVersionResolver": "git-tag",
|
|
10
|
-
"fallbackCurrentVersionResolver": "disk"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"tags": [],
|
|
14
|
-
"targets": {
|
|
15
|
-
"build": {
|
|
16
|
-
"executor": "@nx/js:tsc",
|
|
17
|
-
"outputs": ["{options.outputPath}"],
|
|
18
|
-
"options": {
|
|
19
|
-
"outputPath": "dist/packages/pieces/custom/skillful-agents",
|
|
20
|
-
"tsConfig": "packages/pieces/custom/skillful-agents/tsconfig.lib.json",
|
|
21
|
-
"packageJson": "packages/pieces/custom/skillful-agents/package.json",
|
|
22
|
-
"main": "packages/pieces/custom/skillful-agents/src/index.ts",
|
|
23
|
-
"assets": [
|
|
24
|
-
"packages/pieces/custom/skillful-agents/*.md",
|
|
25
|
-
{
|
|
26
|
-
"input": "packages/pieces/custom/skillful-agents/src/i18n",
|
|
27
|
-
"output": "./src/i18n",
|
|
28
|
-
"glob": "**/!(i18n.json)"
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"buildableProjectDepsInPackageJsonType": "dependencies",
|
|
32
|
-
"updateBuildableProjectDepsInPackageJson": true
|
|
33
|
-
},
|
|
34
|
-
"dependsOn": ["^build"]
|
|
35
|
-
},
|
|
36
|
-
"nx-release-publish": {
|
|
37
|
-
"options": {
|
|
38
|
-
"packageRoot": "dist/{projectRoot}"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"lint": {
|
|
42
|
-
"executor": "@nx/eslint:lint",
|
|
43
|
-
"outputs": ["{options.outputFile}"]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createPiece, PieceAuth } from "@activepieces/pieces-framework";
|
|
2
|
-
import { PieceCategory } from "@activepieces/shared";
|
|
3
|
-
import { runAgent } from "./lib/actions/run-agent";
|
|
4
|
-
|
|
5
|
-
export const skillfulAgents = createPiece({
|
|
6
|
-
displayName: "Skillful Agents",
|
|
7
|
-
auth: PieceAuth.None(),
|
|
8
|
-
minimumSupportedRelease: '0.66.0',
|
|
9
|
-
logoUrl: "https://app.skillfulai.io/images/logo.png",
|
|
10
|
-
authors: ['skillful-ai'],
|
|
11
|
-
description: "Interact with Skillful AI agents for advanced conversational AI and task automation",
|
|
12
|
-
actions: [
|
|
13
|
-
runAgent
|
|
14
|
-
],
|
|
15
|
-
triggers: [],
|
|
16
|
-
categories: [PieceCategory.UNIVERSAL_AI],
|
|
17
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createAction, Property } from '@activepieces/pieces-framework'
|
|
2
|
-
import { skillfulAgentsCommon } from '../common'
|
|
3
|
-
import { SkillfulAgent, SkillfulChatResponse, AgentDropdownOption } from '../types'
|
|
4
|
-
|
|
5
|
-
export const runAgent = createAction({
|
|
6
|
-
name: 'run_agent',
|
|
7
|
-
displayName: 'Run Agent',
|
|
8
|
-
description: 'Execute a Skillful agent with a message and receive a response.',
|
|
9
|
-
props: {
|
|
10
|
-
agentId: Property.Dropdown({
|
|
11
|
-
displayName: 'Skillful Agent',
|
|
12
|
-
description: 'Select the Skillful agent to run',
|
|
13
|
-
required: true,
|
|
14
|
-
refreshers: [],
|
|
15
|
-
options: async (_auth, ctx) => {
|
|
16
|
-
if (!ctx?.server?.token) {
|
|
17
|
-
return {
|
|
18
|
-
disabled: true,
|
|
19
|
-
options: [],
|
|
20
|
-
placeholder: 'Server token required'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
const response = await skillfulAgentsCommon.listAgents({
|
|
26
|
-
serverUrl: ctx.server.publicUrl,
|
|
27
|
-
token: ctx.server.token
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
if (response.status === 200) {
|
|
31
|
-
const agents: SkillfulAgent[] = response.body
|
|
32
|
-
const options: AgentDropdownOption[] = agents.map((agent) => ({
|
|
33
|
-
label: `${agent.name}${agent.description ? ` - ${agent.description}` : ''}`,
|
|
34
|
-
value: agent.id
|
|
35
|
-
}))
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
disabled: false,
|
|
39
|
-
options: options
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
return {
|
|
43
|
-
disabled: true,
|
|
44
|
-
options: [],
|
|
45
|
-
placeholder: `Failed to load agents: ${response.status}`
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
} catch (error) {
|
|
49
|
-
return {
|
|
50
|
-
disabled: true,
|
|
51
|
-
options: [],
|
|
52
|
-
placeholder: 'Error loading agents'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
}),
|
|
57
|
-
message: Property.LongText({
|
|
58
|
-
displayName: 'Message',
|
|
59
|
-
description: 'The input message or prompt for the agent',
|
|
60
|
-
required: true,
|
|
61
|
-
}),
|
|
62
|
-
testMode: Property.Checkbox({
|
|
63
|
-
displayName: 'Test Mode',
|
|
64
|
-
description: 'Enable test mode - agent execution won\'t consume your usage allowance',
|
|
65
|
-
required: false,
|
|
66
|
-
defaultValue: false,
|
|
67
|
-
}),
|
|
68
|
-
},
|
|
69
|
-
async run(context) {
|
|
70
|
-
const { agentId, message, testMode } = context.propsValue
|
|
71
|
-
const serverUrl = context.server.publicUrl
|
|
72
|
-
const token = context.server.token
|
|
73
|
-
|
|
74
|
-
if (!agentId || !message) {
|
|
75
|
-
return {
|
|
76
|
-
success: false,
|
|
77
|
-
error: 'Agent ID and message are required'
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
// Use single chat endpoint (no chatHistoryId = new chat)
|
|
83
|
-
const response = await skillfulAgentsCommon.chatWithAgent({
|
|
84
|
-
serverUrl,
|
|
85
|
-
token,
|
|
86
|
-
agentId,
|
|
87
|
-
message,
|
|
88
|
-
isTestMode: testMode || false
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
if (response.status === 200) {
|
|
92
|
-
const chatResponse: SkillfulChatResponse = response.body
|
|
93
|
-
|
|
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
|
-
} else {
|
|
103
|
-
throw new Error(`Message send failed: ${response.status} ${response.body?.message || 'Unknown error'}`)
|
|
104
|
-
}
|
|
105
|
-
} catch (error) {
|
|
106
|
-
return {
|
|
107
|
-
success: false,
|
|
108
|
-
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
109
|
-
agentId: agentId,
|
|
110
|
-
userMessage: message
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
})
|
package/src/lib/common.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { httpClient, HttpMethod, AuthenticationType } from '@activepieces/pieces-common'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Common utilities for Skillful Agents piece
|
|
5
|
-
* Handles communication with the SKAI Agents bridge service
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const skillfulAgentsCommon = {
|
|
9
|
-
/**
|
|
10
|
-
* Base URL for SKAI agents bridge service endpoints
|
|
11
|
-
*/
|
|
12
|
-
getBaseUrl: (serverUrl: string) => `${serverUrl}v1/skai-agents`,
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* List all available agents for the authenticated user
|
|
16
|
-
*/
|
|
17
|
-
async listAgents(params: { serverUrl: string, token: string }) {
|
|
18
|
-
return await httpClient.sendRequest({
|
|
19
|
-
method: HttpMethod.GET,
|
|
20
|
-
url: `${skillfulAgentsCommon.getBaseUrl(params.serverUrl)}`,
|
|
21
|
-
authentication: {
|
|
22
|
-
type: AuthenticationType.BEARER_TOKEN,
|
|
23
|
-
token: params.token,
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get a specific agent by ID
|
|
30
|
-
*/
|
|
31
|
-
async getAgent(params: { serverUrl: string, token: string, agentId: string }) {
|
|
32
|
-
return await httpClient.sendRequest({
|
|
33
|
-
method: HttpMethod.GET,
|
|
34
|
-
url: `${skillfulAgentsCommon.getBaseUrl(params.serverUrl)}/${params.agentId}`,
|
|
35
|
-
authentication: {
|
|
36
|
-
type: AuthenticationType.BEARER_TOKEN,
|
|
37
|
-
token: params.token,
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Chat with an agent (handles both new and existing conversations)
|
|
44
|
-
* If chatHistoryId is provided, continues existing conversation
|
|
45
|
-
* If chatHistoryId is omitted, starts new conversation
|
|
46
|
-
*/
|
|
47
|
-
async chatWithAgent(params: {
|
|
48
|
-
serverUrl: string,
|
|
49
|
-
token: string,
|
|
50
|
-
agentId: string,
|
|
51
|
-
message: string,
|
|
52
|
-
chatHistoryId?: string,
|
|
53
|
-
isTestMode?: boolean
|
|
54
|
-
}) {
|
|
55
|
-
return await httpClient.sendRequest({
|
|
56
|
-
method: HttpMethod.POST,
|
|
57
|
-
url: `${skillfulAgentsCommon.getBaseUrl(params.serverUrl)}/chat`,
|
|
58
|
-
authentication: {
|
|
59
|
-
type: AuthenticationType.BEARER_TOKEN,
|
|
60
|
-
token: params.token,
|
|
61
|
-
},
|
|
62
|
-
body: {
|
|
63
|
-
agentId: params.agentId,
|
|
64
|
-
message: params.message,
|
|
65
|
-
chatHistoryId: params.chatHistoryId,
|
|
66
|
-
isTestMode: params.isTestMode || false
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}
|
package/src/lib/types.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for Skillful Agents piece
|
|
3
|
-
* These types match the SKAI API response formats
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface SkillfulAgent {
|
|
7
|
-
id: string
|
|
8
|
-
name: string
|
|
9
|
-
description: string
|
|
10
|
-
logoUrl: string
|
|
11
|
-
isDraft?: boolean
|
|
12
|
-
isMinted?: boolean
|
|
13
|
-
type: string
|
|
14
|
-
ownerUserId?: string
|
|
15
|
-
config?: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SkillfulChatResponse {
|
|
19
|
-
message: string
|
|
20
|
-
chatHistoryId: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface AgentDropdownOption {
|
|
24
|
-
label: string
|
|
25
|
-
value: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Context passed to actions from piece execution
|
|
30
|
-
*/
|
|
31
|
-
export interface ActionContext {
|
|
32
|
-
server: {
|
|
33
|
-
publicUrl: string
|
|
34
|
-
token: string
|
|
35
|
-
}
|
|
36
|
-
propsValue: Record<string, any>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Base parameters for all agent operations
|
|
41
|
-
*/
|
|
42
|
-
export interface BaseAgentParams {
|
|
43
|
-
serverUrl: string
|
|
44
|
-
token: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Parameters for chat operations
|
|
49
|
-
*/
|
|
50
|
-
export interface ChatParams extends BaseAgentParams {
|
|
51
|
-
agentId: string
|
|
52
|
-
message: string
|
|
53
|
-
chatHistoryId?: string
|
|
54
|
-
isTestMode?: boolean
|
|
55
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"forceConsistentCasingInFileNames": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"importHelpers": true,
|
|
8
|
-
"noImplicitOverride": true,
|
|
9
|
-
"noImplicitReturns": true,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"noPropertyAccessFromIndexSignature": true
|
|
12
|
-
},
|
|
13
|
-
"files": [],
|
|
14
|
-
"include": [],
|
|
15
|
-
"references": [
|
|
16
|
-
{
|
|
17
|
-
"path": "./tsconfig.lib.json"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|