@credal/actions 0.2.127 → 0.2.129

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 (39) hide show
  1. package/dist/actions/autogen/templates.js +909 -584
  2. package/dist/actions/autogen/types.d.ts +865 -938
  3. package/dist/actions/autogen/types.js +365 -212
  4. package/dist/actions/groups.d.ts +6 -0
  5. package/dist/actions/groups.js +261 -0
  6. package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
  7. package/dist/actions/providers/confluence/updatePage.js +47 -0
  8. package/dist/actions/providers/credal/callCopilot.d.ts +3 -0
  9. package/dist/actions/providers/credal/callCopilot.js +36 -0
  10. package/dist/actions/providers/firecrawl/scrapeUrl.js +11 -4
  11. package/dist/actions/providers/github/getFileContent.js +13 -5
  12. package/dist/actions/providers/github/listDirectory.js +12 -11
  13. package/dist/actions/providers/github/listPullRequests.js +58 -30
  14. package/dist/actions/providers/github/searchOrganization.d.ts +1 -1
  15. package/dist/actions/providers/github/searchOrganization.js +26 -4
  16. package/dist/actions/providers/gitlab/getFileContent.js +15 -6
  17. package/dist/actions/providers/gitlab/listDirectory.js +10 -6
  18. package/dist/actions/providers/gitlab/searchGroup.js +84 -55
  19. package/dist/actions/providers/google-oauth/getDriveFileContentById.js +10 -1
  20. package/dist/actions/providers/google-oauth/searchDriveByKeywordsAndGetFileContent.js +12 -4
  21. package/dist/actions/providers/google-oauth/searchDriveByQueryAndGetFileContent.js +2 -1
  22. package/dist/actions/providers/jamf/types.d.ts +8 -0
  23. package/dist/actions/providers/jamf/types.js +7 -0
  24. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +9 -7
  25. package/dist/actions/providers/jira/getJiraTicketDetails.js +8 -1
  26. package/dist/actions/providers/math/index.d.ts +1 -0
  27. package/dist/actions/providers/math/index.js +37 -0
  28. package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +10 -3
  29. package/dist/actions/providers/salesforce/searchSalesforceRecords.js +9 -7
  30. package/dist/actions/providers/slack/archiveChannel.d.ts +3 -0
  31. package/dist/actions/providers/slack/archiveChannel.js +42 -0
  32. package/dist/actions/providers/slack/index.d.ts +1 -0
  33. package/dist/actions/providers/slack/index.js +37 -0
  34. package/dist/actions/providers/slack/listConversations.d.ts +3 -0
  35. package/dist/actions/providers/slack/listConversations.js +41 -0
  36. package/dist/actions/providers/slackUser/searchSlack.js +81 -8
  37. package/package.json +1 -1
  38. package/dist/actions/providers/jira/updateServiceDeskRequest.d.ts +0 -3
  39. package/dist/actions/providers/jira/updateServiceDeskRequest.js +0 -72
@@ -0,0 +1,6 @@
1
+ import type { ActionTemplate } from "./parse.js";
2
+ export type ActionGroups = Record<string, {
3
+ description: string;
4
+ actions: ActionTemplate[];
5
+ }>;
6
+ export declare const ACTION_GROUPS: ActionGroups;
@@ -0,0 +1,261 @@
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
+ export const ACTION_GROUPS = {
3
+ GENERIC: {
4
+ description: "Generic utility actions",
5
+ actions: [genericFillTemplateDefinition],
6
+ },
7
+ ASANA: {
8
+ description: "Actions for interacting with Asana",
9
+ actions: [
10
+ asanaCommentTaskDefinition,
11
+ asanaCreateTaskDefinition,
12
+ asanaUpdateTaskDefinition,
13
+ asanaSearchTasksDefinition,
14
+ asanaListAsanaTasksByProjectDefinition,
15
+ asanaGetTasksDetailsDefinition,
16
+ ],
17
+ },
18
+ SLACK_LIST_CONVERSATIONS: {
19
+ description: "Actions for interacting with Slack",
20
+ actions: [
21
+ slackSendMessageDefinition,
22
+ slackGetChannelMessagesDefinition,
23
+ slackCreateChannelDefinition,
24
+ slackArchiveChannelDefinition,
25
+ ],
26
+ },
27
+ CONFLUENCE: {
28
+ description: "Action for interacting with Confluence",
29
+ actions: [confluenceOverwritePageDefinition, confluenceFetchPageContentDefinition],
30
+ },
31
+ MATH_ADD: {
32
+ description: "Action for adding two numbers",
33
+ actions: [mathAddDefinition],
34
+ },
35
+ GOOGLE_MAPS: {
36
+ description: "Action for interacting with Google Maps",
37
+ actions: [googlemapsValidateAddressDefinition, googlemapsNearbysearchRestaurantsDefinition],
38
+ },
39
+ GOOGLE_DRIVE: {
40
+ description: "Action for interacting with Google Drive",
41
+ actions: [
42
+ googleOauthCreateNewGoogleDocDefinition,
43
+ googleOauthUpdateDocDefinition,
44
+ googleOauthCreateSpreadsheetDefinition,
45
+ googleOauthUpdateSpreadsheetDefinition,
46
+ googleOauthCreatePresentationDefinition,
47
+ googleOauthUpdatePresentationDefinition,
48
+ googleOauthSearchDriveByKeywordsDefinition,
49
+ googleOauthSearchDriveByQueryDefinition,
50
+ googleOauthSearchDriveByQueryAndGetFileContentDefinition,
51
+ googleOauthGetDriveFileContentByIdDefinition,
52
+ ],
53
+ },
54
+ GOOGLE_CALENDAR: {
55
+ description: "Actions for interacting with Google Calendar",
56
+ actions: [
57
+ googleOauthScheduleCalendarMeetingDefinition,
58
+ googleOauthListCalendarsDefinition,
59
+ googleOauthListCalendarEventsDefinition,
60
+ googleOauthUpdateCalendarEventDefinition,
61
+ googleOauthDeleteCalendarEventDefinition,
62
+ ],
63
+ },
64
+ GMAIL: {
65
+ description: "Actions for interacting with Gmail",
66
+ actions: [googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition],
67
+ },
68
+ LINKEDIN_SHARE_POST: {
69
+ description: "Action for creating a share post url on linkedin",
70
+ actions: [linkedinCreateShareLinkedinPostUrlDefinition],
71
+ },
72
+ ZENDESK_ACTIONS: {
73
+ description: "Actions for interacting with Zendesk",
74
+ actions: [
75
+ zendeskCreateZendeskTicketDefinition,
76
+ zendeskListZendeskTicketsDefinition,
77
+ zendeskGetTicketDetailsDefinition,
78
+ zendeskUpdateTicketStatusDefinition,
79
+ zendeskAddCommentToTicketDefinition,
80
+ zendeskAssignTicketDefinition,
81
+ ],
82
+ },
83
+ BING_SEARCH: {
84
+ description: "Action for searching Bing",
85
+ actions: [bingGetTopNSearchResultUrlsDefinition],
86
+ },
87
+ MONGO_INSERT_DOC: {
88
+ description: "Action for inserting a document into a MongoDB collection",
89
+ actions: [mongoInsertMongoDocDefinition],
90
+ },
91
+ SNOWFLAKE_ACTIONS: {
92
+ description: "Action for getting content from a Snowflake table",
93
+ actions: [snowflakeGetRowByFieldValueDefinition, snowflakeRunSnowflakeQueryDefinition],
94
+ },
95
+ JIRA_ACTIONS: {
96
+ description: "Action for interacting with Jira tickets",
97
+ actions: [
98
+ jiraAssignJiraTicketDefinition,
99
+ jiraCreateJiraTicketDefinition,
100
+ jiraCommentJiraTicketDefinition,
101
+ jiraGetJiraTicketDetailsDefinition,
102
+ jiraGetJiraTicketHistoryDefinition,
103
+ jiraUpdateJiraTicketDetailsDefinition,
104
+ jiraUpdateJiraTicketStatusDefinition,
105
+ jiraGetJiraIssuesByQueryDefinition,
106
+ jiraGetServiceDesksDefinition,
107
+ jiraCreateServiceDeskRequestDefinition,
108
+ ],
109
+ },
110
+ JIRA_ORG_ACTIONS: {
111
+ description: "Action for interacting with Jira tickets",
112
+ actions: [
113
+ jiraOrgAssignJiraTicketDefinition,
114
+ jiraOrgCreateJiraTicketDefinition,
115
+ jiraOrgCommentJiraTicketDefinition,
116
+ jiraOrgGetJiraTicketDetailsDefinition,
117
+ jiraOrgGetJiraTicketHistoryDefinition,
118
+ jiraOrgUpdateJiraTicketDetailsDefinition,
119
+ jiraOrgUpdateJiraTicketStatusDefinition,
120
+ jiraOrgGetJiraIssuesByQueryDefinition,
121
+ ],
122
+ },
123
+ OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
124
+ description: "Action for getting the latitude and longitude of a location",
125
+ actions: [openstreetmapGetLatitudeLongitudeFromLocationDefinition],
126
+ },
127
+ NWS_GET_FORECAST_FOR_LOCATION: {
128
+ description: "Action for getting the weather forecast for a location",
129
+ actions: [nwsGetForecastForLocationDefinition],
130
+ },
131
+ FIRECRAWL: {
132
+ description: "Actions for interacting with Firecrawl",
133
+ actions: [
134
+ firecrawlScrapeUrlDefinition,
135
+ firecrawlScrapeTweetDataWithNitterDefinition,
136
+ firecrawlDeepResearchDefinition,
137
+ ],
138
+ },
139
+ RESEND: {
140
+ description: "Action for sending an email",
141
+ actions: [resendSendEmailDefinition],
142
+ },
143
+ X: {
144
+ description: "Actions for interacting with X(formerly twitter)",
145
+ actions: [xCreateShareXPostUrlDefinition],
146
+ },
147
+ GONG: {
148
+ description: "Actions for interacting with Gong",
149
+ actions: [gongGetGongTranscriptsDefinition],
150
+ },
151
+ FINNHUB: {
152
+ description: "Action for interacting with Finnhub for stock market data",
153
+ actions: [finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition],
154
+ },
155
+ JAMF: {
156
+ description: "Actions for interacting with Jamf",
157
+ actions: [
158
+ jamfGetJamfComputerInventoryDefinition,
159
+ jamfGetJamfFileVaultRecoveryKeyDefinition,
160
+ jamfGetJamfUserComputerIdDefinition,
161
+ jamfLockJamfComputerByIdDefinition,
162
+ ],
163
+ },
164
+ LOOKER: {
165
+ description: "Actions for interacting with Looker",
166
+ actions: [lookerEnableUserByEmailDefinition],
167
+ },
168
+ SALESFORCE: {
169
+ description: "Actions for interacting with Salesforce",
170
+ actions: [
171
+ salesforceUpdateRecordDefinition,
172
+ salesforceCreateRecordDefinition,
173
+ salesforceCreateCaseDefinition,
174
+ salesforceGenerateSalesReportDefinition,
175
+ salesforceGetRecordDefinition,
176
+ salesforceGetSalesforceRecordsByQueryDefinition,
177
+ salesforceFetchSalesforceSchemaByObjectDefinition,
178
+ ],
179
+ },
180
+ MICROSOFT: {
181
+ description: "Actions for interacting with Microsoft 365",
182
+ actions: [
183
+ microsoftMessageTeamsChatDefinition,
184
+ microsoftMessageTeamsChannelDefinition,
185
+ microsoftUpdateSpreadsheetDefinition,
186
+ microsoftUpdateDocumentDefinition,
187
+ microsoftCreateDocumentDefinition,
188
+ microsoftGetDocumentDefinition,
189
+ ],
190
+ },
191
+ KANDJI: {
192
+ description: "Actions for interacting with Kandji",
193
+ actions: [kandjiGetFVRecoveryKeyForDeviceDefinition],
194
+ },
195
+ GITHUB: {
196
+ description: "Actions for interacting with GitHub",
197
+ actions: [
198
+ githubCreateOrUpdateFileDefinition,
199
+ githubCreateBranchDefinition,
200
+ githubCreatePullRequestDefinition,
201
+ githubListPullRequestsDefinition,
202
+ githubGetFileContentDefinition,
203
+ githubListDirectoryDefinition,
204
+ ],
205
+ },
206
+ ASHBY: {
207
+ description: "Actions for interacting with Ashby",
208
+ actions: [
209
+ ashbyCreateNoteDefinition,
210
+ ashbyGetCandidateInfoDefinition,
211
+ ashbyListCandidatesDefinition,
212
+ ashbyListCandidateNotesDefinition,
213
+ ashbySearchCandidatesDefinition,
214
+ ashbyCreateCandidateDefinition,
215
+ ashbyUpdateCandidateDefinition,
216
+ ashbyAddCandidateToProjectDefinition,
217
+ ],
218
+ },
219
+ NOTION: {
220
+ description: "Actions for interacting with Notion",
221
+ actions: [notionSearchByTitleDefinition],
222
+ },
223
+ GOOGLE_GROUPS: {
224
+ description: "Google Workspace Groups management actions",
225
+ actions: [
226
+ googleOauthListGroupsDefinition,
227
+ googleOauthGetGroupDefinition,
228
+ googleOauthListGroupMembersDefinition,
229
+ googleOauthHasGroupMemberDefinition,
230
+ googleOauthAddGroupMemberDefinition,
231
+ googleOauthDeleteGroupMemberDefinition,
232
+ ],
233
+ },
234
+ OKTA: {
235
+ description: "Actions for interacting with Okta",
236
+ actions: [
237
+ oktaListOktaUsersDefinition,
238
+ oktaGetOktaUserDefinition,
239
+ oktaListOktaUserGroupsDefinition,
240
+ oktaListOktaGroupsDefinition,
241
+ oktaGetOktaGroupDefinition,
242
+ oktaListOktaGroupMembersDefinition,
243
+ oktaRemoveUserFromGroupDefinition,
244
+ oktaAddUserToGroupDefinition,
245
+ oktaResetPasswordDefinition,
246
+ oktaResetMFADefinition,
247
+ oktaListMFADefinition,
248
+ oktaTriggerOktaWorkflowDefinition,
249
+ ],
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
+ };
@@ -0,0 +1,3 @@
1
+ import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
+ declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
+ export default confluenceUpdatePage;
@@ -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,3 @@
1
+ import type { credalCallCopilotFunction } from "../../autogen/types";
2
+ declare const callCopilot: credalCallCopilotFunction;
3
+ export default callCopilot;
@@ -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;
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import FirecrawlApp from "@mendable/firecrawl-js";
11
- import { firecrawlScrapeUrlOutputSchema } from "../../autogen/types.js";
12
11
  const scrapeUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
+ var _b, _c;
13
13
  const firecrawl = new FirecrawlApp({
14
14
  apiKey: authParams.apiKey,
15
15
  });
@@ -62,8 +62,15 @@ const scrapeUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
62
62
  // Default to markdown if no formats specified
63
63
  content = result.markdown || "";
64
64
  }
65
- return firecrawlScrapeUrlOutputSchema.parse({
66
- content,
67
- });
65
+ return {
66
+ success: true,
67
+ results: [
68
+ {
69
+ name: (_c = (_b = result.metadata) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : "Untitled",
70
+ url: params.url,
71
+ contents: content,
72
+ },
73
+ ],
74
+ };
68
75
  });
69
76
  export default scrapeUrl;
@@ -13,7 +13,7 @@ import { getOctokit } from "./utils.js";
13
13
  * Get file content
14
14
  */
15
15
  const getFileContent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
- var _b;
16
+ var _b, _c;
17
17
  if (!authParams.authToken) {
18
18
  return {
19
19
  success: false,
@@ -48,10 +48,18 @@ const getFileContent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
48
48
  const content = Buffer.from(data.content, data.encoding).toString("utf-8");
49
49
  return {
50
50
  success: true,
51
- content,
52
- size: data.size,
53
- name: data.name,
54
- htmlUrl: (_b = data.html_url) !== null && _b !== void 0 ? _b : data.url,
51
+ results: [
52
+ {
53
+ name: data.name,
54
+ url: (_b = data.html_url) !== null && _b !== void 0 ? _b : data.url,
55
+ contents: {
56
+ content,
57
+ size: data.size,
58
+ name: data.name,
59
+ htmlUrl: (_c = data.html_url) !== null && _c !== void 0 ? _c : data.url,
60
+ },
61
+ },
62
+ ],
55
63
  };
56
64
  });
57
65
  export default getFileContent;
@@ -36,19 +36,20 @@ const listDirectory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
36
36
  error: "Content is not a directory",
37
37
  };
38
38
  }
39
- const content = data.map(item => {
40
- var _a;
41
- return {
42
- name: item.name,
43
- path: item.path,
44
- type: item.type,
45
- size: item.size,
46
- htmlUrl: (_a = item.html_url) !== null && _a !== void 0 ? _a : item.url,
47
- };
48
- });
49
39
  return {
50
40
  success: true,
51
- content,
41
+ results: data.map(item => {
42
+ var _a;
43
+ return ({
44
+ name: item.name,
45
+ url: (_a = item.html_url) !== null && _a !== void 0 ? _a : item.url,
46
+ contents: {
47
+ path: item.path,
48
+ type: item.type,
49
+ size: item.size,
50
+ },
51
+ });
52
+ }),
52
53
  };
53
54
  });
54
55
  export default listDirectory;
@@ -13,39 +13,67 @@ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
13
13
  const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { authToken } = authParams;
15
15
  if (!authToken) {
16
- throw new Error(MISSING_AUTH_TOKEN);
16
+ return githubListPullRequestsOutputSchema.parse({
17
+ success: false,
18
+ error: MISSING_AUTH_TOKEN,
19
+ });
17
20
  }
18
- const { repositoryName, repositoryOwner, state } = params;
19
- const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls`;
20
- const allPulls = [];
21
- let page = 1;
22
- const perPage = 100;
23
- while (true) {
24
- const response = yield axios.get(url, {
25
- headers: {
26
- Authorization: `Bearer ${authToken}`,
27
- Accept: "application/vnd.github+json",
28
- "X-GitHub-Api-Version": "2022-11-28",
29
- },
30
- params: {
31
- state: state !== null && state !== void 0 ? state : "all",
32
- sort: "created",
33
- direction: "desc",
34
- per_page: perPage,
35
- page,
21
+ try {
22
+ const { repositoryName, repositoryOwner, state } = params;
23
+ const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls`;
24
+ const allPulls = [];
25
+ let page = 1;
26
+ const perPage = 100;
27
+ while (true) {
28
+ const response = yield axios.get(url, {
29
+ headers: {
30
+ Authorization: `Bearer ${authToken}`,
31
+ Accept: "application/vnd.github+json",
32
+ "X-GitHub-Api-Version": "2022-11-28",
33
+ },
34
+ params: {
35
+ state: state !== null && state !== void 0 ? state : "all",
36
+ sort: "created",
37
+ direction: "desc",
38
+ per_page: perPage,
39
+ page,
40
+ },
41
+ });
42
+ const pulls = response.data;
43
+ if (pulls.length === 0)
44
+ break;
45
+ allPulls.push(...pulls);
46
+ // Stop if we got fewer than requested (last page)
47
+ if (pulls.length < perPage)
48
+ break;
49
+ page++;
50
+ }
51
+ const results = allPulls.map(pull => ({
52
+ name: pull.title,
53
+ url: pull.html_url,
54
+ contents: {
55
+ number: pull.number,
56
+ title: pull.title,
57
+ state: pull.state,
58
+ url: pull.html_url,
59
+ createdAt: pull.created_at,
60
+ updatedAt: pull.updated_at,
61
+ user: {
62
+ login: pull.user.login,
63
+ },
64
+ description: pull.body || "",
36
65
  },
66
+ }));
67
+ return githubListPullRequestsOutputSchema.parse({
68
+ success: true,
69
+ results,
70
+ });
71
+ }
72
+ catch (error) {
73
+ return githubListPullRequestsOutputSchema.parse({
74
+ success: false,
75
+ error: error instanceof Error ? error.message : "An unknown error occurred",
37
76
  });
38
- const pulls = response.data;
39
- if (pulls.length === 0)
40
- break;
41
- allPulls.push(...pulls);
42
- // Stop if the rest are older than one year
43
- if (pulls.length < perPage)
44
- break;
45
- page++;
46
77
  }
47
- return githubListPullRequestsOutputSchema.parse({
48
- pullRequests: allPulls,
49
- });
50
78
  });
51
79
  export default listPullRequests;
@@ -1,3 +1,3 @@
1
- import type { githubSearchOrganizationFunction } from "../../autogen/types.js";
1
+ import { type githubSearchOrganizationFunction } from "../../autogen/types.js";
2
2
  declare const searchOrganization: githubSearchOrganizationFunction;
3
3
  export default searchOrganization;
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { githubSearchOrganizationOutputSchema, } from "../../autogen/types.js";
10
11
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
11
12
  import { getOctokit } from "./utils.js";
12
13
  // Limits on the number of results to return
@@ -19,7 +20,10 @@ const MAX_PATCH_LINES = 20;
19
20
  const MAX_FRAGMENT_LINES = 20;
20
21
  const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
21
22
  if (!authParams.authToken) {
22
- throw new Error(MISSING_AUTH_TOKEN);
23
+ return githubSearchOrganizationOutputSchema.parse({
24
+ success: false,
25
+ error: MISSING_AUTH_TOKEN,
26
+ });
23
27
  }
24
28
  const octokit = yield getOctokit(authParams.authToken);
25
29
  const { organization, query, repository } = params;
@@ -141,9 +145,27 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
141
145
  };
142
146
  });
143
147
  return {
144
- code: codeResults,
145
- commits: enrichedCommits,
146
- issuesAndPullRequests: issuesAndPRs,
148
+ success: true,
149
+ results: [
150
+ ...codeResults.map(result => ({
151
+ type: "code",
152
+ name: result.name,
153
+ url: result.url,
154
+ content: result,
155
+ })),
156
+ ...enrichedCommits.map(result => ({
157
+ type: "commit",
158
+ name: result.sha,
159
+ url: result.url,
160
+ content: result,
161
+ })),
162
+ ...issuesAndPRs.map(result => ({
163
+ type: "issueOrPullRequest",
164
+ name: result.title,
165
+ url: result.html_url,
166
+ content: result,
167
+ })),
168
+ ],
147
169
  };
148
170
  });
149
171
  export default searchOrganization;
@@ -36,18 +36,27 @@ const getFileContent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
36
36
  const { project_id, path, ref = "HEAD" } = params;
37
37
  // The file path must be URL-encoded per GitLab API docs
38
38
  const filePath = encodeURIComponent(path);
39
- const url = `${gitlabBaseUrl}/api/v4/projects/${project_id}/repository/files/${filePath}?ref=${encodeURIComponent(ref)}`;
40
- const data = yield gitlabFetch(url, authToken);
39
+ const fetchUrl = `${gitlabBaseUrl}/api/v4/projects/${project_id}/repository/files/${filePath}?ref=${encodeURIComponent(ref)}`;
40
+ const data = yield gitlabFetch(fetchUrl, authToken);
41
41
  if (data.encoding !== "base64" || typeof data.content !== "string") {
42
42
  return { success: false, error: `Unexpected response: ${JSON.stringify(data)}` };
43
43
  }
44
44
  const content = Buffer.from(data.content, "base64").toString("utf-8");
45
+ const url = data.web_url || `${gitlabBaseUrl}/${project_id}/-/blob/${ref}/${path}`;
45
46
  return {
46
47
  success: true,
47
- content,
48
- size: Buffer.byteLength(content),
49
- name: data.file_name,
50
- htmlUrl: data.web_url || `${gitlabBaseUrl}/${project_id}/-/blob/${ref}/${path}`,
48
+ results: [
49
+ {
50
+ name: data.file_name,
51
+ url,
52
+ contents: {
53
+ content,
54
+ size: Buffer.byteLength(content),
55
+ name: data.file_name,
56
+ htmlUrl: url,
57
+ },
58
+ },
59
+ ],
51
60
  };
52
61
  });
53
62
  export default getFileContent;