@credal/actions 0.2.105 → 0.2.107

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 (30) hide show
  1. package/README.md +2 -2
  2. package/dist/actions/actionMapper.js +21 -1
  3. package/dist/actions/autogen/templates.d.ts +3 -0
  4. package/dist/actions/autogen/templates.js +542 -0
  5. package/dist/actions/autogen/types.d.ts +769 -2
  6. package/dist/actions/autogen/types.js +175 -0
  7. package/dist/actions/groups.js +1 -11
  8. package/dist/actions/providers/github/fetchFile.d.ts +3 -0
  9. package/dist/actions/providers/github/fetchFile.js +131 -0
  10. package/dist/actions/providers/github/getContents.d.ts +3 -0
  11. package/dist/actions/providers/github/getContents.js +41 -0
  12. package/dist/actions/providers/github/getPullRequestDetails.d.ts +3 -0
  13. package/dist/actions/providers/github/getPullRequestDetails.js +61 -0
  14. package/dist/actions/providers/github/listCommits.d.ts +3 -0
  15. package/dist/actions/providers/github/listCommits.js +73 -0
  16. package/dist/actions/providers/perplexity/perplexityDeepResearch.d.ts +3 -0
  17. package/dist/actions/providers/perplexity/perplexityDeepResearch.js +62 -0
  18. package/package.json +1 -1
  19. package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
  20. package/dist/actions/providers/confluence/updatePage.js +0 -47
  21. package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
  22. package/dist/actions/providers/credal/callCopilot.js +0 -36
  23. package/dist/actions/providers/jamf/types.d.ts +0 -8
  24. package/dist/actions/providers/jamf/types.js +0 -7
  25. package/dist/actions/providers/math/index.d.ts +0 -1
  26. package/dist/actions/providers/math/index.js +0 -37
  27. package/dist/actions/providers/slack/index.d.ts +0 -1
  28. package/dist/actions/providers/slack/index.js +0 -37
  29. package/dist/actions/providers/slack/listConversations.d.ts +0 -3
  30. package/dist/actions/providers/slack/listConversations.js +0 -41
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  export var ProviderName;
3
3
  (function (ProviderName) {
4
4
  ProviderName["GENERIC"] = "generic";
5
+ ProviderName["PERPLEXITY"] = "perplexity";
5
6
  ProviderName["ASANA"] = "asana";
6
7
  ProviderName["SLACK"] = "slack";
7
8
  ProviderName["MATH"] = "math";
@@ -63,6 +64,27 @@ export const genericFillTemplateParamsSchema = z.object({
63
64
  export const genericFillTemplateOutputSchema = z.object({
64
65
  result: z.string().describe("The template string returned filled in"),
65
66
  });
67
+ export const perplexityPerplexityDeepResearchParamsSchema = z.object({
68
+ query: z.string().describe("The research query/question"),
69
+ reasoningEffort: z
70
+ .string()
71
+ .describe('Optional reasoning effort level ("low", "medium", "high"). Defaults to "medium".')
72
+ .optional(),
73
+ });
74
+ export const perplexityPerplexityDeepResearchOutputSchema = z.object({
75
+ error: z.string().describe("Error if comment was unsuccessful").optional(),
76
+ success: z.boolean().describe("Whether comment was successfully made"),
77
+ result: z
78
+ .object({
79
+ content: z.string().describe("The main research response/analysis").optional(),
80
+ sources: z
81
+ .array(z.object({ title: z.string().optional(), url: z.string().optional() }))
82
+ .describe("Array of source citations")
83
+ .optional(),
84
+ })
85
+ .describe("The main research response/analysis")
86
+ .optional(),
87
+ });
66
88
  export const asanaCommentTaskParamsSchema = z.object({
67
89
  taskId: z.string().describe("Task gid the comment should be added to"),
68
90
  commentText: z.string().describe("The comment text to be added"),
@@ -3547,6 +3569,100 @@ export const githubListPullRequestsOutputSchema = z.object({
3547
3569
  }))
3548
3570
  .describe("A list of pull requests in the repository"),
3549
3571
  });
3572
+ export const githubGetPullRequestDetailsParamsSchema = z.object({
3573
+ repositoryOwner: z.string().describe("The owner of the repository"),
3574
+ repositoryName: z.string().describe("The name of the repository"),
3575
+ pullRequestNumber: z.number().describe("The number of the pull request to get details for"),
3576
+ });
3577
+ export const githubGetPullRequestDetailsOutputSchema = z.object({
3578
+ success: z.boolean().describe("Whether the operation was successful"),
3579
+ error: z.string().describe("The error that occurred if the operation was not successful").optional(),
3580
+ pullRequest: z
3581
+ .object({
3582
+ number: z.number().describe("The number of the pull request").optional(),
3583
+ title: z.string().describe("The title of the pull request").optional(),
3584
+ description: z.string().nullable().describe("The body/description of the pull request").optional(),
3585
+ state: z.enum(["open", "closed", "merged"]).describe("The state of the pull request").optional(),
3586
+ draft: z.boolean().describe("Whether the pull request is a draft").optional(),
3587
+ url: z.string().describe("The API URL of the pull request").optional(),
3588
+ htmlUrl: z.string().describe("The web URL of the pull request").optional(),
3589
+ createdAt: z.string().describe("The date and time when the pull request was created").optional(),
3590
+ updatedAt: z.string().describe("The date and time when the pull request was last updated").optional(),
3591
+ closedAt: z.string().nullable().describe("The date and time when the pull request was closed").optional(),
3592
+ mergedAt: z.string().nullable().describe("The date and time when the pull request was merged").optional(),
3593
+ author: z
3594
+ .object({ login: z.string().describe("The username of the pull request author").optional() })
3595
+ .describe("The user who created the pull request")
3596
+ .optional(),
3597
+ assignees: z
3598
+ .array(z.object({ login: z.string().describe("The username of the assignee").optional() }))
3599
+ .describe("Users assigned to the pull request")
3600
+ .optional(),
3601
+ reviewers: z
3602
+ .array(z.object({ login: z.string().describe("The username of the reviewer").optional() }))
3603
+ .describe("Users requested to review the pull request")
3604
+ .optional(),
3605
+ labels: z
3606
+ .array(z.object({
3607
+ name: z.string().describe("The name of the label").optional(),
3608
+ color: z.string().describe("The color of the label").optional(),
3609
+ description: z.string().nullable().describe("The description of the label").optional(),
3610
+ }))
3611
+ .describe("Labels applied to the pull request")
3612
+ .optional(),
3613
+ head: z
3614
+ .object({
3615
+ ref: z.string().describe("The name of the head branch").optional(),
3616
+ sha: z.string().describe("The SHA of the head commit").optional(),
3617
+ repo: z
3618
+ .object({
3619
+ name: z.string().describe("The name of the head repository").optional(),
3620
+ fullName: z.string().describe("The full name of the head repository").optional(),
3621
+ owner: z
3622
+ .object({ login: z.string().describe("The username of the head repository owner").optional() })
3623
+ .optional(),
3624
+ })
3625
+ .optional(),
3626
+ })
3627
+ .describe("The head branch of the pull request")
3628
+ .optional(),
3629
+ base: z
3630
+ .object({
3631
+ ref: z.string().describe("The name of the base branch").optional(),
3632
+ sha: z.string().describe("The SHA of the base commit").optional(),
3633
+ repo: z
3634
+ .object({
3635
+ name: z.string().describe("The name of the base repository").optional(),
3636
+ fullName: z.string().describe("The full name of the base repository").optional(),
3637
+ owner: z
3638
+ .object({ login: z.string().describe("The username of the base repository owner").optional() })
3639
+ .optional(),
3640
+ })
3641
+ .optional(),
3642
+ })
3643
+ .describe("The base branch of the pull request")
3644
+ .optional(),
3645
+ mergeable: z.boolean().nullable().describe("Whether the pull request can be merged").optional(),
3646
+ mergeableState: z.string().nullable().describe("The mergeable state of the pull request").optional(),
3647
+ merged: z.boolean().describe("Whether the pull request has been merged").optional(),
3648
+ commits: z.number().describe("The number of commits in the pull request").optional(),
3649
+ additions: z.number().describe("The number of additions in the pull request").optional(),
3650
+ deletions: z.number().describe("The number of deletions in the pull request").optional(),
3651
+ changedFiles: z.number().describe("The number of files changed in the pull request").optional(),
3652
+ milestone: z
3653
+ .object({
3654
+ title: z.string().describe("The title of the milestone").optional(),
3655
+ description: z.string().nullable().describe("The description of the milestone").optional(),
3656
+ state: z.string().describe("The state of the milestone").optional(),
3657
+ dueOn: z.string().nullable().describe("The due date of the milestone").optional(),
3658
+ })
3659
+ .nullable()
3660
+ .describe("The milestone associated with the pull request")
3661
+ .optional(),
3662
+ })
3663
+ .describe("Detailed information about the pull request")
3664
+ .optional(),
3665
+ });
3550
3666
  export const githubGetFileContentParamsSchema = z.object({
3551
3667
  organization: z.string().describe("The organization that owns the repository"),
3552
3668
  repository: z.string().describe("The repository name"),
@@ -3707,6 +3823,65 @@ export const githubSearchOrganizationOutputSchema = z.object({
3707
3823
  }))
3708
3824
  .describe("A list of issues and pull requests that match the query"),
3709
3825
  });
3826
+ export const githubListCommitsParamsSchema = z.object({
3827
+ repositoryOwner: z.string().describe("The owner of the repository"),
3828
+ repositoryName: z.string().describe("The name of the repository"),
3829
+ branch: z.string().describe("The branch to list commits from (defaults to default branch)").optional(),
3830
+ since: z
3831
+ .string()
3832
+ .describe("Only show commits after this date (ISO 8601 format, e.g., 2023-01-01T00:00:00Z)")
3833
+ .optional(),
3834
+ until: z
3835
+ .string()
3836
+ .describe("Only show commits before this date (ISO 8601 format, e.g., 2023-12-31T23:59:59Z)")
3837
+ .optional(),
3838
+ author: z.string().describe("Filter commits by author (GitHub username or email)").optional(),
3839
+ perPage: z.number().describe("Number of commits to return per page (default 30, max 100)").optional(),
3840
+ page: z.number().describe("Page number for pagination (default 1)").optional(),
3841
+ });
3842
+ export const githubListCommitsOutputSchema = z.object({
3843
+ success: z.boolean().describe("Whether the operation was successful"),
3844
+ error: z.string().describe("The error that occurred if the operation was not successful").optional(),
3845
+ commits: z
3846
+ .array(z.object({
3847
+ sha: z.string().describe("The SHA hash of the commit"),
3848
+ url: z.string().describe("The API URL of the commit"),
3849
+ htmlUrl: z.string().describe("The web URL of the commit"),
3850
+ commit: z.object({
3851
+ message: z.string().describe("The commit message"),
3852
+ author: z.object({
3853
+ name: z.string().describe("The name of the commit author"),
3854
+ email: z.string().describe("The email of the commit author"),
3855
+ date: z.string().describe("The date when the commit was authored (ISO 8601 format)"),
3856
+ }),
3857
+ committer: z.object({
3858
+ name: z.string().describe("The name of the commit committer"),
3859
+ email: z.string().describe("The email of the commit committer"),
3860
+ date: z.string().describe("The date when the commit was committed (ISO 8601 format)"),
3861
+ }),
3862
+ tree: z.object({
3863
+ sha: z.string().describe("The SHA of the tree object"),
3864
+ url: z.string().describe("The API URL of the tree object"),
3865
+ }),
3866
+ commentCount: z.number().describe("The number of comments on the commit").optional(),
3867
+ }),
3868
+ author: z
3869
+ .object({ login: z.string().describe("The GitHub username of the commit author").optional() })
3870
+ .nullable(),
3871
+ parents: z
3872
+ .array(z.object({
3873
+ sha: z.string().describe("The SHA of the parent commit"),
3874
+ url: z.string().describe("The API URL of the parent commit"),
3875
+ htmlUrl: z.string().describe("The web URL of the parent commit"),
3876
+ }))
3877
+ .describe("The parent commits")
3878
+ .optional(),
3879
+ }))
3880
+ .describe("List of commits in the repository")
3881
+ .optional(),
3882
+ totalCount: z.number().describe("Total number of commits (if available)").optional(),
3883
+ hasMore: z.boolean().describe("Whether there are more commits available on subsequent pages").optional(),
3884
+ });
3710
3885
  export const notionSearchByTitleParamsSchema = z.object({
3711
3886
  query: z.string().describe("The query to search for in Notion titles"),
3712
3887
  });
@@ -1,4 +1,4 @@
1
- import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, linearGetIssueDetailsDefinition, linearGetProjectsDefinition, linearGetProjectDetailsDefinition, linearGetTeamDetailsDefinition, linearGetTeamsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } from "./autogen/templates.js";
1
+ import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } from "./autogen/templates.js";
2
2
  export const ACTION_GROUPS = {
3
3
  GENERIC: {
4
4
  description: "Generic utility actions",
@@ -248,14 +248,4 @@ export const ACTION_GROUPS = {
248
248
  oktaTriggerOktaWorkflowDefinition,
249
249
  ],
250
250
  },
251
- LINEAR: {
252
- description: "Actions for interacting with Linear",
253
- actions: [
254
- linearGetIssueDetailsDefinition,
255
- linearGetProjectsDefinition,
256
- linearGetProjectDetailsDefinition,
257
- linearGetTeamDetailsDefinition,
258
- linearGetTeamsDefinition,
259
- ],
260
- },
261
251
  };
@@ -0,0 +1,3 @@
1
+ import type { githubSearchRepositoryFunction } from "../../autogen/types.js";
2
+ declare const searchRepository: githubSearchRepositoryFunction;
3
+ export default searchRepository;
@@ -0,0 +1,131 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
11
+ // Limits on the number of results to return
12
+ const MAX_CODE_RESULTS = 15;
13
+ const MAX_COMMITS = 10;
14
+ const MAX_FILES_PER_COMMIT = 5;
15
+ const MAX_ISSUES_OR_PRS = 10;
16
+ const MAX_FILES_PER_PR = 5;
17
+ const MAX_PATCH_LINES = 20;
18
+ const MAX_FRAGMENT_LINES = 20;
19
+ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
+ const { Octokit } = yield import("octokit");
21
+ if (!authParams.authToken) {
22
+ throw new Error(MISSING_AUTH_TOKEN);
23
+ }
24
+ const octokit = new Octokit({ auth: authParams.authToken });
25
+ const { organization, repository, query } = params;
26
+ // Search CODE with text match metadata
27
+ const codeResultsResponse = yield octokit.rest.search.code({
28
+ q: `${query} in:file,path repo:${organization}/${repository}`,
29
+ text_match: true,
30
+ headers: {
31
+ accept: "application/vnd.github.v3.text-match+json",
32
+ },
33
+ });
34
+ const codeResults = codeResultsResponse.data.items.slice(0, MAX_CODE_RESULTS).map(item => ({
35
+ name: item.name,
36
+ path: item.path,
37
+ sha: item.sha,
38
+ url: item.url,
39
+ repository: {
40
+ full_name: item.repository.full_name,
41
+ html_url: item.repository.html_url,
42
+ },
43
+ score: item.score,
44
+ textMatches: item.text_matches
45
+ ? item.text_matches.map(match => {
46
+ var _a, _b, _c, _d;
47
+ return ({
48
+ object_url: (_a = match.object_url) !== null && _a !== void 0 ? _a : undefined,
49
+ object_type: (_b = match.object_type) !== null && _b !== void 0 ? _b : undefined,
50
+ fragment: (_c = match.fragment) === null || _c === void 0 ? void 0 : _c.split("\n").slice(0, MAX_FRAGMENT_LINES).join("\n"),
51
+ matches: (_d = match.matches) !== null && _d !== void 0 ? _d : [],
52
+ });
53
+ })
54
+ : [],
55
+ }));
56
+ // Search COMMITS
57
+ const commitResults = yield octokit.rest.search.commits({
58
+ q: `${query} repo:${organization}/${repository}`,
59
+ headers: {
60
+ accept: "application/vnd.github.cloak-preview+json",
61
+ },
62
+ });
63
+ const commitSHAs = commitResults.data.items.slice(0, MAX_COMMITS).map(item => item.sha);
64
+ const commitDetails = yield Promise.all(commitSHAs.map(sha => octokit.rest.repos.getCommit({ owner: organization, repo: repository, ref: sha })));
65
+ const enrichedCommits = commitResults.data.items.slice(0, MAX_COMMITS).map(item => {
66
+ var _a, _b;
67
+ const full = commitDetails.find(c => c.data.sha === item.sha);
68
+ return {
69
+ sha: item.sha,
70
+ url: item.url,
71
+ commit: {
72
+ message: item.commit.message,
73
+ author: item.commit.author,
74
+ },
75
+ score: item.score,
76
+ author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
77
+ files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
78
+ var _a;
79
+ return ({
80
+ filename: f.filename,
81
+ status: f.status,
82
+ patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
83
+ });
84
+ })) || [],
85
+ };
86
+ });
87
+ // Search ISSUES & PRs
88
+ const issueResults = yield octokit.rest.search.issuesAndPullRequests({
89
+ q: `${query} repo:${organization}/${repository}`,
90
+ });
91
+ const prItems = issueResults.data.items.filter(item => item.pull_request).slice(0, MAX_ISSUES_OR_PRS);
92
+ const prNumbers = prItems.map(item => item.number);
93
+ const prFiles = yield Promise.all(prNumbers.map(number => octokit.rest.pulls.listFiles({ owner: organization, repo: repository, pull_number: number })));
94
+ const issuesAndPRs = issueResults.data.items
95
+ .slice(0, MAX_ISSUES_OR_PRS)
96
+ .map(item => {
97
+ var _a, _b, _c, _d;
98
+ const isPR = !!item.pull_request;
99
+ const prIndex = prNumbers.indexOf(item.number);
100
+ const files = isPR && prIndex !== -1
101
+ ? prFiles[prIndex].data.slice(0, MAX_FILES_PER_PR).map(f => {
102
+ var _a;
103
+ return ({
104
+ filename: f.filename,
105
+ status: f.status,
106
+ patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
107
+ });
108
+ })
109
+ : undefined;
110
+ return {
111
+ number: item.number,
112
+ title: item.title,
113
+ html_url: item.html_url,
114
+ state: item.state,
115
+ isPullRequest: isPR,
116
+ body: item.body,
117
+ user: {
118
+ email: (_b = (_a = item.user) === null || _a === void 0 ? void 0 : _a.email) !== null && _b !== void 0 ? _b : undefined,
119
+ name: (_d = (_c = item.user) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : undefined,
120
+ },
121
+ score: item.score,
122
+ files,
123
+ };
124
+ });
125
+ return {
126
+ code: codeResults,
127
+ commits: enrichedCommits,
128
+ issuesAndPullRequests: issuesAndPRs,
129
+ };
130
+ });
131
+ export default searchRepository;
@@ -0,0 +1,3 @@
1
+ import type { githubSearchRepositoryFunction } from "../../autogen/types.js";
2
+ declare const searchRepository: githubSearchRepositoryFunction;
3
+ export default searchRepository;
@@ -0,0 +1,41 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
11
+ // Limits on the number of results to return
12
+ const MAX_CODE_RESULTS = 15;
13
+ const MAX_COMMITS = 10;
14
+ const MAX_FILES_PER_COMMIT = 5;
15
+ const MAX_ISSUES_OR_PRS = 10;
16
+ const MAX_FILES_PER_PR = 5;
17
+ const MAX_PATCH_LINES = 20;
18
+ const MAX_FRAGMENT_LINES = 20;
19
+ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
+ const { Octokit } = yield import("octokit");
21
+ if (!authParams.authToken) {
22
+ throw new Error(MISSING_AUTH_TOKEN);
23
+ }
24
+ const octokit = new Octokit({ auth: authParams.authToken });
25
+ const { organization, repository, query } = params;
26
+ // Search CODE with text match metadata
27
+ const codeResultsResponse = yield octokit.rest.search.code({
28
+ q: `${query} in:file,path repo:${organization}/${repository}`,
29
+ text_match: true,
30
+ headers: {
31
+ accept: "application/vnd.github.v3.text-match+json",
32
+ },
33
+ });
34
+ const commitResults = yield octokit.rest.repos.getCommit({ owner: organization, repo: repository, ref: sha });
35
+ return {
36
+ code: codeResults,
37
+ commits: enrichedCommits,
38
+ issuesAndPullRequests: issuesAndPRs,
39
+ };
40
+ });
41
+ export default searchRepository;
@@ -0,0 +1,3 @@
1
+ import { type githubGetPullRequestDetailsFunction } from "../../autogen/types.js";
2
+ declare const getPullRequestDetails: githubGetPullRequestDetailsFunction;
3
+ export default getPullRequestDetails;
@@ -0,0 +1,61 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axios from "axios";
11
+ import { githubGetPullRequestDetailsOutputSchema, } from "../../autogen/types.js";
12
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
13
+ const getPullRequestDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ var _b, _c, _d;
15
+ const { authToken } = authParams;
16
+ if (!authToken) {
17
+ throw new Error(MISSING_AUTH_TOKEN);
18
+ }
19
+ const { repositoryOwner, repositoryName, pullRequestNumber } = params;
20
+ try {
21
+ const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls/${pullRequestNumber}`;
22
+ const response = yield axios.get(url, {
23
+ headers: {
24
+ Authorization: `Bearer ${authToken}`,
25
+ Accept: "application/vnd.github+json",
26
+ "X-GitHub-Api-Version": "2022-11-28",
27
+ },
28
+ });
29
+ const pr = response.data;
30
+ // Transform only the field names that differ between GitHub API and our schema
31
+ const transformedPR = Object.assign(Object.assign({}, pr), { description: pr.body, state: pr.state === "closed" && pr.merged_at ? "merged" : pr.state, htmlUrl: pr.html_url, createdAt: pr.created_at, updatedAt: pr.updated_at, closedAt: pr.closed_at, mergedAt: pr.merged_at, author: pr.user, assignees: pr.assignees || [], reviewers: pr.requested_reviewers || [], labels: ((_b = pr.labels) === null || _b === void 0 ? void 0 : _b.map(label => (Object.assign(Object.assign({}, label), { description: label.description || null })))) || [], head: Object.assign(Object.assign({}, pr.head), { repo: pr.head.repo
32
+ ? {
33
+ name: pr.head.repo.name,
34
+ fullName: pr.head.repo.full_name,
35
+ owner: pr.head.repo.owner,
36
+ }
37
+ : null }), base: Object.assign(Object.assign({}, pr.base), { repo: pr.base.repo
38
+ ? {
39
+ name: pr.base.repo.name,
40
+ fullName: pr.base.repo.full_name,
41
+ owner: pr.base.repo.owner,
42
+ }
43
+ : null }), mergeableState: pr.mergeable_state, changedFiles: pr.changed_files, milestone: pr.milestone
44
+ ? Object.assign(Object.assign({}, pr.milestone), { dueOn: pr.milestone.due_on }) : null });
45
+ return githubGetPullRequestDetailsOutputSchema.parse({
46
+ success: true,
47
+ pullRequest: transformedPR,
48
+ });
49
+ }
50
+ catch (error) {
51
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
52
+ const responseError = error && typeof error === "object" && "response" in error
53
+ ? (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message
54
+ : undefined;
55
+ return githubGetPullRequestDetailsOutputSchema.parse({
56
+ success: false,
57
+ error: responseError || errorMessage || "Failed to get pull request details",
58
+ });
59
+ }
60
+ });
61
+ export default getPullRequestDetails;
@@ -0,0 +1,3 @@
1
+ import { type githubListCommitsFunction } from "../../autogen/types.js";
2
+ declare const listCommits: githubListCommitsFunction;
3
+ export default listCommits;
@@ -0,0 +1,73 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axios from "axios";
11
+ import { githubListCommitsOutputSchema, } from "../../autogen/types.js";
12
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
13
+ const listCommits = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ var _b, _c;
15
+ const { authToken } = authParams;
16
+ if (!authToken) {
17
+ throw new Error(MISSING_AUTH_TOKEN);
18
+ }
19
+ const { repositoryName, repositoryOwner, branch, since, until, author, perPage = 30, page = 1 } = params;
20
+ try {
21
+ const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/commits`;
22
+ const requestParams = {
23
+ per_page: Math.min(perPage, 100), // GitHub API max is 100
24
+ page,
25
+ };
26
+ if (branch) {
27
+ requestParams.sha = branch;
28
+ }
29
+ if (since) {
30
+ requestParams.since = since;
31
+ }
32
+ if (until) {
33
+ requestParams.until = until;
34
+ }
35
+ if (author) {
36
+ requestParams.author = author;
37
+ }
38
+ const response = yield axios.get(url, {
39
+ headers: {
40
+ Authorization: `Bearer ${authToken}`,
41
+ Accept: "application/vnd.github+json",
42
+ "X-GitHub-Api-Version": "2022-11-28",
43
+ },
44
+ params: requestParams,
45
+ });
46
+ const commits = response.data;
47
+ // Transform only the field names that differ between GitHub API and our schema
48
+ const transformedCommits = commits.map(commit => (Object.assign(Object.assign({}, commit), { htmlUrl: commit.html_url, commit: Object.assign(Object.assign({}, commit.commit), { commentCount: commit.commit.comment_count || 0 }), author: commit.author, parents: commit.parents.map(parent => (Object.assign(Object.assign({}, parent), { htmlUrl: parent.html_url }))) })));
49
+ // Check if there are more pages by looking at the Link header
50
+ const linkHeader = response.headers.link;
51
+ const hasMore = linkHeader ? linkHeader.includes('rel="next"') : false;
52
+ return githubListCommitsOutputSchema.parse({
53
+ success: true,
54
+ commits: transformedCommits,
55
+ totalCount: commits.length, // Note: GitHub doesn't provide total count in this endpoint
56
+ hasMore,
57
+ });
58
+ }
59
+ catch (error) {
60
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
61
+ const responseError = error && typeof error === "object" && "response" in error
62
+ ? (_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message
63
+ : undefined;
64
+ return githubListCommitsOutputSchema.parse({
65
+ success: false,
66
+ error: responseError || errorMessage || "Failed to list commits",
67
+ commits: [],
68
+ totalCount: 0,
69
+ hasMore: false,
70
+ });
71
+ }
72
+ });
73
+ export default listCommits;
@@ -0,0 +1,3 @@
1
+ import type { perplexityPerplexityDeepResearchFunction } from "../../autogen/types.js";
2
+ declare const perplexityDeepResearch: perplexityPerplexityDeepResearchFunction;
3
+ export default perplexityDeepResearch;
@@ -0,0 +1,62 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { perplexityPerplexityDeepResearchOutputSchema } from "../../autogen/types.js";
11
+ const perplexityDeepResearch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
+ var _b, _c, _d, _e, _f, _g, _h, _j;
13
+ const { query, reasoningEffort = "medium" } = params;
14
+ try {
15
+ const response = yield fetch("https://api.perplexity.ai/chat/completions", {
16
+ method: "POST",
17
+ headers: {
18
+ Authorization: `Bearer ${authParams.apiKey}`,
19
+ "Content-Type": "application/json",
20
+ },
21
+ body: JSON.stringify({
22
+ model: "sonar-deep-research",
23
+ messages: [{ role: "user", content: query }],
24
+ reasoning_effort: reasoningEffort,
25
+ }),
26
+ });
27
+ if (!response.ok) {
28
+ return perplexityPerplexityDeepResearchOutputSchema.parse({
29
+ success: false,
30
+ error: `Perplexity API error: ${response.status} ${response.statusText}`,
31
+ });
32
+ }
33
+ const result = yield response.json();
34
+ const content = ((_d = (_c = (_b = result.choices) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.content) || "";
35
+ const sources = ((_e = result.search_results) === null || _e === void 0 ? void 0 : _e.map((source) => ({
36
+ title: source.title,
37
+ url: source.url,
38
+ snippet: source.snippet,
39
+ }))) || [];
40
+ const usage = {
41
+ input_tokens: (_f = result.usage) === null || _f === void 0 ? void 0 : _f.prompt_tokens,
42
+ output_tokens: (_g = result.usage) === null || _g === void 0 ? void 0 : _g.completion_tokens,
43
+ reasoning_tokens: (_h = result.usage) === null || _h === void 0 ? void 0 : _h.reasoning_tokens,
44
+ search_queries: (_j = result.usage) === null || _j === void 0 ? void 0 : _j.search_queries,
45
+ };
46
+ return perplexityPerplexityDeepResearchOutputSchema.parse({
47
+ success: true,
48
+ result: {
49
+ content,
50
+ sources,
51
+ usage,
52
+ },
53
+ });
54
+ }
55
+ catch (error) {
56
+ return perplexityPerplexityDeepResearchOutputSchema.parse({
57
+ success: false,
58
+ error: error instanceof Error ? error.message : "Unknown error",
59
+ });
60
+ }
61
+ });
62
+ export default perplexityDeepResearch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.105",
3
+ "version": "0.2.107",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
@@ -1,3 +0,0 @@
1
- import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
- declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
- export default confluenceUpdatePage;