@credal/actions 0.2.174 → 0.2.177
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/actionMapper.d.ts +2 -0
- package/dist/actions/actionMapper.js +125 -7
- package/dist/actions/autogen/templates.d.ts +1 -1
- package/dist/actions/autogen/templates.js +94 -238
- package/dist/actions/autogen/types.d.ts +214 -447
- package/dist/actions/autogen/types.js +10 -64
- package/dist/actions/groups.js +11 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +47 -0
- package/dist/actions/providers/credal/callCopilot.d.ts +3 -0
- package/dist/actions/providers/credal/callCopilot.js +36 -0
- package/dist/actions/providers/jamf/types.d.ts +8 -0
- package/dist/actions/providers/jamf/types.js +7 -0
- package/dist/actions/providers/math/index.d.ts +1 -0
- package/dist/actions/providers/math/index.js +37 -0
- package/dist/actions/providers/slack/getChannelMembers.d.ts +3 -0
- package/dist/actions/providers/slack/getChannelMembers.js +67 -0
- package/dist/actions/providers/slack/index.d.ts +1 -0
- package/dist/actions/providers/slack/index.js +37 -0
- package/dist/actions/providers/slack/listConversations.d.ts +3 -0
- package/dist/actions/providers/slack/listConversations.js +41 -0
- package/package.json +1 -1
- package/dist/actions/providers/github/fetchFile.d.ts +0 -3
- package/dist/actions/providers/github/fetchFile.js +0 -131
- package/dist/actions/providers/github/getContents.d.ts +0 -3
- package/dist/actions/providers/github/getContents.js +0 -41
|
@@ -312,6 +312,16 @@ export const slackGetChannelMessagesOutputSchema = z.object({
|
|
|
312
312
|
.describe("Cursor to use for fetching the next page of results. Only present when hasMore is true.")
|
|
313
313
|
.optional(),
|
|
314
314
|
});
|
|
315
|
+
export const slackGetChannelMembersParamsSchema = z.object({
|
|
316
|
+
channelId: z.string().describe("The ID of the channel to get members from").optional(),
|
|
317
|
+
channelName: z.string().describe("The name of the channel to get members from").optional(),
|
|
318
|
+
});
|
|
319
|
+
export const slackGetChannelMembersOutputSchema = z.object({
|
|
320
|
+
success: z.boolean().describe("Whether the members were retrieved successfully"),
|
|
321
|
+
members: z
|
|
322
|
+
.array(z.object({ id: z.string(), name: z.string(), email: z.string() }).describe("A member of the channel"))
|
|
323
|
+
.describe("The members of the channel"),
|
|
324
|
+
});
|
|
315
325
|
export const slackUserSearchSlackParamsSchema = z.object({
|
|
316
326
|
emails: z
|
|
317
327
|
.array(z.string().email())
|
|
@@ -3855,70 +3865,6 @@ export const githubListDirectoryOutputSchema = z.object({
|
|
|
3855
3865
|
.describe("Array of directory contents")
|
|
3856
3866
|
.optional(),
|
|
3857
3867
|
});
|
|
3858
|
-
export const githubSearchRepositoryParamsSchema = z.object({
|
|
3859
|
-
organization: z.string().describe("The organization to search for data in"),
|
|
3860
|
-
repository: z.string().describe("The repository to search for data in"),
|
|
3861
|
-
query: z.string().describe("The query to search for in the repository"),
|
|
3862
|
-
});
|
|
3863
|
-
export const githubSearchRepositoryOutputSchema = z.object({
|
|
3864
|
-
code: z
|
|
3865
|
-
.array(z.object({
|
|
3866
|
-
name: z.string().describe("The name of the file that had a match"),
|
|
3867
|
-
path: z.string().describe("The path of the file that had a match"),
|
|
3868
|
-
sha: z.string().describe("The SHA of the commit that had a match"),
|
|
3869
|
-
url: z.string().describe("The URL of the file that had a match"),
|
|
3870
|
-
score: z.number().describe("The similarity score of the match"),
|
|
3871
|
-
textMatches: z
|
|
3872
|
-
.array(z.object({
|
|
3873
|
-
object_url: z.string().describe("The URL of the object that had a match").optional(),
|
|
3874
|
-
object_type: z.string().describe("The type of the object that had a match").optional(),
|
|
3875
|
-
fragment: z.string().describe("The fragment of the text that had a match").optional(),
|
|
3876
|
-
matches: z
|
|
3877
|
-
.array(z.object({
|
|
3878
|
-
text: z.string().describe("The text that had a match").optional(),
|
|
3879
|
-
indices: z.array(z.number()).describe("The indices of the text that had a match").optional(),
|
|
3880
|
-
}))
|
|
3881
|
-
.describe("A list of matches that match the query"),
|
|
3882
|
-
}))
|
|
3883
|
-
.describe("A list of text matches that match the query"),
|
|
3884
|
-
}))
|
|
3885
|
-
.describe("A list of code results that match the query"),
|
|
3886
|
-
commits: z
|
|
3887
|
-
.array(z.object({
|
|
3888
|
-
sha: z.string().describe("The SHA of the commit that had a match"),
|
|
3889
|
-
url: z.string().describe("The URL of the commit that had a match"),
|
|
3890
|
-
commit: z
|
|
3891
|
-
.object({
|
|
3892
|
-
author: z.object({
|
|
3893
|
-
name: z.string().describe("The name of the author"),
|
|
3894
|
-
email: z.string().describe("The email of the author"),
|
|
3895
|
-
date: z.string().describe("The date of the commit"),
|
|
3896
|
-
}),
|
|
3897
|
-
message: z.string().describe("The message of the commit"),
|
|
3898
|
-
})
|
|
3899
|
-
.optional(),
|
|
3900
|
-
}))
|
|
3901
|
-
.describe("A list of commits that match the query"),
|
|
3902
|
-
issuesAndPullRequests: z
|
|
3903
|
-
.array(z.object({
|
|
3904
|
-
number: z.number().describe("The number of the issue or pull request").optional(),
|
|
3905
|
-
title: z.string().describe("The title of the issue or pull request"),
|
|
3906
|
-
html_url: z.string().describe("The URL of the issue or pull request").optional(),
|
|
3907
|
-
state: z.enum(["open", "closed"]).describe("The state of the issue or pull request"),
|
|
3908
|
-
isPullRequest: z.boolean().describe("Whether the issue or pull request is a pull request").optional(),
|
|
3909
|
-
body: z.string().describe("The body of the issue or pull request").optional(),
|
|
3910
|
-
score: z.number().describe("The score of the issue or pull request").optional(),
|
|
3911
|
-
files: z
|
|
3912
|
-
.array(z.object({
|
|
3913
|
-
filename: z.string().describe("The filename of the file"),
|
|
3914
|
-
status: z.string().describe("The status of the file"),
|
|
3915
|
-
patch: z.string().describe("The patch of the file").optional(),
|
|
3916
|
-
}))
|
|
3917
|
-
.describe("A list of files that match the query")
|
|
3918
|
-
.optional(),
|
|
3919
|
-
}))
|
|
3920
|
-
.describe("A list of issues and pull requests that match the query"),
|
|
3921
|
-
});
|
|
3922
3868
|
export const githubSearchOrganizationParamsSchema = z.object({
|
|
3923
3869
|
organization: z.string().describe("The organization to search for data in"),
|
|
3924
3870
|
query: z.string().describe("The query to search for within the organization"),
|
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, 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, 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";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -248,4 +248,14 @@ 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
|
+
},
|
|
251
261
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
function getConfluenceApi(baseUrl, username, apiToken) {
|
|
17
|
+
const api = axios_1.default.create({
|
|
18
|
+
baseURL: baseUrl,
|
|
19
|
+
headers: {
|
|
20
|
+
Accept: "application/json",
|
|
21
|
+
// Tokens are associated with a specific user.
|
|
22
|
+
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return api;
|
|
26
|
+
}
|
|
27
|
+
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
28
|
+
const { pageId, username, content, title } = params;
|
|
29
|
+
const { baseUrl, authToken } = authParams;
|
|
30
|
+
const api = getConfluenceApi(baseUrl, username, authToken);
|
|
31
|
+
// Get current version number
|
|
32
|
+
const response = yield api.get(`/api/v2/pages/${pageId}`);
|
|
33
|
+
const currVersion = response.data.version.number;
|
|
34
|
+
yield api.put(`/api/v2/pages/${pageId}`, {
|
|
35
|
+
id: pageId,
|
|
36
|
+
status: "current",
|
|
37
|
+
title,
|
|
38
|
+
body: {
|
|
39
|
+
representation: "storage",
|
|
40
|
+
value: content,
|
|
41
|
+
},
|
|
42
|
+
version: {
|
|
43
|
+
number: currVersion + 1,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
exports.default = confluenceUpdatePage;
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as add from "./add";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.add = void 0;
|
|
37
|
+
exports.add = __importStar(require("./add"));
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { WebClient } from "@slack/web-api";
|
|
11
|
+
import { getSlackChannels } from "./helpers.js";
|
|
12
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
13
|
+
const getChannelMembers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
+
if (!authParams.authToken) {
|
|
15
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
+
}
|
|
17
|
+
const client = new WebClient(authParams.authToken);
|
|
18
|
+
const { channelId: inputChannelId, channelName } = params;
|
|
19
|
+
if (!inputChannelId && !channelName) {
|
|
20
|
+
throw Error("Either channelId or channelName must be provided");
|
|
21
|
+
}
|
|
22
|
+
let channelId = inputChannelId;
|
|
23
|
+
if (!channelId) {
|
|
24
|
+
const allChannels = yield getSlackChannels(client);
|
|
25
|
+
const channel = allChannels.find(channel => channel.name === channelName);
|
|
26
|
+
if (!channel || !channel.id) {
|
|
27
|
+
throw Error(`Channel with name ${channelName} not found`);
|
|
28
|
+
}
|
|
29
|
+
channelId = channel.id;
|
|
30
|
+
}
|
|
31
|
+
const response = yield client.conversations.members({
|
|
32
|
+
channel: channelId,
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
throw Error(`Failed to fetch members from channel ${channelName}, channelId: ${channelId}`);
|
|
36
|
+
}
|
|
37
|
+
const memberIds = response.members || [];
|
|
38
|
+
// Fetch user information for each member
|
|
39
|
+
const members = yield Promise.all(memberIds.map((userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
var _a;
|
|
41
|
+
try {
|
|
42
|
+
const userInfo = yield client.users.info({ user: userId });
|
|
43
|
+
if (userInfo.ok && userInfo.user) {
|
|
44
|
+
const user = userInfo.user;
|
|
45
|
+
return {
|
|
46
|
+
id: user.id || userId,
|
|
47
|
+
name: user.real_name || user.name || "",
|
|
48
|
+
email: ((_a = user.profile) === null || _a === void 0 ? void 0 : _a.email) || "",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error(`Failed to fetch user info for ${userId}:`, error);
|
|
54
|
+
}
|
|
55
|
+
// Return basic info if user fetch fails
|
|
56
|
+
return {
|
|
57
|
+
id: userId,
|
|
58
|
+
name: "",
|
|
59
|
+
email: "",
|
|
60
|
+
};
|
|
61
|
+
})));
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
members,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
export default getChannelMembers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as listConversations from "./listConversations";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.listConversations = void 0;
|
|
37
|
+
exports.listConversations = __importStar(require("./listConversations"));
|
|
@@ -0,0 +1,41 @@
|
|
|
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 web_api_1 = require("@slack/web-api");
|
|
13
|
+
const helpers_1 = require("./helpers");
|
|
14
|
+
const slackListConversations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
|
15
|
+
const client = new web_api_1.WebClient(authParams.authToken);
|
|
16
|
+
try {
|
|
17
|
+
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
|
18
|
+
const filteredChannels = [];
|
|
19
|
+
for (const channel of allChannels) {
|
|
20
|
+
if (channel.name && channel.topic && channel.topic.value && channel.purpose && channel.purpose.value) {
|
|
21
|
+
const purpose = channel.purpose.value;
|
|
22
|
+
const topic = channel.topic.value;
|
|
23
|
+
const name = channel.name;
|
|
24
|
+
filteredChannels.push(Object.assign(Object.assign({}, channel), { purpose, topic, name }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
channels: filteredChannels,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error instanceof Error) {
|
|
33
|
+
// Enhance error with more context
|
|
34
|
+
throw new Error(`Failed to list Slack conversations: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
exports.default = slackListConversations;
|
package/package.json
CHANGED
|
@@ -1,131 +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 { 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;
|
|
@@ -1,41 +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 { 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;
|