@credal/actions 0.2.141 → 0.2.142

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.
@@ -0,0 +1,3 @@
1
+ import type { jiraUpdateServiceDeskRequestFunction } from "../../autogen/types.js";
2
+ declare const updateServiceDeskRequest: jiraUpdateServiceDeskRequestFunction;
3
+ export default updateServiceDeskRequest;
@@ -0,0 +1,72 @@
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
+ const updateServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
+ const { issueId, requestTypeId, summary, description, priority, customFields } = params;
13
+ const { authToken, cloudId, baseUrl } = authParams;
14
+ if (!cloudId || !authToken) {
15
+ throw new Error("Valid Cloud ID and auth token are required to update service desk request");
16
+ }
17
+ // Use the regular Jira API for updating service desk requests as they are still Jira issues
18
+ const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
19
+ const formattedDescription = description
20
+ ? {
21
+ type: "doc",
22
+ version: 1,
23
+ content: [
24
+ {
25
+ type: "paragraph",
26
+ content: [
27
+ {
28
+ type: "text",
29
+ text: description,
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ }
35
+ : undefined;
36
+ const payload = {
37
+ fields: Object.assign(Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (priority && { priority: { name: priority } })), (customFields && Object.assign({}, customFields))),
38
+ };
39
+ try {
40
+ yield axiosClient.put(apiUrl, payload, {
41
+ headers: {
42
+ Authorization: `Bearer ${authToken}`,
43
+ Accept: "application/json",
44
+ "Content-Type": "application/json",
45
+ },
46
+ });
47
+ // Get the updated issue details to return current status and web link
48
+ const getResponse = yield axiosClient.get(apiUrl, {
49
+ headers: {
50
+ Authorization: `Bearer ${authToken}`,
51
+ Accept: "application/json",
52
+ },
53
+ });
54
+ const issueKey = getResponse.data.key;
55
+ const currentStatus = getResponse.data.fields.status.name;
56
+ const webLink = `${baseUrl}/browse/${issueKey}`;
57
+ return {
58
+ success: true,
59
+ issueKey,
60
+ webLink,
61
+ currentStatus,
62
+ };
63
+ }
64
+ catch (error) {
65
+ console.error("Error updating service desk request:", error);
66
+ return {
67
+ success: false,
68
+ error: error instanceof Error ? error.message : "Unknown error",
69
+ };
70
+ }
71
+ });
72
+ export default updateServiceDeskRequest;
@@ -47,11 +47,22 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
47
47
  success: true,
48
48
  results:
49
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
- recordsWithUrl.map((record) => ({
51
- name: record.Name,
52
- url: record.webUrl,
53
- content: record,
54
- })) || [],
50
+ recordsWithUrl.map((record) => {
51
+ // Try common name fields in order of preference, using only what's available
52
+ const displayName = record.Name ||
53
+ record.Title ||
54
+ record.Subject ||
55
+ record.CaseNumber ||
56
+ record.AccountName ||
57
+ record.ContactName ||
58
+ record.Id ||
59
+ record.webUrl;
60
+ return {
61
+ name: displayName,
62
+ url: record.webUrl,
63
+ content: record,
64
+ };
65
+ }) || [],
55
66
  };
56
67
  }
57
68
  catch (error) {
@@ -47,7 +47,16 @@ const searchSalesforceRecords = (_a) => __awaiter(void 0, [_a], void 0, function
47
47
  results: response.data.searchRecords.map((record) => {
48
48
  const recordId = record.Id;
49
49
  const webUrl = recordId ? `${baseUrl}/lightning/r/${recordId}/view` : undefined;
50
- return { name: record.Name, url: webUrl, contents: record };
50
+ // Try common name fields in order of preference, using only what's available
51
+ const displayName = record.Name ||
52
+ record.Title ||
53
+ record.Subject ||
54
+ record.CaseNumber ||
55
+ record.AccountName ||
56
+ record.ContactName ||
57
+ record.Id ||
58
+ webUrl;
59
+ return { name: displayName, url: webUrl, contents: record };
51
60
  }),
52
61
  };
53
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.141",
3
+ "version": "0.2.142",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,
@@ -1,6 +0,0 @@
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;
@@ -1,261 +0,0 @@
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
- };
@@ -1,3 +0,0 @@
1
- import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
- declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
- export default confluenceUpdatePage;
@@ -1,47 +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
- 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;
@@ -1,3 +0,0 @@
1
- import type { credalCallCopilotFunction } from "../../autogen/types";
2
- declare const callCopilot: credalCallCopilotFunction;
3
- export default callCopilot;
@@ -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,8 +0,0 @@
1
- import { z } from "zod";
2
- export declare const TokenResponseSchema: z.ZodObject<{
3
- token: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- token: string;
6
- }, {
7
- token: string;
8
- }>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenResponseSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.TokenResponseSchema = zod_1.z.object({
6
- token: zod_1.z.string(),
7
- });
@@ -1 +0,0 @@
1
- export * as add from "./add";
@@ -1,37 +0,0 @@
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"));
@@ -1,3 +0,0 @@
1
- import type { slackArchiveChannelFunction } from "../../autogen/types.js";
2
- declare const archiveChannel: slackArchiveChannelFunction;
3
- export default archiveChannel;
@@ -1,42 +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 { WebClient } from "@slack/web-api";
11
- import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- import { getSlackChannels } from "./helpers.js";
13
- const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
- if (!authParams.authToken) {
15
- throw new Error(MISSING_AUTH_TOKEN);
16
- }
17
- try {
18
- const client = new WebClient(authParams.authToken);
19
- const { channelName } = params;
20
- const allChannels = yield getSlackChannels(client);
21
- const channel = allChannels.find(channel => channel.name == channelName);
22
- if (!channel || !channel.id) {
23
- throw Error(`Channel with name ${channelName} not found`);
24
- }
25
- yield client.conversations.join({ channel: channel.id });
26
- const result = yield client.conversations.archive({ channel: channel.id });
27
- if (!result.ok) {
28
- return {
29
- success: false,
30
- error: result.error || "Unknown error archiving channel",
31
- };
32
- }
33
- return { success: true };
34
- }
35
- catch (error) {
36
- return {
37
- success: false,
38
- error: error instanceof Error ? error.message : "Unknown error archiving channel",
39
- };
40
- }
41
- });
42
- export default archiveChannel;
@@ -1 +0,0 @@
1
- export * as listConversations from "./listConversations";
@@ -1,37 +0,0 @@
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"));
@@ -1,3 +0,0 @@
1
- import type { slackListConversationsFunction } from "../../autogen/types";
2
- declare const slackListConversations: slackListConversationsFunction;
3
- export default slackListConversations;
@@ -1,41 +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 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;