@credal/actions 0.2.173 → 0.2.174
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.
- package/dist/actions/groups.js +1 -11
- package/dist/actions/providers/github/fetchFile.d.ts +3 -0
- package/dist/actions/providers/github/fetchFile.js +131 -0
- package/dist/actions/providers/github/getContents.d.ts +3 -0
- package/dist/actions/providers/github/getContents.js +41 -0
- package/package.json +2 -2
- package/dist/actions/autogen/definitions.d.ts +0 -5
- package/dist/actions/autogen/definitions.js +0 -132
- package/dist/actions/definitions.js +0 -35
- package/dist/actions/invokeMapper.d.ts +0 -9
- package/dist/actions/invokeMapper.js +0 -33
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -43
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/google-oauth/getSheetValue.d.ts +0 -3
- package/dist/actions/providers/google-oauth/getSheetValue.js +0 -50
- package/dist/actions/providers/google-oauth/getSheetValues.d.ts +0 -3
- package/dist/actions/providers/google-oauth/getSheetValues.js +0 -50
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +0 -3
- package/dist/actions/providers/googlemaps/nearbysearch.js +0 -96
- package/dist/actions/providers/jamf/types.d.ts +0 -8
- package/dist/actions/providers/jamf/types.js +0 -7
- package/dist/actions/providers/jira/createTicket.d.ts +0 -3
- package/dist/actions/providers/jira/createTicket.js +0 -34
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- package/dist/actions/providers/slack/listConversations.js +0 -41
- package/dist/actions/providers/slack/list_conversations.d.ts +0 -3
- package/dist/actions/providers/slack/list_conversations.js +0 -60
- package/dist/actions/providers/slack/summarizeChannel.d.ts +0 -3
- package/dist/actions/providers/slack/summarizeChannel.js +0 -51
- package/dist/actions/schema.js +0 -6
- package/dist/actions/types.js +0 -2
- package/dist/main.js +0 -11
package/dist/actions/groups.js
CHANGED
|
@@ -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,
|
|
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,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,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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.174",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript-eslint": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@credal/sdk": "^0.
|
|
50
|
+
"@credal/sdk": "^0.1.14",
|
|
51
51
|
"@mendable/firecrawl-js": "^4.3.4",
|
|
52
52
|
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
53
53
|
"@octokit/core": "^6.1.6",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ActionTemplate } from "@/actions/parse";
|
|
2
|
-
export declare const slackSendMessageDefinition: ActionTemplate;
|
|
3
|
-
export declare const slackListConversationsDefinition: ActionTemplate;
|
|
4
|
-
export declare const mathAddDefinition: ActionTemplate;
|
|
5
|
-
export declare const confluenceUpdatePageDefinition: ActionTemplate;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
|
|
4
|
-
exports.slackSendMessageDefinition = {
|
|
5
|
-
provider: "slack",
|
|
6
|
-
name: "send_message",
|
|
7
|
-
description: "Sends a message to a Slack channel",
|
|
8
|
-
scopes: ["chat:write"],
|
|
9
|
-
parameters: {
|
|
10
|
-
channel: {
|
|
11
|
-
type: "string",
|
|
12
|
-
description: "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
message: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: "The message content to send to Slack. Can include markdown formatting.",
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
output: {},
|
|
22
|
-
};
|
|
23
|
-
exports.slackListConversationsDefinition = {
|
|
24
|
-
provider: "slack",
|
|
25
|
-
name: "list_conversations",
|
|
26
|
-
description: "Lists all conversations in a Slack workspace",
|
|
27
|
-
scopes: ["channels:read", "groups:read", "im:read", "mpim:read"],
|
|
28
|
-
authToken: {
|
|
29
|
-
type: "string",
|
|
30
|
-
description: "The Slack access token to use",
|
|
31
|
-
required: true,
|
|
32
|
-
},
|
|
33
|
-
parameters: {},
|
|
34
|
-
output: {
|
|
35
|
-
channels: {
|
|
36
|
-
type: "array",
|
|
37
|
-
description: "A list of channels in Slack",
|
|
38
|
-
required: true,
|
|
39
|
-
items: {
|
|
40
|
-
type: "object",
|
|
41
|
-
description: "A channel in Slack",
|
|
42
|
-
required: true,
|
|
43
|
-
properties: {
|
|
44
|
-
id: {
|
|
45
|
-
type: "string",
|
|
46
|
-
description: "The ID of the channel",
|
|
47
|
-
required: true,
|
|
48
|
-
},
|
|
49
|
-
name: {
|
|
50
|
-
type: "string",
|
|
51
|
-
description: "The name of the channel",
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
topic: {
|
|
55
|
-
type: "string",
|
|
56
|
-
description: "The topic of the channel",
|
|
57
|
-
required: true,
|
|
58
|
-
},
|
|
59
|
-
purpose: {
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "The purpose of the channel",
|
|
62
|
-
required: true,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
exports.mathAddDefinition = {
|
|
70
|
-
provider: "math",
|
|
71
|
-
name: "add",
|
|
72
|
-
description: "Adds two numbers together",
|
|
73
|
-
scopes: [],
|
|
74
|
-
parameters: {
|
|
75
|
-
a: {
|
|
76
|
-
type: "number",
|
|
77
|
-
description: "The first number to add",
|
|
78
|
-
required: true,
|
|
79
|
-
},
|
|
80
|
-
b: {
|
|
81
|
-
type: "number",
|
|
82
|
-
description: "The second number to add",
|
|
83
|
-
required: true,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
output: {
|
|
87
|
-
result: {
|
|
88
|
-
type: "number",
|
|
89
|
-
description: "The sum of the two numbers",
|
|
90
|
-
required: true,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
exports.confluenceUpdatePageDefinition = {
|
|
95
|
-
provider: "confluence",
|
|
96
|
-
name: "updatePage",
|
|
97
|
-
description: "Updates a confluence page with the new content specified",
|
|
98
|
-
scopes: [],
|
|
99
|
-
authToken: {
|
|
100
|
-
type: "string",
|
|
101
|
-
description: "The access token to use for confluence",
|
|
102
|
-
required: true,
|
|
103
|
-
},
|
|
104
|
-
baseUrl: {
|
|
105
|
-
type: "string",
|
|
106
|
-
description: "The base url required to access the confluence instance",
|
|
107
|
-
required: true,
|
|
108
|
-
},
|
|
109
|
-
parameters: {
|
|
110
|
-
pageId: {
|
|
111
|
-
type: "string",
|
|
112
|
-
description: "The page id that should be updated",
|
|
113
|
-
required: true,
|
|
114
|
-
},
|
|
115
|
-
title: {
|
|
116
|
-
type: "string",
|
|
117
|
-
description: "The title of the page that should be updated",
|
|
118
|
-
required: true,
|
|
119
|
-
},
|
|
120
|
-
username: {
|
|
121
|
-
type: "string",
|
|
122
|
-
description: "The username of the person updating the page",
|
|
123
|
-
required: true,
|
|
124
|
-
},
|
|
125
|
-
content: {
|
|
126
|
-
type: "string",
|
|
127
|
-
description: "The new content for the page",
|
|
128
|
-
required: true,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
output: {},
|
|
132
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mathAddDefinition = exports.slackSendMessageDefinition = void 0;
|
|
4
|
-
exports.slackSendMessageDefinition = {
|
|
5
|
-
name: "send_message",
|
|
6
|
-
description: "Sends a message to a Slack channel",
|
|
7
|
-
parameters: {
|
|
8
|
-
"channel": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
|
11
|
-
"required": true
|
|
12
|
-
},
|
|
13
|
-
"message": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"description": "The message content to send to Slack. Can include markdown formatting.",
|
|
16
|
-
"required": true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.mathAddDefinition = {
|
|
21
|
-
name: "add",
|
|
22
|
-
description: "Adds two numbers together",
|
|
23
|
-
parameters: {
|
|
24
|
-
"a": {
|
|
25
|
-
"type": "number",
|
|
26
|
-
"description": "The first number to add",
|
|
27
|
-
"required": true
|
|
28
|
-
},
|
|
29
|
-
"b": {
|
|
30
|
-
"type": "number",
|
|
31
|
-
"description": "The second number to add",
|
|
32
|
-
"required": true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ActionFunction } from "./autogen/types";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
interface ActionFunctionComponents {
|
|
4
|
-
fn: ActionFunction<any, any, any>;
|
|
5
|
-
paramsSchema: z.ZodSchema;
|
|
6
|
-
outputSchema: z.ZodSchema;
|
|
7
|
-
}
|
|
8
|
-
export declare const FunctionMapper: Record<string, Record<string, ActionFunctionComponents>>;
|
|
9
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FunctionMapper = void 0;
|
|
7
|
-
const add_1 = __importDefault(require("./providers/math/add"));
|
|
8
|
-
const list_conversations_1 = __importDefault(require("./providers/slack/list_conversations"));
|
|
9
|
-
const updatePage_1 = __importDefault(require("./providers/confluence/updatePage"));
|
|
10
|
-
const types_1 = require("./autogen/types");
|
|
11
|
-
exports.FunctionMapper = {
|
|
12
|
-
math: {
|
|
13
|
-
add: {
|
|
14
|
-
fn: add_1.default,
|
|
15
|
-
paramsSchema: types_1.mathAddParamsSchema,
|
|
16
|
-
outputSchema: types_1.mathAddOutputSchema,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
slack: {
|
|
20
|
-
listConversations: {
|
|
21
|
-
fn: list_conversations_1.default,
|
|
22
|
-
paramsSchema: types_1.slackListConversationsParamsSchema,
|
|
23
|
-
outputSchema: types_1.slackListConversationsOutputSchema,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
confluence: {
|
|
27
|
-
updatePage: {
|
|
28
|
-
fn: updatePage_1.default,
|
|
29
|
-
paramsSchema: types_1.confluenceUpdatePageParamsSchema,
|
|
30
|
-
outputSchema: types_1.confluenceUpdatePageOutputSchema,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
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 axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
-
function getConfluenceRequestConfig(baseUrl, username, apiToken) {
|
|
14
|
-
return {
|
|
15
|
-
baseURL: baseUrl,
|
|
16
|
-
headers: {
|
|
17
|
-
Accept: "application/json",
|
|
18
|
-
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
23
|
-
const { pageId, username, content, title } = params;
|
|
24
|
-
const { baseUrl, authToken } = authParams;
|
|
25
|
-
const config = getConfluenceRequestConfig(baseUrl, username, authToken);
|
|
26
|
-
// Get current version number
|
|
27
|
-
const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
|
|
28
|
-
const currVersion = response.data.version.number;
|
|
29
|
-
const payload = {
|
|
30
|
-
id: pageId,
|
|
31
|
-
status: "current",
|
|
32
|
-
title,
|
|
33
|
-
body: {
|
|
34
|
-
representation: "storage",
|
|
35
|
-
value: content,
|
|
36
|
-
},
|
|
37
|
-
version: {
|
|
38
|
-
number: currVersion + 1,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
|
|
42
|
-
});
|
|
43
|
-
exports.default = confluenceUpdatePage;
|
|
@@ -1,36 +0,0 @@
|
|
|
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 sdk_1 = require("@credal/sdk");
|
|
13
|
-
const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
var _b;
|
|
15
|
-
const requestBody = {
|
|
16
|
-
agentId: params.agentId,
|
|
17
|
-
query: params.query,
|
|
18
|
-
userEmail: params.userEmail,
|
|
19
|
-
};
|
|
20
|
-
const baseUrl = (_b = authParams.baseUrl) !== null && _b !== void 0 ? _b : "https://app.credal.ai/api";
|
|
21
|
-
const client = new sdk_1.CredalClient({ environment: baseUrl, apiKey: authParams.apiKey });
|
|
22
|
-
const response = yield client.copilots.sendMessage({
|
|
23
|
-
agentId: requestBody.agentId,
|
|
24
|
-
message: requestBody.query,
|
|
25
|
-
userEmail: requestBody.userEmail,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
response: response.sendChatResult.type === "ai_response_result"
|
|
29
|
-
? response.sendChatResult.response.message
|
|
30
|
-
: "Error getting response",
|
|
31
|
-
referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
|
|
32
|
-
sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
|
|
33
|
-
webSearchResults: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.webSearchResults : [],
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
exports.default = callCopilot;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const getSheetValues = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { authToken } = authParams;
|
|
14
|
-
const { spreadsheetId, ranges } = params;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
return { success: false, error: MISSING_AUTH_TOKEN };
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const url = new URL(`https://sheets.googleapis.com/v4/spreadsheets/${encodeURIComponent(spreadsheetId)}/values:batchGet`);
|
|
20
|
-
// Add ranges as query parameters if provided
|
|
21
|
-
if (ranges && ranges.length > 0) {
|
|
22
|
-
ranges.forEach(range => {
|
|
23
|
-
url.searchParams.append("ranges", range);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const response = yield axiosClient.get(url.toString(), {
|
|
27
|
-
headers: { Authorization: `Bearer ${authToken}` },
|
|
28
|
-
});
|
|
29
|
-
const { valueRanges } = response.data;
|
|
30
|
-
// Transform the response to match our schema
|
|
31
|
-
const transformedValueRanges = valueRanges === null || valueRanges === void 0 ? void 0 : valueRanges.map((vr) => {
|
|
32
|
-
var _a;
|
|
33
|
-
return ({
|
|
34
|
-
range: vr.range,
|
|
35
|
-
values: ((_a = vr.values) === null || _a === void 0 ? void 0 : _a.flatMap(row => row.map(cell => ({ value: cell != null ? String(cell) : undefined })))) || [],
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
valueRanges: transformedValueRanges,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
export default getSheetValues;
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const getSheetValues = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { authToken } = authParams;
|
|
14
|
-
const { spreadsheetId, ranges } = params;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
return { success: false, error: MISSING_AUTH_TOKEN };
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const url = new URL(`https://sheets.googleapis.com/v4/spreadsheets/${encodeURIComponent(spreadsheetId)}/values:batchGet`);
|
|
20
|
-
// Add ranges as query parameters if provided
|
|
21
|
-
if (ranges && ranges.length > 0) {
|
|
22
|
-
ranges.forEach(range => {
|
|
23
|
-
url.searchParams.append("ranges", range);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const response = yield axiosClient.get(url.toString(), {
|
|
27
|
-
headers: { Authorization: `Bearer ${authToken}` },
|
|
28
|
-
});
|
|
29
|
-
const { valueRanges } = response.data;
|
|
30
|
-
// Transform the response to match our schema
|
|
31
|
-
const transformedValueRanges = valueRanges === null || valueRanges === void 0 ? void 0 : valueRanges.map((vr) => {
|
|
32
|
-
var _a;
|
|
33
|
-
return ({
|
|
34
|
-
range: vr.range,
|
|
35
|
-
values: ((_a = vr.values) === null || _a === void 0 ? void 0 : _a.flatMap(row => row.map(cell => ({ value: cell != null ? String(cell) : undefined })))) || [],
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
40
|
-
valueRanges: transformedValueRanges,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
export default getSheetValues;
|