@credal/actions 0.2.187 → 0.2.189

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.
@@ -1074,6 +1074,13 @@ export const slackUserSearchSlackRTSDefinition = {
1074
1074
  type: "string",
1075
1075
  description: 'The search query string (e.g., "What is project gizmo?", "mobile UX revamp"). You can use any Slack filters directly in the query string.',
1076
1076
  },
1077
+ userEmails: {
1078
+ type: "array",
1079
+ description: 'Optional. Users to filter messages from. Each value should be a plain-text email (e.g. "user@company.com"). Will be resolved to a Slack user ID and formatted into the query as from:<@U...>.',
1080
+ items: {
1081
+ type: "string",
1082
+ },
1083
+ },
1077
1084
  channelTypes: {
1078
1085
  type: "array",
1079
1086
  description: "Filter by channel types to search. If not specified, searches all channel types the user has access to.",
@@ -4480,8 +4487,11 @@ export const resendSendEmailDefinition = {
4480
4487
  required: ["to", "subject", "content"],
4481
4488
  properties: {
4482
4489
  to: {
4483
- type: "string",
4484
- description: "The email address to send the email to",
4490
+ type: "array",
4491
+ items: {
4492
+ type: "string",
4493
+ },
4494
+ description: "The email address(es) to send the email to",
4485
4495
  },
4486
4496
  subject: {
4487
4497
  type: "string",
@@ -4520,8 +4530,11 @@ export const resendSendEmailHtmlDefinition = {
4520
4530
  required: ["to", "subject", "content"],
4521
4531
  properties: {
4522
4532
  to: {
4523
- type: "string",
4524
- description: "The email address to send the email to",
4533
+ type: "array",
4534
+ items: {
4535
+ type: "string",
4536
+ },
4537
+ description: "The email address(es) to send the email to",
4525
4538
  },
4526
4539
  subject: {
4527
4540
  type: "string",
@@ -6797,7 +6810,7 @@ export const googleOauthUpdateSpreadsheetDefinition = {
6797
6810
  provider: "googleOauth",
6798
6811
  };
6799
6812
  export const googleOauthAppendRowsToSpreadsheetDefinition = {
6800
- displayName: "Append rows to a spreadsheet",
6813
+ displayName: "Add rows to a spreadsheet",
6801
6814
  description: "Adds new cells after the last row with data in a sheet, inserting new rows into the sheet if necessary.",
6802
6815
  scopes: [],
6803
6816
  tags: [],
@@ -10016,7 +10029,7 @@ export const salesforceGenerateSalesReportDefinition = {
10016
10029
  };
10017
10030
  export const salesforceSearchAllSalesforceRecordsDefinition = {
10018
10031
  displayName: "Search all salesforce records",
10019
- description: "Search for all Salesforce records by keyword",
10032
+ description: "Search through all Salesforce records by keyword. This works best for searching the content of text fields across all records. For example, searching for any description fields that contain a specific keyword.",
10020
10033
  scopes: [],
10021
10034
  tags: [],
10022
10035
  parameters: {
@@ -10177,7 +10190,7 @@ export const salesforceExecuteReportDefinition = {
10177
10190
  };
10178
10191
  export const salesforceSearchSalesforceRecordsDefinition = {
10179
10192
  displayName: "Search Salesforce records",
10180
- description: "Search for Salesforce records by keyword",
10193
+ description: "Search for Salesforce records by keyword. This works best for searching the content of text fields on a specific object. For example, searching for Case descriptions that mention a specific keyword.",
10181
10194
  scopes: [],
10182
10195
  tags: [],
10183
10196
  parameters: {
@@ -10191,6 +10204,7 @@ export const salesforceSearchSalesforceRecordsDefinition = {
10191
10204
  recordType: {
10192
10205
  type: "string",
10193
10206
  description: "The type of record to search for",
10207
+ tags: ["recommend-predefined"],
10194
10208
  },
10195
10209
  fieldsToSearch: {
10196
10210
  type: "array",
@@ -10273,7 +10287,7 @@ export const salesforceSearchSalesforceRecordsDefinition = {
10273
10287
  };
10274
10288
  export const salesforceGetSalesforceRecordsByQueryDefinition = {
10275
10289
  displayName: "Get Salesforce records with a query",
10276
- description: "Retrieve Salesforce records by SOQL query",
10290
+ description: 'Retrieve Salesforce records by SOQL query. This works best for structured queries that depend on specific fields, for example "Find all Opportunities associated with the Acme Account" or "Find all contacts with the last name \'Smith\'".',
10277
10291
  scopes: [],
10278
10292
  tags: [],
10279
10293
  parameters: {
@@ -1317,6 +1317,7 @@ export type slackUserSearchSlackOutputType = z.infer<typeof slackUserSearchSlack
1317
1317
  export type slackUserSearchSlackFunction = ActionFunction<slackUserSearchSlackParamsType, AuthParamsType, slackUserSearchSlackOutputType>;
1318
1318
  export declare const slackUserSearchSlackRTSParamsSchema: z.ZodObject<{
1319
1319
  query: z.ZodString;
1320
+ userEmails: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1320
1321
  channelTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["public_channel", "private_channel", "mpim", "im"]>, "many">>;
1321
1322
  contentTypes: z.ZodDefault<z.ZodArray<z.ZodEnum<["messages", "files", "channels"]>, "many">>;
1322
1323
  includeBots: z.ZodDefault<z.ZodBoolean>;
@@ -1330,12 +1331,14 @@ export declare const slackUserSearchSlackRTSParamsSchema: z.ZodObject<{
1330
1331
  contentTypes: ("messages" | "files" | "channels")[];
1331
1332
  includeBots: boolean;
1332
1333
  includeContextMessages: boolean;
1334
+ userEmails?: string[] | undefined;
1333
1335
  channelTypes?: ("im" | "public_channel" | "private_channel" | "mpim")[] | undefined;
1334
1336
  before?: string | undefined;
1335
1337
  after?: string | undefined;
1336
1338
  }, {
1337
1339
  query: string;
1338
1340
  limit?: number | undefined;
1341
+ userEmails?: string[] | undefined;
1339
1342
  channelTypes?: ("im" | "public_channel" | "private_channel" | "mpim")[] | undefined;
1340
1343
  contentTypes?: ("messages" | "files" | "channels")[] | undefined;
1341
1344
  includeBots?: boolean | undefined;
@@ -4536,17 +4539,17 @@ export declare const firecrawlScrapeTweetDataWithNitterOutputSchema: z.ZodObject
4536
4539
  export type firecrawlScrapeTweetDataWithNitterOutputType = z.infer<typeof firecrawlScrapeTweetDataWithNitterOutputSchema>;
4537
4540
  export type firecrawlScrapeTweetDataWithNitterFunction = ActionFunction<firecrawlScrapeTweetDataWithNitterParamsType, AuthParamsType, firecrawlScrapeTweetDataWithNitterOutputType>;
4538
4541
  export declare const resendSendEmailParamsSchema: z.ZodObject<{
4539
- to: z.ZodString;
4542
+ to: z.ZodArray<z.ZodString, "many">;
4540
4543
  subject: z.ZodString;
4541
4544
  content: z.ZodString;
4542
4545
  }, "strip", z.ZodTypeAny, {
4543
4546
  content: string;
4544
4547
  subject: string;
4545
- to: string;
4548
+ to: string[];
4546
4549
  }, {
4547
4550
  content: string;
4548
4551
  subject: string;
4549
- to: string;
4552
+ to: string[];
4550
4553
  }>;
4551
4554
  export type resendSendEmailParamsType = z.infer<typeof resendSendEmailParamsSchema>;
4552
4555
  export declare const resendSendEmailOutputSchema: z.ZodObject<{
@@ -4562,17 +4565,17 @@ export declare const resendSendEmailOutputSchema: z.ZodObject<{
4562
4565
  export type resendSendEmailOutputType = z.infer<typeof resendSendEmailOutputSchema>;
4563
4566
  export type resendSendEmailFunction = ActionFunction<resendSendEmailParamsType, AuthParamsType, resendSendEmailOutputType>;
4564
4567
  export declare const resendSendEmailHtmlParamsSchema: z.ZodObject<{
4565
- to: z.ZodString;
4568
+ to: z.ZodArray<z.ZodString, "many">;
4566
4569
  subject: z.ZodString;
4567
4570
  content: z.ZodString;
4568
4571
  }, "strip", z.ZodTypeAny, {
4569
4572
  content: string;
4570
4573
  subject: string;
4571
- to: string;
4574
+ to: string[];
4572
4575
  }, {
4573
4576
  content: string;
4574
4577
  subject: string;
4575
- to: string;
4578
+ to: string[];
4576
4579
  }>;
4577
4580
  export type resendSendEmailHtmlParamsType = z.infer<typeof resendSendEmailHtmlParamsSchema>;
4578
4581
  export declare const resendSendEmailHtmlOutputSchema: z.ZodObject<{
@@ -529,6 +529,10 @@ export const slackUserSearchSlackRTSParamsSchema = z.object({
529
529
  query: z
530
530
  .string()
531
531
  .describe('The search query string (e.g., "What is project gizmo?", "mobile UX revamp"). You can use any Slack filters directly in the query string.'),
532
+ userEmails: z
533
+ .array(z.string())
534
+ .describe('Optional. Users to filter messages from. Each value should be a plain-text email (e.g. "user@company.com"). Will be resolved to a Slack user ID and formatted into the query as from:<@U...>.')
535
+ .optional(),
532
536
  channelTypes: z
533
537
  .array(z.enum(["public_channel", "private_channel", "mpim", "im"]))
534
538
  .describe("Filter by channel types to search. If not specified, searches all channel types the user has access to.")
@@ -1494,7 +1498,7 @@ export const firecrawlScrapeTweetDataWithNitterOutputSchema = z.object({
1494
1498
  text: z.string().describe("The text in the tweet URL"),
1495
1499
  });
1496
1500
  export const resendSendEmailParamsSchema = z.object({
1497
- to: z.string().describe("The email address to send the email to"),
1501
+ to: z.array(z.string()).describe("The email address(es) to send the email to"),
1498
1502
  subject: z.string().describe("The subject of the email"),
1499
1503
  content: z.string().describe("The content of the email"),
1500
1504
  });
@@ -1503,7 +1507,7 @@ export const resendSendEmailOutputSchema = z.object({
1503
1507
  error: z.string().describe("The error that occurred if the email was not sent successfully").optional(),
1504
1508
  });
1505
1509
  export const resendSendEmailHtmlParamsSchema = z.object({
1506
- to: z.string().describe("The email address to send the email to"),
1510
+ to: z.array(z.string()).describe("The email address(es) to send the email to"),
1507
1511
  subject: z.string().describe("The subject of the email"),
1508
1512
  content: z.string().describe("The HTML content of the email to be sent"),
1509
1513
  });
@@ -9,16 +9,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { WebClient } from "@slack/web-api";
11
11
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
+ /* ===================== Types ===================== */
13
+ function resolveSlackUserId(client, raw) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ var _a;
16
+ const s = raw.trim();
17
+ if (!s)
18
+ return null;
19
+ try {
20
+ const res = yield client.users.lookupByEmail({ email: s });
21
+ if ((_a = res.user) === null || _a === void 0 ? void 0 : _a.id)
22
+ return res.user.id;
23
+ }
24
+ catch (_b) {
25
+ // ignore and fall back
26
+ }
27
+ return null;
28
+ });
29
+ }
30
+ function appendToQuery(query, suffix) {
31
+ const q = query.trim();
32
+ const s = suffix.trim();
33
+ if (!q)
34
+ return s;
35
+ if (!s)
36
+ return q;
37
+ return `${q} ${s}`;
38
+ }
12
39
  /* ===================== MAIN EXPORT ===================== */
13
40
  const searchSlackRTS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
41
  var _b, _c;
15
42
  if (!authParams.authToken)
16
43
  throw new Error(MISSING_AUTH_TOKEN);
17
44
  const client = new WebClient(authParams.authToken);
18
- const { query, channelTypes, contentTypes = ["messages", "files", "channels"], includeBots = false, limit = 20, includeContextMessages = true, before, after, } = params;
45
+ const { query, userEmails, channelTypes, contentTypes = ["messages", "files", "channels"], includeBots = false, limit = 20, includeContextMessages = true, before, after, } = params;
46
+ let finalQuery = query;
47
+ if (userEmails != undefined && userEmails.length > 0) {
48
+ const settled = yield Promise.allSettled(userEmails.map((u) => resolveSlackUserId(client, u)));
49
+ const fulfilled = settled.filter((r) => r.status === "fulfilled");
50
+ const ids = fulfilled.map(r => r.value).filter((id) => Boolean(id));
51
+ if (ids.length > 0) {
52
+ // Slack expects IDs in angle brackets, e.g. from:<@U123> from:<@U456>
53
+ const filter = ids.map(id => `from:<@${id}>`).join(" ");
54
+ finalQuery = appendToQuery(finalQuery, filter);
55
+ }
56
+ }
19
57
  // Build the request parameters for assistant.search.context
20
58
  const requestParams = {
21
- query,
59
+ query: finalQuery,
22
60
  };
23
61
  // Add optional parameters if provided
24
62
  if (channelTypes && channelTypes.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.187",
3
+ "version": "0.2.189",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,