@credal/actions 0.2.168 → 0.2.169

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.
@@ -310,6 +310,10 @@ export const slackUserSearchSlackParamsSchema = z.object({
310
310
  .enum(["latest", "today", "yesterday", "last_7d", "last_30d", "all"])
311
311
  .describe("Optional time filter applied to the search.")
312
312
  .default("latest"),
313
+ messageType: z
314
+ .enum(["im", "group", "channel"])
315
+ .describe("Optional filter for the type of messages to search for. If not specified, all message types will be searched.")
316
+ .optional(),
313
317
  limit: z
314
318
  .number()
315
319
  .gte(1)
@@ -1041,15 +1045,6 @@ export const jiraDataCenterGetJiraIssuesByQueryOutputSchema = z.object({
1041
1045
  .optional(),
1042
1046
  error: z.string().describe("The error that occurred if the records were not successfully retrieved").optional(),
1043
1047
  });
1044
- export const kandjiGetFVRecoveryKeyForDeviceParamsSchema = z.object({
1045
- userEmail: z.string().describe("The email of the user requesting the recovery key"),
1046
- subdomain: z.string().describe("The subdomain of the Kandji account"),
1047
- });
1048
- export const kandjiGetFVRecoveryKeyForDeviceOutputSchema = z.object({
1049
- success: z.boolean().describe("Whether the recovery key was retrieved successfully"),
1050
- recoveryKey: z.string().describe("The FileVault recovery key for the device").optional(),
1051
- error: z.string().describe("The error that occurred if the recovery key was not retrieved successfully").optional(),
1052
- });
1053
1048
  export const googlemapsValidateAddressParamsSchema = z.object({
1054
1049
  regionCode: z.string().describe("The country of the address being verified."),
1055
1050
  locality: z.string().describe("The locality of the address being verified. This is likely a city."),
@@ -3792,93 +3787,6 @@ export const lookerEnableUserByEmailOutputSchema = z.object({
3792
3787
  .describe("Details about the user")
3793
3788
  .optional(),
3794
3789
  });
3795
- export const ashbyCreateNoteParamsSchema = z.object({
3796
- candidateId: z.string().describe("The ID of the candidate to create a note for"),
3797
- note: z.string().describe("The note content"),
3798
- });
3799
- export const ashbyCreateNoteOutputSchema = z.void();
3800
- export const ashbyGetCandidateInfoParamsSchema = z.object({
3801
- candidateId: z.string().describe("The ID of the candidate whose information is to be retrieved"),
3802
- });
3803
- export const ashbyGetCandidateInfoOutputSchema = z.object({
3804
- candidate: z.object({}).catchall(z.any()).describe("The candidate's information"),
3805
- });
3806
- export const ashbyAddCandidateToProjectParamsSchema = z.object({
3807
- candidateId: z.string().describe("The ID of the candidate to add to the project"),
3808
- projectId: z.string().describe("The ID of the project to add the candidate to"),
3809
- });
3810
- export const ashbyAddCandidateToProjectOutputSchema = z.void();
3811
- export const ashbyListCandidatesParamsSchema = z.object({});
3812
- export const ashbyListCandidatesOutputSchema = z.object({
3813
- candidates: z.array(z.any()).describe("A list of candidates"),
3814
- });
3815
- export const ashbySearchCandidatesParamsSchema = z.object({
3816
- email: z.string().describe("The email address of the candidate to search for").optional(),
3817
- name: z.string().describe("The name of the candidate to search for").optional(),
3818
- });
3819
- export const ashbySearchCandidatesOutputSchema = z.object({
3820
- candidates: z.array(z.any()).describe("A list of candidates"),
3821
- });
3822
- export const ashbyListCandidateNotesParamsSchema = z.object({
3823
- candidateId: z.string().describe("The ID of the candidate"),
3824
- });
3825
- export const ashbyListCandidateNotesOutputSchema = z.object({ notes: z.array(z.any()).describe("A list of notes") });
3826
- export const ashbyCreateCandidateParamsSchema = z.object({
3827
- name: z.string().describe("The first and last name of the candidate to be created."),
3828
- email: z.string().describe("Primary, personal email of the candidate to be created.").optional(),
3829
- phoneNumber: z.string().describe("Primary, personal phone number of the candidate to be created.").optional(),
3830
- linkedInUrl: z.string().describe("Url to the candidate's LinkedIn profile. Must be a valid Url.").optional(),
3831
- githubUrl: z.string().describe("Url to the candidate's Github profile. Must be a valid Url.").optional(),
3832
- website: z.string().describe("Url of the candidate's website. Must be a valid Url.").optional(),
3833
- alternateEmailAddresses: z
3834
- .array(z.string())
3835
- .describe("Array of alternate email address to add to the candidate's profile.")
3836
- .optional(),
3837
- sourceId: z.string().describe("The source to set on the candidate being created.").optional(),
3838
- creditedToUserId: z.string().describe("The id of the user the candidate will be credited to.").optional(),
3839
- location: z
3840
- .object({
3841
- city: z.string().describe("The city of the candidate.").optional(),
3842
- region: z.string().describe("The region of the candidate.").optional(),
3843
- country: z.string().describe("The country of the candidate.").optional(),
3844
- })
3845
- .describe("The location of the candidate.")
3846
- .optional(),
3847
- });
3848
- export const ashbyCreateCandidateOutputSchema = z.void();
3849
- export const ashbyUpdateCandidateParamsSchema = z.object({
3850
- candidateId: z.string().describe("The ID of the candidate to update"),
3851
- name: z.string().describe("The first and last name of the candidate to update.").optional(),
3852
- email: z.string().describe("Primary, personal email of the candidate to update.").optional(),
3853
- phoneNumber: z.string().describe("Primary, personal phone number of the candidate to update.").optional(),
3854
- linkedInUrl: z.string().describe("Url to the candidate's LinkedIn profile. Must be a valid Url.").optional(),
3855
- githubUrl: z.string().describe("Url to the candidate's Github profile. Must be a valid Url.").optional(),
3856
- websiteUrl: z.string().describe("Url of the candidate's website. Must be a valid Url.").optional(),
3857
- alternateEmail: z.string().describe("An alternate email address to add to the candidate's profile.").optional(),
3858
- socialLinks: z
3859
- .array(z.object({
3860
- type: z.string().describe("The type of social link").optional(),
3861
- url: z.string().describe("The URL of the social link").optional(),
3862
- }))
3863
- .describe("An array of social links to set on the candidate. This value replaces existing socialLinks that have been set on the candidate.")
3864
- .optional(),
3865
- sourceId: z.string().describe("The id of source for this candidate.").optional(),
3866
- creditedToUserId: z.string().describe("The id of the user the candidate will be credited to.").optional(),
3867
- location: z
3868
- .object({
3869
- city: z.string().describe("The city of the candidate").optional(),
3870
- region: z.string().describe("The region of the candidate").optional(),
3871
- country: z.string().describe("The country of the candidate").optional(),
3872
- })
3873
- .describe("The location of the candidate.")
3874
- .optional(),
3875
- createdAt: z.string().describe("An ISO date string to set the candidate's createdAt timestamp.").optional(),
3876
- sendNotifications: z
3877
- .boolean()
3878
- .describe("Whether or not users who are subscribed to the candidate should be notified that candidate was updated. Default is true.")
3879
- .optional(),
3880
- });
3881
- export const ashbyUpdateCandidateOutputSchema = z.void();
3882
3790
  export const salesforceUpdateRecordParamsSchema = z.object({
3883
3791
  objectType: z.string().describe("The Salesforce object type to update (e.g., Lead, Account, Contact)"),
3884
3792
  recordId: z.string().describe("The ID of the record to update"),
@@ -4649,38 +4557,6 @@ export const notionSearchByTitleOutputSchema = z.object({
4649
4557
  .optional(),
4650
4558
  error: z.string().describe("Error message if search failed").optional(),
4651
4559
  });
4652
- export const jamfGetJamfFileVaultRecoveryKeyParamsSchema = z.object({
4653
- computerId: z.string().describe("The computerId of the device to get the FileVault2 recovery key for"),
4654
- });
4655
- export const jamfGetJamfFileVaultRecoveryKeyOutputSchema = z.object({
4656
- success: z.boolean().describe("Whether the request was successful"),
4657
- data: z.string().describe("The FileVault2 recovery key data").optional(),
4658
- error: z.string().describe("Error message if the request failed").optional(),
4659
- });
4660
- export const jamfGetJamfComputerInventoryParamsSchema = z.object({
4661
- section: z.string().describe("Optional section parameter to filter inventory data").optional(),
4662
- });
4663
- export const jamfGetJamfComputerInventoryOutputSchema = z.object({
4664
- success: z.boolean().describe("Whether the request was successful"),
4665
- data: z.array(z.any()).describe("The computer inventory data").optional(),
4666
- error: z.string().describe("Error message if the request failed").optional(),
4667
- });
4668
- export const jamfGetJamfUserComputerIdParamsSchema = z.object({
4669
- userEmail: z.string().describe("The email of the Jamf user to retrieve the computer ID for"),
4670
- });
4671
- export const jamfGetJamfUserComputerIdOutputSchema = z.object({
4672
- success: z.boolean().describe("Whether the request was successful"),
4673
- computerId: z.string().describe("The computer ID associated with the user").optional(),
4674
- error: z.string().describe("Error message if the request failed").optional(),
4675
- });
4676
- export const jamfLockJamfComputerByIdParamsSchema = z.object({
4677
- computerId: z.string().describe("The computer ID of the device to lock"),
4678
- passcode: z.string().describe("Six digit passcode to unlock the computer afterwards"),
4679
- });
4680
- export const jamfLockJamfComputerByIdOutputSchema = z.object({
4681
- success: z.boolean().describe("Whether the lock command was successful"),
4682
- error: z.string().describe("Error message if the lock command failed").optional(),
4683
- });
4684
4560
  export const gitlabSearchGroupParamsSchema = z.object({
4685
4561
  query: z.string().describe("The query that will be used to search gitlab blobs and merge requests"),
4686
4562
  groupId: z.string().describe("The group ID of the project to search in"),
@@ -70,6 +70,12 @@ function normalizeChannelOperand(ch) {
70
70
  return s;
71
71
  return s.replace(/^#/, "");
72
72
  }
73
+ function getMessageTypeFilter(messageType) {
74
+ // This converts the LLM readable message type to the Slack search API message type (e.g. "channel" -> "message")
75
+ if (messageType === "channel")
76
+ return "message";
77
+ return messageType;
78
+ }
73
79
  function fmtDaysAgo(n) {
74
80
  const d = new Date();
75
81
  d.setDate(d.getDate() - n);
@@ -277,7 +283,8 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
277
283
  throw new Error(MISSING_AUTH_TOKEN);
278
284
  const client = new WebClient(authParams.authToken);
279
285
  const cache = new SlackUserCache(client);
280
- const { emails, topic, timeRange, limit = 20, channel, fetchAdjacentMessages = true } = params;
286
+ const { emails, topic, timeRange, limit = 20, channel, fetchAdjacentMessages = true, messageType } = params;
287
+ const messageTypeFilter = getMessageTypeFilter(messageType);
281
288
  const { user_id: myUserId } = yield client.auth.test();
282
289
  if (!myUserId)
283
290
  throw new Error("Failed to get my user ID.");
@@ -294,9 +301,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
294
301
  else if (filteredTargetIds.length >= 2) {
295
302
  const searchMPIM = () => __awaiter(void 0, void 0, void 0, function* () {
296
303
  const mpimName = yield tryGetMPIMName(client, filteredTargetIds);
297
- return mpimName
298
- ? searchScoped({ client, scope: mpimName, topic, timeRange, limit: Math.max(Math.floor(limit / 2), 1) })
299
- : [];
304
+ return mpimName ? searchScoped({ client, scope: mpimName, topic, timeRange, limit }) : [];
300
305
  });
301
306
  searchPromises.push(searchMPIM());
302
307
  searchPromises.push(...filteredTargetIds.map(id => searchScoped({
@@ -304,7 +309,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
304
309
  scope: `<@${id}>`,
305
310
  topic,
306
311
  timeRange,
307
- limit: Math.max(Math.floor(limit / filteredTargetIds.length), 1),
312
+ limit,
308
313
  })));
309
314
  }
310
315
  else if (channel) {
@@ -313,7 +318,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
313
318
  scope: normalizeChannelOperand(channel),
314
319
  topic,
315
320
  timeRange,
316
- limit: Math.max(Math.floor(limit / 2), 1),
321
+ limit,
317
322
  }));
318
323
  }
319
324
  else if (timeRange) {
@@ -321,7 +326,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
321
326
  client,
322
327
  topic,
323
328
  timeRange,
324
- limit: Math.max(Math.floor(limit / 2), 1),
329
+ limit,
325
330
  }));
326
331
  }
327
332
  if (topic) {
@@ -329,11 +334,21 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
329
334
  client,
330
335
  topic,
331
336
  timeRange,
332
- limit: Math.max(Math.floor(limit / Math.max(searchPromises.length, 1)), 1),
337
+ limit,
333
338
  }));
334
339
  }
335
340
  const searchResults = yield Promise.all(searchPromises);
336
- searchResults.forEach(matches => allMatches.push(...matches));
341
+ const searchResultsFilteredByTypeAndLimit = searchResults.map(matches => {
342
+ return matches
343
+ .filter(m => {
344
+ if (messageTypeFilter) {
345
+ return m.type === messageTypeFilter;
346
+ }
347
+ return true;
348
+ })
349
+ .slice(0, Math.max(Math.floor(limit / Math.max(searchPromises.length, 1)), 1));
350
+ });
351
+ searchResultsFilteredByTypeAndLimit.forEach(matches => allMatches.push(...matches));
337
352
  const channelInfoCache = new Map();
338
353
  const expanded = yield Promise.all(allMatches.map(m => limitHit(() => __awaiter(void 0, void 0, void 0, function* () {
339
354
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.168",
3
+ "version": "0.2.169",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,