@credal/actions 0.1.7 → 0.1.9

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.
@@ -18,6 +18,8 @@ const createJiraTicket_1 = __importDefault(require("./providers/jira/createJiraT
18
18
  const getLatitudeLongitudeFromLocation_1 = __importDefault(require("./providers/openstreetmap/getLatitudeLongitudeFromLocation"));
19
19
  const getForecastForLocation_1 = __importDefault(require("./providers/nws/getForecastForLocation"));
20
20
  const nearbysearch_1 = __importDefault(require("./providers/googlemaps/nearbysearch"));
21
+ const scrapeUrl_1 = __importDefault(require("./providers/firecrawl/scrapeUrl"));
22
+ const sendEmail_1 = __importDefault(require("./providers/resend/sendEmail"));
21
23
  exports.ActionMapper = {
22
24
  math: {
23
25
  add: {
@@ -106,4 +108,18 @@ exports.ActionMapper = {
106
108
  outputSchema: types_1.nwsGetForecastForLocationOutputSchema,
107
109
  },
108
110
  },
111
+ firecrawl: {
112
+ scrapeUrl: {
113
+ fn: scrapeUrl_1.default,
114
+ paramsSchema: types_1.firecrawlScrapeUrlParamsSchema,
115
+ outputSchema: types_1.firecrawlScrapeUrlOutputSchema,
116
+ },
117
+ },
118
+ resend: {
119
+ sendEmail: {
120
+ fn: sendEmail_1.default,
121
+ paramsSchema: types_1.resendSendEmailParamsSchema,
122
+ outputSchema: types_1.resendSendEmailOutputSchema,
123
+ },
124
+ },
109
125
  };
@@ -12,3 +12,5 @@ export declare const mongoInsertMongoDocDefinition: ActionTemplate;
12
12
  export declare const snowflakeGetRowByFieldValueDefinition: ActionTemplate;
13
13
  export declare const openstreetmapGetLatitudeLongitudeFromLocationDefinition: ActionTemplate;
14
14
  export declare const nwsGetForecastForLocationDefinition: ActionTemplate;
15
+ export declare const firecrawlScrapeUrlDefinition: ActionTemplate;
16
+ export declare const resendSendEmailDefinition: ActionTemplate;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
3
+ exports.resendSendEmailDefinition = exports.firecrawlScrapeUrlDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
4
4
  exports.slackSendMessageDefinition = {
5
5
  description: "Sends a message to a Slack channel",
6
6
  scopes: ["chat:write"],
@@ -660,3 +660,67 @@ exports.nwsGetForecastForLocationDefinition = {
660
660
  name: "getForecastForLocation",
661
661
  provider: "nws",
662
662
  };
663
+ exports.firecrawlScrapeUrlDefinition = {
664
+ description: "Scrape a URL and get website content using Firecrawl",
665
+ scopes: [],
666
+ parameters: {
667
+ type: "object",
668
+ required: ["url"],
669
+ properties: {
670
+ url: {
671
+ type: "string",
672
+ description: "The URL to scrape",
673
+ },
674
+ },
675
+ },
676
+ output: {
677
+ type: "object",
678
+ required: ["content"],
679
+ properties: {
680
+ content: {
681
+ type: "string",
682
+ description: "The content of the URL",
683
+ },
684
+ },
685
+ },
686
+ name: "scrapeUrl",
687
+ provider: "firecrawl",
688
+ };
689
+ exports.resendSendEmailDefinition = {
690
+ description: "Send an email using Resend",
691
+ scopes: [],
692
+ parameters: {
693
+ type: "object",
694
+ required: ["to", "subject", "content"],
695
+ properties: {
696
+ to: {
697
+ type: "string",
698
+ description: "The email address to send the email to",
699
+ },
700
+ subject: {
701
+ type: "string",
702
+ description: "The subject of the email",
703
+ },
704
+ content: {
705
+ type: "string",
706
+ description: "The content of the email",
707
+ },
708
+ },
709
+ },
710
+ output: {
711
+ type: "object",
712
+ required: ["success"],
713
+ properties: {
714
+ success: {
715
+ type: "boolean",
716
+ description: "Whether the email was sent successfully",
717
+ },
718
+ error: {
719
+ type: "string",
720
+ description: "The error that occurred if the email was not sent successfully",
721
+ },
722
+ },
723
+ },
724
+ name: "sendEmail",
725
+ provider: "resend",
726
+ };
@@ -8,16 +8,22 @@ export declare const AuthParamsSchema: z.ZodObject<{
8
8
  baseUrl: z.ZodOptional<z.ZodString>;
9
9
  apiKey: z.ZodOptional<z.ZodString>;
10
10
  userAgent: z.ZodOptional<z.ZodString>;
11
+ emailFrom: z.ZodOptional<z.ZodString>;
12
+ emailReplyTo: z.ZodOptional<z.ZodString>;
11
13
  }, "strip", z.ZodTypeAny, {
12
14
  authToken?: string | undefined;
13
15
  baseUrl?: string | undefined;
14
16
  apiKey?: string | undefined;
15
17
  userAgent?: string | undefined;
18
+ emailFrom?: string | undefined;
19
+ emailReplyTo?: string | undefined;
16
20
  }, {
17
21
  authToken?: string | undefined;
18
22
  baseUrl?: string | undefined;
19
23
  apiKey?: string | undefined;
20
24
  userAgent?: string | undefined;
25
+ emailFrom?: string | undefined;
26
+ emailReplyTo?: string | undefined;
21
27
  }>;
22
28
  export type AuthParamsType = z.infer<typeof AuthParamsSchema>;
23
29
  export declare const slackSendMessageParamsSchema: z.ZodObject<{
@@ -636,3 +642,46 @@ export declare const nwsGetForecastForLocationOutputSchema: z.ZodObject<{
636
642
  }>;
637
643
  export type nwsGetForecastForLocationOutputType = z.infer<typeof nwsGetForecastForLocationOutputSchema>;
638
644
  export type nwsGetForecastForLocationFunction = ActionFunction<nwsGetForecastForLocationParamsType, AuthParamsType, nwsGetForecastForLocationOutputType>;
645
+ export declare const firecrawlScrapeUrlParamsSchema: z.ZodObject<{
646
+ url: z.ZodString;
647
+ }, "strip", z.ZodTypeAny, {
648
+ url: string;
649
+ }, {
650
+ url: string;
651
+ }>;
652
+ export type firecrawlScrapeUrlParamsType = z.infer<typeof firecrawlScrapeUrlParamsSchema>;
653
+ export declare const firecrawlScrapeUrlOutputSchema: z.ZodObject<{
654
+ content: z.ZodString;
655
+ }, "strip", z.ZodTypeAny, {
656
+ content: string;
657
+ }, {
658
+ content: string;
659
+ }>;
660
+ export type firecrawlScrapeUrlOutputType = z.infer<typeof firecrawlScrapeUrlOutputSchema>;
661
+ export type firecrawlScrapeUrlFunction = ActionFunction<firecrawlScrapeUrlParamsType, AuthParamsType, firecrawlScrapeUrlOutputType>;
662
+ export declare const resendSendEmailParamsSchema: z.ZodObject<{
663
+ to: z.ZodString;
664
+ subject: z.ZodString;
665
+ content: z.ZodString;
666
+ }, "strip", z.ZodTypeAny, {
667
+ content: string;
668
+ subject: string;
669
+ to: string;
670
+ }, {
671
+ content: string;
672
+ subject: string;
673
+ to: string;
674
+ }>;
675
+ export type resendSendEmailParamsType = z.infer<typeof resendSendEmailParamsSchema>;
676
+ export declare const resendSendEmailOutputSchema: z.ZodObject<{
677
+ success: z.ZodBoolean;
678
+ error: z.ZodOptional<z.ZodString>;
679
+ }, "strip", z.ZodTypeAny, {
680
+ success: boolean;
681
+ error?: string | undefined;
682
+ }, {
683
+ success: boolean;
684
+ error?: string | undefined;
685
+ }>;
686
+ export type resendSendEmailOutputType = z.infer<typeof resendSendEmailOutputSchema>;
687
+ export type resendSendEmailFunction = ActionFunction<resendSendEmailParamsType, AuthParamsType, resendSendEmailOutputType>;
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchOutputSchema = exports.googlemapsNearbysearchParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceUpdatePageOutputSchema = exports.confluenceUpdatePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
3
+ exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchOutputSchema = exports.googlemapsNearbysearchParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceUpdatePageOutputSchema = exports.confluenceUpdatePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.AuthParamsSchema = zod_1.z.object({
6
6
  authToken: zod_1.z.string().optional(),
7
7
  baseUrl: zod_1.z.string().optional(),
8
8
  apiKey: zod_1.z.string().optional(),
9
9
  userAgent: zod_1.z.string().optional(),
10
+ emailFrom: zod_1.z.string().optional(),
11
+ emailReplyTo: zod_1.z.string().optional(),
10
12
  });
11
13
  exports.slackSendMessageParamsSchema = zod_1.z.object({
12
14
  channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
@@ -199,3 +201,14 @@ exports.nwsGetForecastForLocationOutputSchema = zod_1.z.object({
199
201
  })
200
202
  .optional(),
201
203
  });
204
+ exports.firecrawlScrapeUrlParamsSchema = zod_1.z.object({ url: zod_1.z.string().describe("The URL to scrape") });
205
+ exports.firecrawlScrapeUrlOutputSchema = zod_1.z.object({ content: zod_1.z.string().describe("The content of the URL") });
206
+ exports.resendSendEmailParamsSchema = zod_1.z.object({
207
+ to: zod_1.z.string().describe("The email address to send the email to"),
208
+ subject: zod_1.z.string().describe("The subject of the email"),
209
+ content: zod_1.z.string().describe("The content of the email"),
210
+ });
211
+ exports.resendSendEmailOutputSchema = zod_1.z.object({
212
+ success: zod_1.z.boolean().describe("Whether the email was sent successfully"),
213
+ error: zod_1.z.string().describe("The error that occurred if the email was not sent successfully").optional(),
214
+ });
@@ -47,4 +47,12 @@ exports.ACTION_GROUPS = {
47
47
  description: "Action for getting the weather forecast for a location",
48
48
  actions: [templates_1.nwsGetForecastForLocationDefinition],
49
49
  },
50
+ FIRECRAWL: {
51
+ description: "Actions for interacting with Firecrawl",
52
+ actions: [templates_1.firecrawlScrapeUrlDefinition],
53
+ },
54
+ RESEND: {
55
+ description: "Action for sending an email",
56
+ actions: [templates_1.resendSendEmailDefinition],
57
+ },
50
58
  };
@@ -44,6 +44,8 @@ z.object({
44
44
  baseUrl: z.string().optional(),
45
45
  apiKey: z.string().optional(),
46
46
  userAgent: z.string().optional(),
47
+ emailFrom: z.string().optional(),
48
+ emailReplyTo: z.string().optional(),
47
49
  })
48
50
  `;
49
51
  function validateObject(object) {
@@ -0,0 +1,3 @@
1
+ import { firecrawlScrapeUrlFunction } from "../../autogen/types";
2
+ declare const scrapeUrl: firecrawlScrapeUrlFunction;
3
+ export default scrapeUrl;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const firecrawl_js_1 = __importDefault(require("@mendable/firecrawl-js"));
16
+ const types_1 = require("../../autogen/types");
17
+ const scrapeUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
+ const firecrawl = new firecrawl_js_1.default({
19
+ apiKey: authParams.apiKey,
20
+ });
21
+ const result = yield firecrawl.scrapeUrl(params.url);
22
+ return types_1.firecrawlScrapeUrlOutputSchema.parse({
23
+ content: result.success ? result.markdown : "",
24
+ });
25
+ });
26
+ exports.default = scrapeUrl;
@@ -0,0 +1,3 @@
1
+ import { resendSendEmailFunction } from "../../autogen/types";
2
+ declare const sendEmail: resendSendEmailFunction;
3
+ export default sendEmail;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const resend_1 = require("resend");
13
+ const types_1 = require("../../autogen/types");
14
+ const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
+ try {
16
+ const resend = new resend_1.Resend(authParams.apiKey);
17
+ const result = yield resend.emails.send({
18
+ from: authParams.emailFrom,
19
+ replyTo: authParams.emailReplyTo,
20
+ to: params.to,
21
+ subject: params.subject,
22
+ text: params.content,
23
+ });
24
+ if (result.error) {
25
+ throw new Error(result.error.message);
26
+ }
27
+ return types_1.resendSendEmailOutputSchema.parse({
28
+ success: true,
29
+ });
30
+ }
31
+ catch (error) {
32
+ return types_1.resendSendEmailOutputSchema.parse({
33
+ success: false,
34
+ error: error instanceof Error ? error.message : "Unknown error",
35
+ });
36
+ }
37
+ });
38
+ exports.default = sendEmail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,12 +39,14 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@credal/sdk": "^0.0.21",
42
+ "@mendable/firecrawl-js": "^1.19.0",
42
43
  "@slack/web-api": "^7.8.0",
43
44
  "@types/snowflake-sdk": "^1.6.24",
44
45
  "ajv": "^8.17.1",
45
46
  "date-fns": "^4.1.0",
46
47
  "json-schema-to-zod": "^2.5.0",
47
48
  "mongodb": "^6.13.1",
49
+ "resend": "^4.1.2",
48
50
  "snowflake-sdk": "^2.0.2",
49
51
  "ts-node": "^10.9.2",
50
52
  "zod": "^3.24.1"