@activepieces/piece-cody 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-cody
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-cody` to build the library.
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@activepieces/piece-cody",
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.8.3",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "tslib": "^2.3.0",
16
+ "zod": "3.25.76",
17
+ "@activepieces/pieces-common": "0.7.0",
18
+ "@activepieces/pieces-framework": "0.20.0",
19
+ "@activepieces/shared": "0.20.1"
20
+ },
21
+ "overrides": {
22
+ "@tryfabric/martian": {
23
+ "@notionhq/client": "$@notionhq/client"
24
+ },
25
+ "vite": {
26
+ "rollup": "npm:@rollup/wasm-node"
27
+ }
28
+ },
29
+ "resolutions": {
30
+ "rollup": "npm:@rollup/wasm-node"
31
+ }
32
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const codyAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
2
+ export declare const cody: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cody = exports.codyAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const create_document_from_text_1 = require("./lib/actions/create-document-from-text");
7
+ const upload_file_1 = require("./lib/actions/upload-file");
8
+ const send_message_1 = require("./lib/actions/send-message");
9
+ const create_conversation_1 = require("./lib/actions/create-conversation");
10
+ const find_bot_1 = require("./lib/actions/find-bot");
11
+ const find_conversation_1 = require("./lib/actions/find-conversation");
12
+ const pieces_common_1 = require("@activepieces/pieces-common");
13
+ const client_1 = require("./lib/common/client");
14
+ // Define the authentication property using PieceAuth.SecretText
15
+ // This will create a secure text input field in the UI for the user's API key.
16
+ exports.codyAuth = pieces_framework_1.PieceAuth.SecretText({
17
+ displayName: 'API Key',
18
+ description: `Visit your Cody AI API Keys page to retrieve the API key.`,
19
+ required: true,
20
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
21
+ if (auth) {
22
+ try {
23
+ yield client_1.codyClient.listBots(auth);
24
+ return {
25
+ valid: true,
26
+ };
27
+ }
28
+ catch (error) {
29
+ return {
30
+ valid: false,
31
+ error: 'Invalid Api Key'
32
+ };
33
+ }
34
+ }
35
+ return {
36
+ valid: false,
37
+ error: 'Invalid Api Key'
38
+ };
39
+ }),
40
+ });
41
+ exports.cody = (0, pieces_framework_1.createPiece)({
42
+ displayName: "Cody",
43
+ auth: exports.codyAuth,
44
+ minimumSupportedRelease: '0.36.1',
45
+ logoUrl: "https://cdn.activepieces.com/pieces/cody.png",
46
+ authors: ['Pranith124', 'sanket-a11y'],
47
+ actions: [
48
+ create_document_from_text_1.createDocumentFromText,
49
+ upload_file_1.uploadFileAction,
50
+ send_message_1.sendMessageAction,
51
+ create_conversation_1.createConversationAction,
52
+ find_bot_1.findBotAction,
53
+ find_conversation_1.findConversationAction,
54
+ (0, pieces_common_1.createCustomApiCallAction)({
55
+ auth: exports.codyAuth,
56
+ baseUrl: () => 'https://getcody.ai/api/v1',
57
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
58
+ return ({
59
+ Authorization: `Bearer ${auth}`,
60
+ });
61
+ }),
62
+ }),
63
+ ],
64
+ triggers: [
65
+ // Your triggers will go here
66
+ ],
67
+ });
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/cody/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uFAAiF;AACjF,2DAA6D;AAC7D,6DAA+D;AAC/D,2EAA6E;AAC7E,qDAAuD;AACvD,uEAAyE;AACzE,+DAAwE;AACxE,gDAAiD;AAEjD,gEAAgE;AAChE,+EAA+E;AAClE,QAAA,QAAQ,GAAG,4BAAS,CAAC,UAAU,CAAC;IACzC,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACrB,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC;gBACD,MAAM,mBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAChC,OAAO;oBACH,KAAK,EAAE,IAAI;iBACd,CAAA;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO;oBACH,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,iBAAiB;iBAC3B,CAAA;YACL,CAAC;QAEL,CAAC;QACD,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SAC3B,CAAA;IAEL,CAAC,CAAA;CACJ,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC5B,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,gBAAQ;IACd,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE,CAAE,YAAY,EAAC,aAAa,CAAE;IACvC,OAAO,EAAE;QACL,kDAAsB;QACtB,8BAAgB;QAChB,gCAAiB;QACjB,8CAAwB;QACxB,wBAAa;QACb,0CAAsB;QACtB,IAAA,yCAAyB,EAAC;YACpB,IAAI,EAAE,gBAAQ;YACd,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B;YAC1C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC,CAAA;cAAA;SACH,CAAC;KACP;IACH,QAAQ,EAAE;IACN,6BAA6B;KAChC;CACJ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const createConversationAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ bot_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ document_ids: import("@activepieces/pieces-framework").ArrayProperty<false>;
5
+ }>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConversationAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ exports.createConversationAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.codyAuth,
11
+ name: 'create_conversation',
12
+ displayName: 'Create Conversation',
13
+ description: 'Creates a new conversation with a bot.',
14
+ props: {
15
+ bot_id: props_1.botIdDropdown,
16
+ name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Conversation Name',
18
+ description: 'The name for the new conversation.',
19
+ required: true,
20
+ }),
21
+ document_ids: pieces_framework_1.Property.Array({
22
+ displayName: 'Document IDs (Focus Mode)',
23
+ description: "A list of document IDs to limit the bot's knowledge base for this conversation.",
24
+ required: false,
25
+ }),
26
+ },
27
+ run(context) {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ const { bot_id, name, document_ids } = context.propsValue;
30
+ const apiKey = context.auth;
31
+ const docIds = document_ids;
32
+ return yield client_1.codyClient.createConversation(apiKey, bot_id, name, docIds);
33
+ });
34
+ },
35
+ });
36
+ //# sourceMappingURL=create-conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-conversation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/create-conversation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAC9C,2CAAgD;AAEnC,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,MAAM,EAAE,qBAAa;QACrB,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC3B,WAAW,EAAE,2BAA2B;YACxC,WAAW,EACT,iFAAiF;YACnF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAc,CAAC;YAEtC,MAAM,MAAM,GAAG,YAAoC,CAAC;YAEpD,OAAO,MAAM,mBAAU,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3E,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const createDocumentFromText: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ folder_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ content: import("@activepieces/pieces-framework").LongTextProperty<true>;
5
+ }>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDocumentFromText = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ exports.createDocumentFromText = (0, pieces_framework_1.createAction)({
10
+ auth: __1.codyAuth,
11
+ name: 'create_document_from_text',
12
+ displayName: 'Create Document From Text',
13
+ description: 'Upload text content to create a new document within the Cody knowledge base.',
14
+ props: {
15
+ folder_id: props_1.folderIdDropdown,
16
+ name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Document Name',
18
+ description: 'The name or title of the new document.',
19
+ required: true,
20
+ }),
21
+ content: pieces_framework_1.Property.LongText({
22
+ displayName: 'Content',
23
+ description: 'The text or HTML content to be added to the document. Max 768 KB.',
24
+ required: true,
25
+ }),
26
+ },
27
+ run(context) {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ const { folder_id, name, content } = context.propsValue;
30
+ const apiKey = context.auth;
31
+ return yield client_1.codyClient.createDocument(apiKey, name, folder_id, content);
32
+ });
33
+ },
34
+ });
35
+ //# sourceMappingURL=create-document-from-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-document-from-text.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/create-document-from-text.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAC9C,2CAAmD;AAEtC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,8EAA8E;IAC3F,KAAK,EAAE;QACH,SAAS,EAAE,wBAAgB;QAC3B,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAE5B,OAAO,MAAM,mBAAU,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC7E,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const findBotAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findBotAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ exports.findBotAction = (0, pieces_framework_1.createAction)({
9
+ auth: __1.codyAuth,
10
+ name: 'find_bot',
11
+ displayName: 'Find Bot',
12
+ description: 'Finds a bot based on its name.',
13
+ props: {
14
+ name: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Bot Name',
16
+ description: 'The name of the bot to search for. The search is case-insensitive and partial.',
17
+ required: true,
18
+ })
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const { name } = context.propsValue;
23
+ const apiKey = context.auth;
24
+ const bots = yield client_1.codyClient.listBots(apiKey, name);
25
+ // The API returns an array of matching bots.
26
+ // We will return the full array to the user.
27
+ return {
28
+ found: bots.length > 0,
29
+ bots: bots,
30
+ };
31
+ });
32
+ },
33
+ });
34
+ //# sourceMappingURL=find-bot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-bot.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/find-bot.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAEjC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE;QACH,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACpC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAE5B,MAAM,IAAI,GAAG,MAAM,mBAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAErD,6CAA6C;YAC7C,6CAA6C;YAC7C,OAAO;gBACH,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC;gBACtB,IAAI,EAAE,IAAI;aACb,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const findConversationAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ bot_id: {
3
+ required: false;
4
+ description?: string | undefined;
5
+ displayName: string;
6
+ refreshers: string[];
7
+ refreshOnSearch?: boolean;
8
+ options: (propsValue: Record<string, unknown>, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
9
+ valueSchema: string;
10
+ type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
11
+ defaultValue?: unknown;
12
+ };
13
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findConversationAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ exports.findConversationAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.codyAuth,
11
+ name: 'find_conversation',
12
+ displayName: 'Find Conversation',
13
+ description: 'Finds a conversation based on its name and/or the bot it belongs to.',
14
+ props: {
15
+ bot_id: Object.assign(Object.assign({}, props_1.botIdDropdown), { required: false }),
16
+ name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Conversation Name',
18
+ description: 'The name of the conversation to search for (partial match).',
19
+ required: false,
20
+ })
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { bot_id, name } = context.propsValue;
25
+ const apiKey = context.auth;
26
+ if (!bot_id && !name) {
27
+ throw new Error("To find a conversation, please provide a Bot or a Conversation Name to search.");
28
+ }
29
+ const conversations = yield client_1.codyClient.listConversations(apiKey, {
30
+ botId: bot_id,
31
+ keyword: name,
32
+ });
33
+ return {
34
+ found: conversations.length > 0,
35
+ conversations: conversations,
36
+ };
37
+ });
38
+ },
39
+ });
40
+ //# sourceMappingURL=find-conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-conversation.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/find-conversation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAC9C,2CAAgD;AAEnC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,sEAAsE;IACnF,KAAK,EAAE;QAEH,MAAM,kCACC,qBAAa,KAChB,QAAQ,EAAE,KAAK,GAClB;QACD,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,KAAK;SAClB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAE5B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;YACtG,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,mBAAU,CAAC,iBAAiB,CAAC,MAAM,EAAE;gBAC7D,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,OAAO;gBACH,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC;gBAC/B,aAAa,EAAE,aAAa;aAC/B,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const sendMessageAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ conversation_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ content: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendMessageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ exports.sendMessageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.codyAuth,
11
+ name: 'send_message',
12
+ displayName: 'Send Message',
13
+ description: 'Send your message and receive the AI-generated response.',
14
+ props: {
15
+ conversation_id: props_1.conversationIdDropdown,
16
+ content: pieces_framework_1.Property.LongText({
17
+ displayName: 'Message',
18
+ description: 'The message to send to the conversation. (Max 2000 characters)',
19
+ required: true,
20
+ }),
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { conversation_id, content } = context.propsValue;
25
+ const apiKey = context.auth;
26
+ return yield client_1.codyClient.sendMessage(apiKey, conversation_id, content);
27
+ });
28
+ },
29
+ });
30
+ //# sourceMappingURL=send-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/send-message.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAC9C,2CAAyD;AAE5C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,0DAA0D;IACvE,KAAK,EAAE;QACH,eAAe,EAAE,8BAAsB;QACvC,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAc,CAAC;YAEtC,OAAO,MAAM,mBAAU,CAAC,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QAC1E,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const uploadFileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ folder_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ file: import("@activepieces/pieces-framework").FileProperty<true>;
4
+ }>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadFileAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
10
+ exports.uploadFileAction = (0, pieces_framework_1.createAction)({
11
+ auth: __1.codyAuth,
12
+ name: 'upload_file',
13
+ displayName: 'Upload File to Knowledge Base',
14
+ description: 'Add a file directly into a specific folder in the knowledge base.',
15
+ props: {
16
+ folder_id: props_1.folderIdDropdown,
17
+ file: pieces_framework_1.Property.File({
18
+ displayName: 'File',
19
+ description: 'The file to upload (e.g., txt, md, rtf, pdf, ppt, docx).',
20
+ required: true,
21
+ })
22
+ },
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const { folder_id, file } = context.propsValue;
26
+ const apiKey = context.auth;
27
+ // Step 1: Determine Content-Type from filename using the mime-types library
28
+ const contentType = mime_types_1.default.lookup(file.filename) || 'application/octet-stream';
29
+ // Step 2: Get a Signed URL from the Cody API
30
+ const { url: signedUrl, key } = yield client_1.codyClient.getSignedUrl(apiKey, file.filename, contentType);
31
+ // Step 3: Upload the actual file data to the signed URL
32
+ yield client_1.codyClient.uploadFileToS3(signedUrl, file.data, contentType);
33
+ // Step 4: Finalize the document creation in Cody
34
+ yield client_1.codyClient.createDocumentFromFile(apiKey, folder_id, key);
35
+ return {
36
+ success: true,
37
+ message: `File '${file.filename}' uploaded successfully and is being processed.`
38
+ };
39
+ });
40
+ },
41
+ });
42
+ //# sourceMappingURL=upload-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,6CAA8C;AAC9C,2CAAmD;AACnD,oEAA8B;AAEjB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,mEAAmE;IAChF,KAAK,EAAE;QACH,SAAS,EAAE,wBAAgB;QAC3B,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAChB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAE5B,4EAA4E;YAC5E,MAAM,WAAW,GAAG,oBAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,0BAA0B,CAAC;YAE7E,6CAA6C;YAC7C,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,mBAAU,CAAC,YAAY,CACzD,MAAM,EACN,IAAI,CAAC,QAAQ,EACb,WAAW,CACd,CAAC;YAEF,wDAAwD;YACxD,MAAM,mBAAU,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAEnE,iDAAiD;YACjD,MAAM,mBAAU,CAAC,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;YAEhE,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,SAAS,IAAI,CAAC,QAAQ,iDAAiD;aACnF,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ export declare const CODY_BASE_URL = "https://getcody.ai/api/v1";
2
+ export interface CodyFolder {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface CodyListFoldersResponse {
7
+ data: CodyFolder[];
8
+ }
9
+ export interface CodyCreateDocumentResponse {
10
+ data: {
11
+ id: string;
12
+ name: string;
13
+ status: string;
14
+ content_url: string;
15
+ folder_id: string;
16
+ created_at: number;
17
+ };
18
+ }
19
+ export interface CodySignedUrlResponse {
20
+ data: {
21
+ url: string;
22
+ key: string;
23
+ };
24
+ }
25
+ export interface CodyConversation {
26
+ id: string;
27
+ name: string;
28
+ }
29
+ export interface CodyListConversationsResponse {
30
+ data: CodyConversation[];
31
+ }
32
+ export interface CodyMessageResponse {
33
+ data: {
34
+ id: string;
35
+ content: string;
36
+ conversation_id: string;
37
+ machine: boolean;
38
+ failed_responding: boolean;
39
+ flagged: boolean;
40
+ created_at: number;
41
+ };
42
+ }
43
+ export interface CodyBot {
44
+ id: string;
45
+ name: string;
46
+ }
47
+ export interface CodyListBotsResponse {
48
+ data: CodyBot[];
49
+ }
50
+ export interface CodyCreateConversationResponse {
51
+ data: CodyConversation;
52
+ }
53
+ export declare const codyClient: {
54
+ listFolders(apiKey: string): Promise<CodyFolder[]>;
55
+ createDocument(apiKey: string, name: string, folderId: string, content: string): Promise<CodyCreateDocumentResponse>;
56
+ getSignedUrl(apiKey: string, fileName: string, contentType: string): Promise<CodySignedUrlResponse["data"]>;
57
+ uploadFileToS3(signedUrl: string, fileBuffer: Buffer, contentType: string): Promise<void>;
58
+ createDocumentFromFile(apiKey: string, folderId: string, key: string): Promise<void>;
59
+ listConversations(apiKey: string, params?: {
60
+ botId?: string;
61
+ keyword?: string;
62
+ }): Promise<CodyConversation[]>;
63
+ sendMessage(apiKey: string, conversationId: string, content: string): Promise<CodyMessageResponse>;
64
+ listBots(apiKey: string, keyword?: string): Promise<CodyBot[]>;
65
+ createConversation(apiKey: string, botId: string, name: string, documentIds?: string[]): Promise<CodyCreateConversationResponse>;
66
+ };
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codyClient = exports.CODY_BASE_URL = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ exports.CODY_BASE_URL = "https://getcody.ai/api/v1";
7
+ exports.codyClient = {
8
+ listFolders(apiKey) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const response = yield pieces_common_1.httpClient.sendRequest({
11
+ method: pieces_common_1.HttpMethod.GET,
12
+ url: `${exports.CODY_BASE_URL}/folders`,
13
+ authentication: {
14
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
15
+ token: apiKey,
16
+ },
17
+ });
18
+ return response.body.data;
19
+ });
20
+ },
21
+ createDocument(apiKey, name, folderId, content) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const request = {
24
+ method: pieces_common_1.HttpMethod.POST,
25
+ url: `${exports.CODY_BASE_URL}/documents`,
26
+ authentication: {
27
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
28
+ token: apiKey,
29
+ },
30
+ body: {
31
+ name,
32
+ folder_id: folderId,
33
+ content,
34
+ },
35
+ };
36
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
37
+ return response.body;
38
+ });
39
+ },
40
+ // New function to get the signed URL
41
+ getSignedUrl(apiKey, fileName, contentType) {
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ const response = yield pieces_common_1.httpClient.sendRequest({
44
+ method: pieces_common_1.HttpMethod.POST,
45
+ url: `${exports.CODY_BASE_URL}/uploads/signed-url`,
46
+ authentication: {
47
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
48
+ token: apiKey,
49
+ },
50
+ body: {
51
+ file_name: fileName,
52
+ content_type: contentType
53
+ }
54
+ });
55
+ return response.body.data;
56
+ });
57
+ },
58
+ // New function to upload the file buffer to S3
59
+ uploadFileToS3(signedUrl, fileBuffer, contentType) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ yield pieces_common_1.httpClient.sendRequest({
62
+ method: pieces_common_1.HttpMethod.PUT,
63
+ url: signedUrl,
64
+ body: fileBuffer,
65
+ headers: {
66
+ 'Content-Type': contentType,
67
+ },
68
+ });
69
+ });
70
+ },
71
+ // New function to finalize the document creation
72
+ createDocumentFromFile(apiKey, folderId, key) {
73
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
74
+ yield pieces_common_1.httpClient.sendRequest({
75
+ method: pieces_common_1.HttpMethod.POST,
76
+ // This endpoint was in your first documentation dump.
77
+ url: `${exports.CODY_BASE_URL}/documents/file`,
78
+ authentication: {
79
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
80
+ token: apiKey,
81
+ },
82
+ body: {
83
+ folder_id: folderId,
84
+ key: key,
85
+ },
86
+ });
87
+ });
88
+ },
89
+ listConversations(apiKey, params) {
90
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
+ const queryParams = {};
92
+ if (params === null || params === void 0 ? void 0 : params.botId) {
93
+ queryParams['bot_id'] = params.botId;
94
+ }
95
+ if (params === null || params === void 0 ? void 0 : params.keyword) {
96
+ queryParams['keyword'] = params.keyword;
97
+ }
98
+ const response = yield pieces_common_1.httpClient.sendRequest({
99
+ method: pieces_common_1.HttpMethod.GET,
100
+ url: `${exports.CODY_BASE_URL}/conversations`,
101
+ queryParams: queryParams,
102
+ authentication: {
103
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
104
+ token: apiKey,
105
+ },
106
+ });
107
+ return response.body.data;
108
+ });
109
+ },
110
+ // New function to send a message
111
+ sendMessage(apiKey, conversationId, content) {
112
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
113
+ const response = yield pieces_common_1.httpClient.sendRequest({
114
+ method: pieces_common_1.HttpMethod.POST,
115
+ url: `${exports.CODY_BASE_URL}/messages`,
116
+ authentication: {
117
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
118
+ token: apiKey,
119
+ },
120
+ body: {
121
+ conversation_id: conversationId,
122
+ content: content,
123
+ }
124
+ });
125
+ return response.body;
126
+ });
127
+ },
128
+ listBots(apiKey, keyword) {
129
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
130
+ const queryParams = {};
131
+ if (keyword) {
132
+ queryParams['keyword'] = keyword;
133
+ }
134
+ const response = yield pieces_common_1.httpClient.sendRequest({
135
+ method: pieces_common_1.HttpMethod.GET,
136
+ url: `${exports.CODY_BASE_URL}/bots`,
137
+ queryParams: queryParams, // Add queryParams to the request
138
+ authentication: {
139
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
140
+ token: apiKey,
141
+ },
142
+ });
143
+ return response.body.data;
144
+ });
145
+ },
146
+ // New function to create a conversation
147
+ createConversation(apiKey, botId, name, documentIds) {
148
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
149
+ const response = yield pieces_common_1.httpClient.sendRequest({
150
+ method: pieces_common_1.HttpMethod.POST,
151
+ url: `${exports.CODY_BASE_URL}/conversations`,
152
+ authentication: {
153
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
154
+ token: apiKey,
155
+ },
156
+ body: {
157
+ bot_id: botId,
158
+ name: name,
159
+ document_ids: documentIds,
160
+ }
161
+ });
162
+ return response.body;
163
+ });
164
+ },
165
+ };
166
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,+DAAsG;AAEzF,QAAA,aAAa,GAAG,2BAA2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a,EACb,IAAY,EACZ,WAAsB;;YAEtB,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAiC;gBAC1E,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,qBAAa,gBAAgB;gBACrC,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,MAAM;iBAChB;gBACD,IAAI,EAAE;oBACF,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,IAAI;oBACV,YAAY,EAAE,WAAW;iBAC5B;aACJ,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CAGJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const folderIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
2
+ export declare const conversationIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ export declare const botIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.botIdDropdown = exports.conversationIdDropdown = exports.folderIdDropdown = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const client_1 = require("./client");
7
+ exports.folderIdDropdown = pieces_framework_1.Property.Dropdown({
8
+ displayName: 'Folder',
9
+ required: true,
10
+ refreshers: [],
11
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
12
+ if (!auth) {
13
+ return {
14
+ disabled: true,
15
+ placeholder: 'Connect your Cody AI account first.',
16
+ options: [],
17
+ };
18
+ }
19
+ try {
20
+ // Note: Comment removed as the endpoint is now confirmed.
21
+ const folders = yield client_1.codyClient.listFolders(auth);
22
+ if (folders.length === 0) {
23
+ return {
24
+ disabled: true,
25
+ options: [],
26
+ placeholder: "No folders found. Please create a folder in Cody first.",
27
+ };
28
+ }
29
+ return {
30
+ disabled: false,
31
+ options: folders.map((folder) => ({
32
+ label: folder.name,
33
+ value: folder.id,
34
+ })),
35
+ };
36
+ }
37
+ catch (error) {
38
+ return {
39
+ disabled: true,
40
+ options: [],
41
+ placeholder: "Error listing folders. Check connection or API key permissions.",
42
+ };
43
+ }
44
+ }),
45
+ });
46
+ exports.conversationIdDropdown = pieces_framework_1.Property.Dropdown({
47
+ displayName: 'Conversation',
48
+ required: true,
49
+ refreshers: [],
50
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
51
+ if (!auth) {
52
+ return {
53
+ disabled: true,
54
+ placeholder: 'Connect your Cody AI account first.',
55
+ options: [],
56
+ };
57
+ }
58
+ try {
59
+ // NOTE: Comment removed as endpoint is confirmed
60
+ const conversations = yield client_1.codyClient.listConversations(auth);
61
+ if (conversations.length === 0) {
62
+ return {
63
+ disabled: true,
64
+ options: [],
65
+ placeholder: "No conversations found. Please create one in Cody first.",
66
+ };
67
+ }
68
+ return {
69
+ disabled: false,
70
+ options: conversations.map((convo) => ({
71
+ label: convo.name,
72
+ value: convo.id,
73
+ })),
74
+ };
75
+ }
76
+ catch (error) {
77
+ return {
78
+ disabled: true,
79
+ options: [],
80
+ placeholder: "Error listing conversations.",
81
+ };
82
+ }
83
+ }),
84
+ });
85
+ // Add the new dropdown for bots
86
+ exports.botIdDropdown = pieces_framework_1.Property.Dropdown({
87
+ displayName: 'Bot',
88
+ required: true,
89
+ refreshers: [],
90
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
91
+ if (!auth) {
92
+ return {
93
+ disabled: true,
94
+ placeholder: 'Connect your Cody AI account first.',
95
+ options: [],
96
+ };
97
+ }
98
+ try {
99
+ const bots = yield client_1.codyClient.listBots(auth);
100
+ if (bots.length === 0) {
101
+ return {
102
+ disabled: true,
103
+ options: [],
104
+ placeholder: "No bots found. Please create one in Cody first.",
105
+ };
106
+ }
107
+ return {
108
+ disabled: false,
109
+ options: bots.map((bot) => ({
110
+ label: bot.name,
111
+ value: bot.id,
112
+ })),
113
+ };
114
+ }
115
+ catch (error) {
116
+ return {
117
+ disabled: true,
118
+ options: [],
119
+ placeholder: "Error listing bots.",
120
+ };
121
+ }
122
+ }),
123
+ });
124
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cody/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAAsC;AAEzB,QAAA,gBAAgB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC9C,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO;gBACH,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,qCAAqC;gBAClD,OAAO,EAAE,EAAE;aACd,CAAC;QACN,CAAC;QACD,IAAI,CAAC;YACD,0DAA0D;YAC1D,MAAM,OAAO,GAAG,MAAM,mBAAU,CAAC,WAAW,CAAC,IAAc,CAAC,CAAC;YAC7D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnB,OAAO;oBACP,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,yDAAyD;iBACzE,CAAC;YACN,CAAC;YACD,OAAO;gBACH,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC9B,KAAK,EAAE,MAAM,CAAC,IAAI;oBAClB,KAAK,EAAE,MAAM,CAAC,EAAE;iBACnB,CAAC,CAAC;aACN,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,QAAQ,EAAE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