@activepieces/piece-cody 0.1.5 → 0.2.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.
Files changed (37) hide show
  1. package/package.json +7 -16
  2. package/src/index.js +13 -72
  3. package/src/index.d.ts +0 -3
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/create-conversation.d.ts +0 -6
  7. package/src/lib/actions/create-conversation.d.ts.map +0 -1
  8. package/src/lib/actions/create-conversation.js +0 -38
  9. package/src/lib/actions/create-conversation.js.map +0 -1
  10. package/src/lib/actions/create-document-from-text.d.ts +0 -6
  11. package/src/lib/actions/create-document-from-text.d.ts.map +0 -1
  12. package/src/lib/actions/create-document-from-text.js +0 -37
  13. package/src/lib/actions/create-document-from-text.js.map +0 -1
  14. package/src/lib/actions/find-bot.d.ts +0 -4
  15. package/src/lib/actions/find-bot.d.ts.map +0 -1
  16. package/src/lib/actions/find-bot.js +0 -36
  17. package/src/lib/actions/find-bot.js.map +0 -1
  18. package/src/lib/actions/find-conversation.d.ts +0 -18
  19. package/src/lib/actions/find-conversation.d.ts.map +0 -1
  20. package/src/lib/actions/find-conversation.js +0 -42
  21. package/src/lib/actions/find-conversation.js.map +0 -1
  22. package/src/lib/actions/send-message.d.ts +0 -5
  23. package/src/lib/actions/send-message.d.ts.map +0 -1
  24. package/src/lib/actions/send-message.js +0 -32
  25. package/src/lib/actions/send-message.js.map +0 -1
  26. package/src/lib/actions/upload-file.d.ts +0 -5
  27. package/src/lib/actions/upload-file.d.ts.map +0 -1
  28. package/src/lib/actions/upload-file.js +0 -44
  29. package/src/lib/actions/upload-file.js.map +0 -1
  30. package/src/lib/common/client.d.ts +0 -69
  31. package/src/lib/common/client.d.ts.map +0 -1
  32. package/src/lib/common/client.js +0 -166
  33. package/src/lib/common/client.js.map +0 -1
  34. package/src/lib/common/props.d.ts +0 -4
  35. package/src/lib/common/props.d.ts.map +0 -1
  36. package/src/lib/common/props.js +0 -127
  37. package/src/lib/common/props.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-document-from-text.js","sourceRoot":"","sources":["../../../../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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kTAAkT,EAAE,UAAU,EAAE,KAAK,EAAE;IAClW,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"}
@@ -1,4 +0,0 @@
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
- }>;
4
- //# sourceMappingURL=find-bot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-bot.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-bot.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa;;EA2BxB,CAAC"}
@@ -1,36 +0,0 @@
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
- audience: 'both',
14
- aiMetadata: { description: 'Searches Cody bots by name (case-insensitive partial match) and returns the matches. Use to resolve a bot name to its ID before creating a conversation. This is a read-only lookup and is idempotent.', idempotent: true },
15
- props: {
16
- name: pieces_framework_1.Property.ShortText({
17
- displayName: 'Bot Name',
18
- description: 'The name of the bot to search for. The search is case-insensitive and partial.',
19
- required: true,
20
- })
21
- },
22
- run(context) {
23
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- const { name } = context.propsValue;
25
- const apiKey = context.auth;
26
- const bots = yield client_1.codyClient.listBots(apiKey, name);
27
- // The API returns an array of matching bots.
28
- // We will return the full array to the user.
29
- return {
30
- found: bots.length > 0,
31
- bots: bots,
32
- };
33
- });
34
- },
35
- });
36
- //# sourceMappingURL=find-bot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-bot.js","sourceRoot":"","sources":["../../../../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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,wMAAwM,EAAE,UAAU,EAAE,IAAI,EAAE;IACvP,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"}
@@ -1,18 +0,0 @@
1
- export declare const findConversationAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
- bot_id: {
3
- required: false;
4
- displayName: string;
5
- description?: string | undefined;
6
- auth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
7
- refreshers: string[];
8
- refreshOnSearch?: boolean;
9
- options: (propsValue: Record<string, unknown> & {
10
- auth?: import("@activepieces/shared").SecretTextConnectionValue | undefined;
11
- }, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").DropdownState<string>>;
12
- valueSchema: string;
13
- type: import("@activepieces/pieces-framework").PropertyType.DROPDOWN;
14
- defaultValue?: unknown;
15
- };
16
- name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
17
- }>;
18
- //# sourceMappingURL=find-conversation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-conversation.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-conversation.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;EAqCjC,CAAC"}
@@ -1,42 +0,0 @@
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
- audience: 'both',
15
- aiMetadata: { description: 'Searches Cody conversations, filtering by owning bot ID and/or by name (partial match) and returns the matches. Use to resolve an existing conversation to its ID. At least one of bot or name must be provided. This is a read-only lookup and is idempotent.', idempotent: true },
16
- props: {
17
- bot_id: Object.assign(Object.assign({}, props_1.botIdDropdown), { required: false }),
18
- name: pieces_framework_1.Property.ShortText({
19
- displayName: 'Conversation Name',
20
- description: 'The name of the conversation to search for (partial match).',
21
- required: false,
22
- })
23
- },
24
- run(context) {
25
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
- const { bot_id, name } = context.propsValue;
27
- const apiKey = context.auth;
28
- if (!bot_id && !name) {
29
- throw new Error("To find a conversation, please provide a Bot or a Conversation Name to search.");
30
- }
31
- const conversations = yield client_1.codyClient.listConversations(apiKey, {
32
- botId: bot_id,
33
- keyword: name,
34
- });
35
- return {
36
- found: conversations.length > 0,
37
- conversations: conversations,
38
- };
39
- });
40
- },
41
- });
42
- //# sourceMappingURL=find-conversation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-conversation.js","sourceRoot":"","sources":["../../../../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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,gQAAgQ,EAAE,UAAU,EAAE,IAAI,EAAE;IAC/S,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"}
@@ -1,5 +0,0 @@
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, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
- content: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
- }>;
5
- //# sourceMappingURL=send-message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/send-message.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;EAqB5B,CAAC"}
@@ -1,32 +0,0 @@
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
- audience: 'both',
15
- aiMetadata: { description: 'Posts a message to an existing Cody conversation and returns the bot AI-generated reply. Use to query a bot within an already-created conversation thread. Requires the conversation ID and message text (max 2000 characters); each call appends a new message, so it is not idempotent.', idempotent: false },
16
- props: {
17
- conversation_id: props_1.conversationIdDropdown,
18
- content: pieces_framework_1.Property.LongText({
19
- displayName: 'Message',
20
- description: 'The message to send to the conversation. (Max 2000 characters)',
21
- required: true,
22
- }),
23
- },
24
- run(context) {
25
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
- const { conversation_id, content } = context.propsValue;
27
- const apiKey = context.auth;
28
- return yield client_1.codyClient.sendMessage(apiKey, conversation_id, content);
29
- });
30
- },
31
- });
32
- //# sourceMappingURL=send-message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../../../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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,2RAA2R,EAAE,UAAU,EAAE,KAAK,EAAE;IAC3U,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,IAAI,CAAC;YAE5B,OAAO,MAAM,mBAAU,CAAC,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QAC1E,CAAC;KAAA;CACJ,CAAC,CAAC"}
@@ -1,5 +0,0 @@
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, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
- file: import("@activepieces/pieces-framework").FileProperty<true>;
4
- }>;
5
- //# sourceMappingURL=upload-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;EAwC3B,CAAC"}
@@ -1,44 +0,0 @@
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
- audience: 'both',
16
- aiMetadata: { description: 'Uploads a binary file (e.g. txt, md, rtf, pdf, ppt, docx) into a Cody knowledge base folder via a signed URL, then registers it as a document. Use when ingesting an existing file rather than inline text. Requires a target folder ID and the file; creates a new document each call, so it is not idempotent.', idempotent: false },
17
- props: {
18
- folder_id: props_1.folderIdDropdown,
19
- file: pieces_framework_1.Property.File({
20
- displayName: 'File',
21
- description: 'The file to upload (e.g., txt, md, rtf, pdf, ppt, docx).',
22
- required: true,
23
- })
24
- },
25
- run(context) {
26
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
- const { folder_id, file } = context.propsValue;
28
- const apiKey = context.auth;
29
- // Step 1: Determine Content-Type from filename using the mime-types library
30
- const contentType = mime_types_1.default.lookup(file.filename) || 'application/octet-stream';
31
- // Step 2: Get a Signed URL from the Cody API
32
- const { url: signedUrl, key } = yield client_1.codyClient.getSignedUrl(apiKey, file.filename, contentType);
33
- // Step 3: Upload the actual file data to the signed URL
34
- yield client_1.codyClient.uploadFileToS3(signedUrl, file.data, contentType);
35
- // Step 4: Finalize the document creation in Cody
36
- yield client_1.codyClient.createDocumentFromFile(apiKey, folder_id, key);
37
- return {
38
- success: true,
39
- message: `File '${file.filename}' uploaded successfully and is being processed.`
40
- };
41
- });
42
- },
43
- });
44
- //# sourceMappingURL=upload-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kTAAkT,EAAE,UAAU,EAAE,KAAK,EAAE;IAClW,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"}
@@ -1,69 +0,0 @@
1
- import { AppConnectionValueForAuthProperty } from "@activepieces/pieces-framework";
2
- import { codyAuth } from "../..";
3
- export declare const CODY_BASE_URL = "https://getcody.ai/api/v1";
4
- export interface CodyFolder {
5
- id: string;
6
- name: string;
7
- }
8
- export interface CodyListFoldersResponse {
9
- data: CodyFolder[];
10
- }
11
- export interface CodyCreateDocumentResponse {
12
- data: {
13
- id: string;
14
- name: string;
15
- status: string;
16
- content_url: string;
17
- folder_id: string;
18
- created_at: number;
19
- };
20
- }
21
- export interface CodySignedUrlResponse {
22
- data: {
23
- url: string;
24
- key: string;
25
- };
26
- }
27
- export interface CodyConversation {
28
- id: string;
29
- name: string;
30
- }
31
- export interface CodyListConversationsResponse {
32
- data: CodyConversation[];
33
- }
34
- export interface CodyMessageResponse {
35
- data: {
36
- id: string;
37
- content: string;
38
- conversation_id: string;
39
- machine: boolean;
40
- failed_responding: boolean;
41
- flagged: boolean;
42
- created_at: number;
43
- };
44
- }
45
- export interface CodyBot {
46
- id: string;
47
- name: string;
48
- }
49
- export interface CodyListBotsResponse {
50
- data: CodyBot[];
51
- }
52
- export interface CodyCreateConversationResponse {
53
- data: CodyConversation;
54
- }
55
- export declare const codyClient: {
56
- listFolders({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>): Promise<CodyFolder[]>;
57
- createDocument({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, name: string, folderId: string, content: string): Promise<CodyCreateDocumentResponse>;
58
- getSignedUrl({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, fileName: string, contentType: string): Promise<CodySignedUrlResponse["data"]>;
59
- uploadFileToS3(signedUrl: string, fileBuffer: Buffer, contentType: string): Promise<void>;
60
- createDocumentFromFile({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, folderId: string, key: string): Promise<void>;
61
- listConversations({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, params?: {
62
- botId?: string;
63
- keyword?: string;
64
- }): Promise<CodyConversation[]>;
65
- sendMessage({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, conversationId: string, content: string): Promise<CodyMessageResponse>;
66
- listBots({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, keyword?: string): Promise<CodyBot[]>;
67
- createConversation({ secret_text }: AppConnectionValueForAuthProperty<typeof codyAuth>, botId: string, name: string, documentIds?: string[]): Promise<CodyCreateConversationResponse>;
68
- };
69
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,eAAO,MAAM,aAAa,8BAA8B,CAAC;AAEzD,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAA;CACJ;AAGD,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACf,CAAA;CACJ;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC1C,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE;QACF,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC;QACjB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,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AC"}
@@ -1,166 +0,0 @@
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(_a) {
9
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }) {
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: secret_text,
16
- },
17
- });
18
- return response.body.data;
19
- });
20
- },
21
- createDocument(_a, name_1, folderId_1, content_1) {
22
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, name, folderId, content) {
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: secret_text,
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(_a, fileName_1, contentType_1) {
42
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, fileName, contentType) {
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: secret_text,
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(_a, folderId_1, key_1) {
73
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, folderId, key) {
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: secret_text,
81
- },
82
- body: {
83
- folder_id: folderId,
84
- key: key,
85
- },
86
- });
87
- });
88
- },
89
- listConversations(_a, params_1) {
90
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, params) {
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: secret_text,
105
- },
106
- });
107
- return response.body.data;
108
- });
109
- },
110
- // New function to send a message
111
- sendMessage(_a, conversationId_1, content_1) {
112
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, conversationId, content) {
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: secret_text,
119
- },
120
- body: {
121
- conversation_id: conversationId,
122
- content: content,
123
- }
124
- });
125
- return response.body;
126
- });
127
- },
128
- listBots(_a, keyword_1) {
129
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, keyword) {
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: secret_text,
141
- },
142
- });
143
- return response.body.data;
144
- });
145
- },
146
- // New function to create a conversation
147
- createConversation(_a, botId_1, name_1, documentIds_1) {
148
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ secret_text }, botId, name, documentIds) {
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: secret_text,
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,+DAAsG;AAIzF,QAAA,aAAa,GAAG,2BAA2B,CAAC;AAgE5C,QAAA,UAAU,GAAG;IAChB,WAAW;qEAAC,EAAC,WAAW,EAAqD;YAC/E,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAA0B;gBACnE,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,qBAAa,UAAU;gBAC/B,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,WAA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AE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,WAAW;iBACrB;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"}
@@ -1,4 +0,0 @@
1
- export declare const folderIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
2
- export declare const conversationIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
- export declare const botIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- //# sourceMappingURL=props.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,4IAsC3B,CAAC;AAEH,eAAO,MAAM,sBAAsB,4IAqCjC,CAAC;AAGH,eAAO,MAAM,aAAa,4IAqCxB,CAAC"}
@@ -1,127 +0,0 @@
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
- const __1 = require("../..");
8
- exports.folderIdDropdown = pieces_framework_1.Property.Dropdown({
9
- auth: __1.codyAuth,
10
- displayName: 'Folder',
11
- required: true,
12
- refreshers: [],
13
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
14
- if (!auth) {
15
- return {
16
- disabled: true,
17
- placeholder: 'Connect your Cody AI account first.',
18
- options: [],
19
- };
20
- }
21
- try {
22
- // Note: Comment removed as the endpoint is now confirmed.
23
- const folders = yield client_1.codyClient.listFolders(auth);
24
- if (folders.length === 0) {
25
- return {
26
- disabled: true,
27
- options: [],
28
- placeholder: "No folders found. Please create a folder in Cody first.",
29
- };
30
- }
31
- return {
32
- disabled: false,
33
- options: folders.map((folder) => ({
34
- label: folder.name,
35
- value: folder.id,
36
- })),
37
- };
38
- }
39
- catch (error) {
40
- return {
41
- disabled: true,
42
- options: [],
43
- placeholder: "Error listing folders. Check connection or API key permissions.",
44
- };
45
- }
46
- }),
47
- });
48
- exports.conversationIdDropdown = pieces_framework_1.Property.Dropdown({
49
- displayName: 'Conversation',
50
- auth: __1.codyAuth,
51
- required: true,
52
- refreshers: [],
53
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
54
- if (!auth) {
55
- return {
56
- disabled: true,
57
- placeholder: 'Connect your Cody AI account first.',
58
- options: [],
59
- };
60
- }
61
- try {
62
- const conversations = yield client_1.codyClient.listConversations(auth);
63
- if (conversations.length === 0) {
64
- return {
65
- disabled: true,
66
- options: [],
67
- placeholder: "No conversations found. Please create one in Cody first.",
68
- };
69
- }
70
- return {
71
- disabled: false,
72
- options: conversations.map((convo) => ({
73
- label: convo.name,
74
- value: convo.id,
75
- })),
76
- };
77
- }
78
- catch (error) {
79
- return {
80
- disabled: true,
81
- options: [],
82
- placeholder: "Error listing conversations.",
83
- };
84
- }
85
- }),
86
- });
87
- // Add the new dropdown for bots
88
- exports.botIdDropdown = pieces_framework_1.Property.Dropdown({
89
- auth: __1.codyAuth,
90
- displayName: 'Bot',
91
- required: true,
92
- refreshers: [],
93
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
94
- if (!auth) {
95
- return {
96
- disabled: true,
97
- placeholder: 'Connect your Cody AI account first.',
98
- options: [],
99
- };
100
- }
101
- try {
102
- const bots = yield client_1.codyClient.listBots(auth);
103
- if (bots.length === 0) {
104
- return {
105
- disabled: true,
106
- options: [],
107
- placeholder: "No bots found. Please create one in Cody first.",
108
- };
109
- }
110
- return {
111
- disabled: false,
112
- options: bots.map((bot) => ({
113
- label: bot.name,
114
- value: bot.id,
115
- })),
116
- };
117
- }
118
- catch (error) {
119
- return {
120
- disabled: true,
121
- options: [],
122
- placeholder: "Error listing bots.",
123
- };
124
- }
125
- }),
126
- });
127
- //# sourceMappingURL=props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAAsC;AACtC,6BAAiC;AAEpB,QAAA,gBAAgB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC9C,IAAI,EAAE,YAAQ;IACd,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,IAAI,CAAC,CAAC;YACnD,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;QAC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