@activepieces/piece-raia-ai 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-raia-ai
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-raia-ai` to build the library.
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@activepieces/piece-raia-ai",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.13.1",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "form-data": "4.0.4",
13
+ "mime-types": "2.1.35",
14
+ "nanoid": "3.3.8",
15
+ "semver": "7.6.0",
16
+ "socket.io-client": "4.8.1",
17
+ "tslib": "^2.3.0",
18
+ "zod": "4.1.13",
19
+ "@activepieces/pieces-common": "0.10.1",
20
+ "@activepieces/pieces-framework": "0.22.2",
21
+ "@activepieces/shared": "0.30.1"
22
+ },
23
+ "resolutions": {
24
+ "rollup": "npm:@rollup/wasm-node"
25
+ }
26
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const raiaAi: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.raiaAi = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const prompt_agent_1 = require("./lib/actions/prompt-agent");
7
+ const upload_agent_file_1 = require("./lib/actions/upload-agent-file");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ const auth_1 = require("./lib/common/auth");
10
+ const constants_1 = require("./lib/common/constants");
11
+ exports.raiaAi = (0, pieces_framework_1.createPiece)({
12
+ displayName: "raia",
13
+ auth: auth_1.raiaAiAuth,
14
+ minimumSupportedRelease: '0.36.1',
15
+ logoUrl: "https://cdn.activepieces.com/pieces/raia-ai.png",
16
+ authors: ["kishanprmr"],
17
+ actions: [prompt_agent_1.promptAgentAction, upload_agent_file_1.uploadAgentFileAction,
18
+ (0, pieces_common_1.createCustomApiCallAction)({
19
+ auth: auth_1.raiaAiAuth,
20
+ baseUrl: () => constants_1.BASE_URL,
21
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
22
+ return {
23
+ 'Agent-Secret-Key': auth.secret_text
24
+ };
25
+ })
26
+ })
27
+ ],
28
+ triggers: [],
29
+ });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/raia-ai/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAA6D;AAC7D,6DAA+D;AAC/D,uEAAwE;AACxE,+DAAwE;AACxE,4CAA+C;AAC/C,sDAAkD;AAErC,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,iBAAU;IAChB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,OAAO,EAAE,CAAC,gCAAiB,EAAE,yCAAqB;QAChD,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,iBAAU;YAChB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAQ;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,kBAAkB,EAAE,IAAI,CAAC,WAAW;iBACrC,CAAA;YACH,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const promptAgentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
3
+ }>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promptAgentAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const constants_1 = require("../common/constants");
9
+ exports.promptAgentAction = (0, pieces_framework_1.createAction)({
10
+ name: 'prompt-agent',
11
+ displayName: 'Prompt Agent',
12
+ description: 'Sends a prompt to a Raia Agent.',
13
+ auth: auth_1.raiaAiAuth,
14
+ props: {
15
+ prompt: pieces_framework_1.Property.LongText({
16
+ displayName: 'Prompt',
17
+ required: true
18
+ })
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const response = yield pieces_common_1.httpClient.sendRequest({
23
+ method: pieces_common_1.HttpMethod.POST,
24
+ url: constants_1.BASE_URL + '/prompts',
25
+ headers: {
26
+ 'Agent-Secret-Key': context.auth.secret_text,
27
+ 'Content-Type': 'application/json'
28
+ },
29
+ body: { prompt: context.propsValue.prompt }
30
+ });
31
+ return response.body;
32
+ });
33
+ }
34
+ });
35
+ //# sourceMappingURL=prompt-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-agent.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/raia-ai/src/lib/actions/prompt-agent.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA4C;AAC5C,+DAAqE;AACrE,mDAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,iCAAiC;IAC9C,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,oBAAQ,GAAG,UAAU;gBAC1B,OAAO,EAAE;oBACL,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;oBAC5C,cAAc,EAAE,kBAAkB;iBACrC;gBACD,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;aAC9C,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;QACxB,CAAC;KAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const uploadAgentFileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ file: import("@activepieces/pieces-framework").FileProperty<true>;
3
+ }>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadAgentFileAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const constants_1 = require("../common/constants");
9
+ const form_data_1 = tslib_1.__importDefault(require("form-data"));
10
+ exports.uploadAgentFileAction = (0, pieces_framework_1.createAction)({
11
+ name: 'upload-agent-file',
12
+ displayName: 'Upload Agent File',
13
+ description: 'Upload file to a Raia Agent.',
14
+ auth: auth_1.raiaAiAuth,
15
+ props: {
16
+ file: pieces_framework_1.Property.File({
17
+ displayName: 'File',
18
+ required: true
19
+ })
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const { file } = context.propsValue;
24
+ const formData = new form_data_1.default();
25
+ formData.append('file', file.data, { filename: file.filename });
26
+ const response = yield pieces_common_1.httpClient.sendRequest({
27
+ method: pieces_common_1.HttpMethod.POST,
28
+ url: constants_1.BASE_URL + '/agent-files/upload',
29
+ headers: Object.assign({ 'Agent-Secret-Key': context.auth.secret_text }, formData.getHeaders()),
30
+ body: formData
31
+ });
32
+ return response.body;
33
+ });
34
+ }
35
+ });
36
+ //# sourceMappingURL=upload-agent-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-agent-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/raia-ai/src/lib/actions/upload-agent-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA4C;AAC5C,+DAAqE;AACrE,mDAA+C;AAC/C,kEAAiC;AAEpB,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,8BAA8B;IAC3C,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACH,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAChB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,CAAC,UAAU,CAAA;YAEjC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAChC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAC,IAAI,CAAC,IAAI,EAAC,EAAC,QAAQ,EAAC,IAAI,CAAC,QAAQ,EAAC,CAAC,CAAA;YAE1D,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,oBAAQ,GAAG,qBAAqB;gBACrC,OAAO,kBACH,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,IACzC,QAAQ,CAAC,UAAU,EAAE,CAC3B;gBACD,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;QACxB,CAAC;KAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const raiaAiAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.raiaAiAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const constants_1 = require("./constants");
8
+ exports.raiaAiAuth = pieces_framework_1.PieceAuth.SecretText({
9
+ displayName: 'API Key',
10
+ required: true,
11
+ description: `
12
+ 1. Open your agent in raiaAI Launch Pad and go to Agent → Skills.
13
+ 2. Add/enable “API Skill” (toggle it Active).
14
+ 3. In the API Skill settings, click “Generate Secret Key” (your agent’s API key).`,
15
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
16
+ try {
17
+ yield pieces_common_1.httpClient.sendRequest({
18
+ method: pieces_common_1.HttpMethod.GET,
19
+ url: constants_1.BASE_URL + '/agents/by-api-key',
20
+ headers: {
21
+ 'Agent-Secret-Key': auth
22
+ }
23
+ });
24
+ return {
25
+ valid: true
26
+ };
27
+ }
28
+ catch (_b) {
29
+ return {
30
+ valid: false,
31
+ error: 'Invalid API Key.'
32
+ };
33
+ }
34
+ })
35
+ });
36
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/raia-ai/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AACrE,2CAAuC;AAE1B,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE;;;sFAGqE;IAClF,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACrB,IAAI,CAAC;YACD,MAAM,0BAAU,CAAC,WAAW,CAAC;gBACzB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,oBAAQ,GAAG,oBAAoB;gBACpC,OAAO,EAAE;oBACL,kBAAkB,EAAE,IAAI;iBAC3B;aACJ,CAAC,CAAA;YAEF,OAAO;gBACH,KAAK,EAAE,IAAI;aACd,CAAA;QACL,CAAC;QACD,WAAM,CAAC;YACH,OAAO;gBACH,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,kBAAkB;aAC5B,CAAA;QACL,CAAC;IACL,CAAC,CAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const BASE_URL = "https://api.raia2.com/external";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_URL = void 0;
4
+ exports.BASE_URL = 'https://api.raia2.com/external';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/raia-ai/src/lib/common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,gCAAgC,CAAA"}