@credal/actions 0.2.5 → 0.2.7
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 +1 -1
- package/dist/actions/actionMapper.js +105 -105
- package/dist/actions/autogen/templates.d.ts +1 -1
- package/dist/actions/groups.d.ts +1 -1
- package/dist/actions/groups.js +1 -1
- package/dist/actions/invoke.js +1 -1
- package/dist/actions/parse.js +1 -1
- package/dist/actions/providers/asana/createAsanaTask.js +1 -1
- package/dist/actions/providers/asana/updateAsanaTask.js +1 -1
- package/dist/actions/providers/bing/getTopNSearchResultUrls.d.ts +1 -1
- package/dist/actions/providers/bing/getTopNSearchResultUrls.js +2 -2
- package/dist/actions/providers/confluence/fetchPageContent.d.ts +1 -1
- package/dist/actions/providers/confluence/fetchPageContent.js +3 -3
- package/dist/actions/providers/confluence/overwritePage.d.ts +1 -1
- package/dist/actions/providers/confluence/overwritePage.js +3 -3
- package/dist/actions/providers/finnhub/getBasicFinancials.d.ts +1 -1
- package/dist/actions/providers/finnhub/getBasicFinancials.js +2 -2
- package/dist/actions/providers/finnhub/symbolLookup.d.ts +1 -1
- package/dist/actions/providers/finnhub/symbolLookup.js +2 -2
- package/dist/actions/providers/firecrawl/deepResearch.d.ts +1 -1
- package/dist/actions/providers/firecrawl/deepResearch.js +1 -1
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.d.ts +1 -1
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +1 -1
- package/dist/actions/providers/firecrawl/scrapeUrl.d.ts +1 -1
- package/dist/actions/providers/firecrawl/scrapeUrl.js +1 -1
- package/dist/actions/providers/github/createBranch.d.ts +1 -1
- package/dist/actions/providers/github/createBranch.js +1 -1
- package/dist/actions/providers/github/createOrUpdateFile.d.ts +1 -1
- package/dist/actions/providers/github/createOrUpdateFile.js +1 -1
- package/dist/actions/providers/github/createPullRequest.d.ts +1 -1
- package/dist/actions/providers/github/createPullRequest.js +1 -1
- package/dist/actions/providers/github/listPullRequests.d.ts +1 -1
- package/dist/actions/providers/github/listPullRequests.js +2 -2
- package/dist/actions/providers/gong/getGongTranscripts.d.ts +1 -1
- package/dist/actions/providers/gong/getGongTranscripts.js +1 -1
- package/dist/actions/providers/googlemail/listGmailThreads.js +1 -1
- package/dist/actions/providers/googlemail/searchGmailMessages.js +1 -1
- package/dist/actions/providers/jira/assignJiraTicket.js +1 -1
- package/dist/actions/providers/jira/createJiraTicket.js +1 -1
- package/dist/actions/providers/math/add.d.ts +1 -1
- package/dist/actions/providers/microsoft/createDocument.js +1 -1
- package/dist/actions/providers/microsoft/getDocument.js +1 -1
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +1 -1
- package/dist/actions/providers/microsoft/messageTeamsChat.js +1 -1
- package/dist/actions/providers/microsoft/updateDocument.js +1 -1
- package/dist/actions/providers/microsoft/updateSpreadsheet.js +1 -1
- package/dist/actions/providers/slack/getChannelMessages.js +1 -1
- package/dist/actions/providers/slack/sendMessage.js +1 -1
- package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +3 -3
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +1 -1
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +1 -1
- package/dist/app.d.ts +2 -2
- package/dist/app.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/server.d.ts +2 -0
- package/dist/server.js +8 -0
- package/package.json +1 -1
- package/dist/actions/autogen/definitions.d.ts +0 -5
- package/dist/actions/autogen/definitions.js +0 -132
- package/dist/actions/definitions.js +0 -35
- package/dist/actions/invokeMapper.d.ts +0 -9
- package/dist/actions/invokeMapper.js +0 -33
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -43
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +0 -3
- package/dist/actions/providers/googlemaps/nearbysearch.js +0 -96
- package/dist/actions/providers/jira/createTicket.d.ts +0 -3
- package/dist/actions/providers/jira/createTicket.js +0 -34
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- package/dist/actions/providers/slack/listConversations.js +0 -41
- package/dist/actions/providers/slack/list_conversations.d.ts +0 -3
- package/dist/actions/providers/slack/list_conversations.js +0 -60
- package/dist/actions/providers/slack/summarizeChannel.d.ts +0 -3
- package/dist/actions/providers/slack/summarizeChannel.js +0 -51
- package/dist/actions/schema.js +0 -6
- package/dist/actions/types.js +0 -2
- package/dist/main.js +0 -11
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
};
|
10
10
|
import { axiosClient } from "../../util/axiosClient";
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
12
|
-
import { getEmailContent } from "../google-oauth/utils/decodeMessage";
|
12
|
+
import { getEmailContent } from "../google-oauth/utils/decodeMessage.js";
|
13
13
|
const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
if (!authParams.authToken) {
|
15
15
|
return { success: false, error: MISSING_AUTH_TOKEN, messages: [] };
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import axios from "axios";
|
11
|
-
import { getUserAccountIdFromEmail } from "./utils";
|
11
|
+
import { getUserAccountIdFromEmail } from "./utils.js";
|
12
12
|
const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
14
14
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { axiosClient } from "../../util/axiosClient";
|
11
|
-
import { getUserAccountIdFromEmail } from "./utils";
|
11
|
+
import { getUserAccountIdFromEmail } from "./utils.js";
|
12
12
|
const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
14
14
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { microsoftCreateDocumentDefinition } from "../../autogen/templates";
|
11
|
-
import { getGraphClient, validateAndSanitizeFileName } from "./utils";
|
11
|
+
import { getGraphClient, validateAndSanitizeFileName } from "./utils.js";
|
12
12
|
const createDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { folderId, name, content, siteId } = params;
|
14
14
|
let client = undefined;
|
@@ -7,7 +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 { getGraphClient } from "./utils";
|
10
|
+
import { getGraphClient } from "./utils.js";
|
11
11
|
const getDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
12
12
|
const { siteId, documentId } = params;
|
13
13
|
let client;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { microsoftMessageTeamsChannelDefinition } from "../../autogen/templates";
|
11
|
-
import { getGraphClient } from "./utils";
|
11
|
+
import { getGraphClient } from "./utils.js";
|
12
12
|
const sendMessageToTeamsChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { channelId, teamId, message } = params;
|
14
14
|
let client = undefined;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { microsoftMessageTeamsChatDefinition } from "../../autogen/templates";
|
11
|
-
import { getGraphClient } from "./utils";
|
11
|
+
import { getGraphClient } from "./utils.js";
|
12
12
|
const sendMessageToTeamsChat = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { chatId, message } = params;
|
14
14
|
let client = undefined;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { microsoftUpdateDocumentDefinition } from "../../autogen/templates";
|
11
|
-
import { getGraphClient } from "./utils";
|
11
|
+
import { getGraphClient } from "./utils.js";
|
12
12
|
const updateDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { documentId, content, siteId } = params;
|
14
14
|
let client = undefined;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { microsoftUpdateSpreadsheetDefinition } from "../../autogen/templates";
|
11
|
-
import { getGraphClient } from "./utils";
|
11
|
+
import { getGraphClient } from "./utils.js";
|
12
12
|
const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
13
13
|
const { spreadsheetId, range, values, siteId } = params; // Added siteId to destructured params
|
14
14
|
let client = undefined;
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { WebClient } from "@slack/web-api";
|
11
|
-
import { getSlackChannels } from "./helpers";
|
11
|
+
import { getSlackChannels } from "./helpers.js";
|
12
12
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
13
13
|
const getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
if (!authParams.authToken) {
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
};
|
10
10
|
import { WebClient } from "@slack/web-api";
|
11
11
|
import { slackSendMessageOutputSchema, } from "../../autogen/types";
|
12
|
-
import { getSlackChannels } from "./helpers";
|
12
|
+
import { getSlackChannels } from "./helpers.js";
|
13
13
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
14
|
const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
15
|
if (!authParams.authToken) {
|
@@ -7,7 +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
|
10
|
+
import { createConnection } from "snowflake-sdk";
|
11
11
|
import * as forge from "node-forge";
|
12
12
|
const getPrivateKeyCorrectFormat = (privateKey) => {
|
13
13
|
try {
|
@@ -26,7 +26,7 @@ export function getSnowflakeConnection(snowflakeData, authParams) {
|
|
26
26
|
const { account, username, warehouse, database } = snowflakeData;
|
27
27
|
if (authToken) {
|
28
28
|
// Always try to use Nango-Snowflake OAuth (unused for now)
|
29
|
-
return
|
29
|
+
return createConnection({
|
30
30
|
account: account,
|
31
31
|
username: username,
|
32
32
|
authenticator: "OAUTH",
|
@@ -38,7 +38,7 @@ export function getSnowflakeConnection(snowflakeData, authParams) {
|
|
38
38
|
}
|
39
39
|
else if (apiKey) {
|
40
40
|
const privateKeyCorrectFormatString = getPrivateKeyCorrectFormat(apiKey);
|
41
|
-
return
|
41
|
+
return createConnection({
|
42
42
|
account: account,
|
43
43
|
username: username,
|
44
44
|
privateKey: privateKeyCorrectFormatString,
|
@@ -7,7 +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 { getSnowflakeConnection } from "./auth/getSnowflakeConnection";
|
10
|
+
import { getSnowflakeConnection } from "./auth/getSnowflakeConnection.js";
|
11
11
|
const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
12
12
|
const { databaseName, tableName, fieldName, warehouse, fieldValue, accountName } = params;
|
13
13
|
if (!accountName || !databaseName || !warehouse) {
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import snowflake from "snowflake-sdk";
|
11
|
-
import { connectToSnowflakeAndWarehouse, getSnowflakeConnection } from "./auth/getSnowflakeConnection";
|
11
|
+
import { connectToSnowflakeAndWarehouse, getSnowflakeConnection } from "./auth/getSnowflakeConnection.js";
|
12
12
|
import { formatDataForCodeInterpreter } from "../../util/formatDataForCodeInterpreter";
|
13
13
|
snowflake.configure({ logLevel: "ERROR" });
|
14
14
|
const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
package/dist/app.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { ActionTemplate } from "./actions/parse";
|
2
|
-
import type { AuthParamsType } from "./actions/autogen/types";
|
1
|
+
import type { ActionTemplate } from "./actions/parse.js";
|
2
|
+
import type { AuthParamsType } from "./actions/autogen/types.js";
|
3
3
|
export declare function runAction(name: string, provider: string, authentication: AuthParamsType, parameters: Record<string, any>): Promise<any>;
|
4
4
|
/**
|
5
5
|
* HELPER FUNCTIONS
|
package/dist/app.js
CHANGED
@@ -7,8 +7,8 @@ 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 * as templates from "./actions/autogen/templates";
|
11
|
-
import { invokeAction } from "./actions/invoke";
|
10
|
+
import * as templates from "./actions/autogen/templates.js";
|
11
|
+
import { invokeAction } from "./actions/invoke.js";
|
12
12
|
export function runAction(name, provider, authentication,
|
13
13
|
// eslint-disable-next-line
|
14
14
|
parameters) {
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export { runAction, getActions } from "./app.js";
|
2
|
-
export { ActionMapper } from "./actions/actionMapper";
|
3
|
-
export { ActionTemplate } from "./actions/parse";
|
4
|
-
export * from "./actions/autogen/templates";
|
5
|
-
export * from "./actions/autogen/types";
|
2
|
+
export { ActionMapper } from "./actions/actionMapper.js";
|
3
|
+
export { ActionTemplate } from "./actions/parse.js";
|
4
|
+
export * from "./actions/autogen/templates.js";
|
5
|
+
export * from "./actions/autogen/types.js";
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Do not use "@/" in this file because it won't generate declaration files properly
|
2
2
|
export { runAction, getActions } from "./app.js";
|
3
|
-
export { ActionMapper } from "./actions/actionMapper";
|
4
|
-
export * from "./actions/autogen/templates";
|
5
|
-
export * from "./actions/autogen/types";
|
3
|
+
export { ActionMapper } from "./actions/actionMapper.js";
|
4
|
+
export * from "./actions/autogen/templates.js";
|
5
|
+
export * from "./actions/autogen/types.js";
|
package/dist/server.d.ts
ADDED
package/dist/server.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ActionMapper = exports.getActions = exports.runAction = void 0;
|
4
|
+
var app_1 = require("./app");
|
5
|
+
Object.defineProperty(exports, "runAction", { enumerable: true, get: function () { return app_1.runAction; } });
|
6
|
+
Object.defineProperty(exports, "getActions", { enumerable: true, get: function () { return app_1.getActions; } });
|
7
|
+
var actionMapper_1 = require("./actions/actionMapper");
|
8
|
+
Object.defineProperty(exports, "ActionMapper", { enumerable: true, get: function () { return actionMapper_1.ActionMapper; } });
|
package/package.json
CHANGED
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ActionTemplate } from "@/actions/parse";
|
2
|
-
export declare const slackSendMessageDefinition: ActionTemplate;
|
3
|
-
export declare const slackListConversationsDefinition: ActionTemplate;
|
4
|
-
export declare const mathAddDefinition: ActionTemplate;
|
5
|
-
export declare const confluenceUpdatePageDefinition: ActionTemplate;
|
@@ -1,132 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
|
4
|
-
exports.slackSendMessageDefinition = {
|
5
|
-
provider: "slack",
|
6
|
-
name: "send_message",
|
7
|
-
description: "Sends a message to a Slack channel",
|
8
|
-
scopes: ["chat:write"],
|
9
|
-
parameters: {
|
10
|
-
channel: {
|
11
|
-
type: "string",
|
12
|
-
description: "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
13
|
-
required: true,
|
14
|
-
},
|
15
|
-
message: {
|
16
|
-
type: "string",
|
17
|
-
description: "The message content to send to Slack. Can include markdown formatting.",
|
18
|
-
required: true,
|
19
|
-
},
|
20
|
-
},
|
21
|
-
output: {},
|
22
|
-
};
|
23
|
-
exports.slackListConversationsDefinition = {
|
24
|
-
provider: "slack",
|
25
|
-
name: "list_conversations",
|
26
|
-
description: "Lists all conversations in a Slack workspace",
|
27
|
-
scopes: ["channels:read", "groups:read", "im:read", "mpim:read"],
|
28
|
-
authToken: {
|
29
|
-
type: "string",
|
30
|
-
description: "The Slack access token to use",
|
31
|
-
required: true,
|
32
|
-
},
|
33
|
-
parameters: {},
|
34
|
-
output: {
|
35
|
-
channels: {
|
36
|
-
type: "array",
|
37
|
-
description: "A list of channels in Slack",
|
38
|
-
required: true,
|
39
|
-
items: {
|
40
|
-
type: "object",
|
41
|
-
description: "A channel in Slack",
|
42
|
-
required: true,
|
43
|
-
properties: {
|
44
|
-
id: {
|
45
|
-
type: "string",
|
46
|
-
description: "The ID of the channel",
|
47
|
-
required: true,
|
48
|
-
},
|
49
|
-
name: {
|
50
|
-
type: "string",
|
51
|
-
description: "The name of the channel",
|
52
|
-
required: true,
|
53
|
-
},
|
54
|
-
topic: {
|
55
|
-
type: "string",
|
56
|
-
description: "The topic of the channel",
|
57
|
-
required: true,
|
58
|
-
},
|
59
|
-
purpose: {
|
60
|
-
type: "string",
|
61
|
-
description: "The purpose of the channel",
|
62
|
-
required: true,
|
63
|
-
},
|
64
|
-
},
|
65
|
-
},
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
exports.mathAddDefinition = {
|
70
|
-
provider: "math",
|
71
|
-
name: "add",
|
72
|
-
description: "Adds two numbers together",
|
73
|
-
scopes: [],
|
74
|
-
parameters: {
|
75
|
-
a: {
|
76
|
-
type: "number",
|
77
|
-
description: "The first number to add",
|
78
|
-
required: true,
|
79
|
-
},
|
80
|
-
b: {
|
81
|
-
type: "number",
|
82
|
-
description: "The second number to add",
|
83
|
-
required: true,
|
84
|
-
},
|
85
|
-
},
|
86
|
-
output: {
|
87
|
-
result: {
|
88
|
-
type: "number",
|
89
|
-
description: "The sum of the two numbers",
|
90
|
-
required: true,
|
91
|
-
},
|
92
|
-
},
|
93
|
-
};
|
94
|
-
exports.confluenceUpdatePageDefinition = {
|
95
|
-
provider: "confluence",
|
96
|
-
name: "updatePage",
|
97
|
-
description: "Updates a confluence page with the new content specified",
|
98
|
-
scopes: [],
|
99
|
-
authToken: {
|
100
|
-
type: "string",
|
101
|
-
description: "The access token to use for confluence",
|
102
|
-
required: true,
|
103
|
-
},
|
104
|
-
baseUrl: {
|
105
|
-
type: "string",
|
106
|
-
description: "The base url required to access the confluence instance",
|
107
|
-
required: true,
|
108
|
-
},
|
109
|
-
parameters: {
|
110
|
-
pageId: {
|
111
|
-
type: "string",
|
112
|
-
description: "The page id that should be updated",
|
113
|
-
required: true,
|
114
|
-
},
|
115
|
-
title: {
|
116
|
-
type: "string",
|
117
|
-
description: "The title of the page that should be updated",
|
118
|
-
required: true,
|
119
|
-
},
|
120
|
-
username: {
|
121
|
-
type: "string",
|
122
|
-
description: "The username of the person updating the page",
|
123
|
-
required: true,
|
124
|
-
},
|
125
|
-
content: {
|
126
|
-
type: "string",
|
127
|
-
description: "The new content for the page",
|
128
|
-
required: true,
|
129
|
-
},
|
130
|
-
},
|
131
|
-
output: {},
|
132
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.mathAddDefinition = exports.slackSendMessageDefinition = void 0;
|
4
|
-
exports.slackSendMessageDefinition = {
|
5
|
-
name: "send_message",
|
6
|
-
description: "Sends a message to a Slack channel",
|
7
|
-
parameters: {
|
8
|
-
"channel": {
|
9
|
-
"type": "string",
|
10
|
-
"description": "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
11
|
-
"required": true
|
12
|
-
},
|
13
|
-
"message": {
|
14
|
-
"type": "string",
|
15
|
-
"description": "The message content to send to Slack. Can include markdown formatting.",
|
16
|
-
"required": true
|
17
|
-
}
|
18
|
-
}
|
19
|
-
};
|
20
|
-
exports.mathAddDefinition = {
|
21
|
-
name: "add",
|
22
|
-
description: "Adds two numbers together",
|
23
|
-
parameters: {
|
24
|
-
"a": {
|
25
|
-
"type": "number",
|
26
|
-
"description": "The first number to add",
|
27
|
-
"required": true
|
28
|
-
},
|
29
|
-
"b": {
|
30
|
-
"type": "number",
|
31
|
-
"description": "The second number to add",
|
32
|
-
"required": true
|
33
|
-
}
|
34
|
-
}
|
35
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { type ActionFunction } from "./autogen/types";
|
2
|
-
import { z } from "zod";
|
3
|
-
interface ActionFunctionComponents {
|
4
|
-
fn: ActionFunction<any, any, any>;
|
5
|
-
paramsSchema: z.ZodSchema;
|
6
|
-
outputSchema: z.ZodSchema;
|
7
|
-
}
|
8
|
-
export declare const FunctionMapper: Record<string, Record<string, ActionFunctionComponents>>;
|
9
|
-
export {};
|
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.FunctionMapper = void 0;
|
7
|
-
const add_1 = __importDefault(require("./providers/math/add"));
|
8
|
-
const list_conversations_1 = __importDefault(require("./providers/slack/list_conversations"));
|
9
|
-
const updatePage_1 = __importDefault(require("./providers/confluence/updatePage"));
|
10
|
-
const types_1 = require("./autogen/types");
|
11
|
-
exports.FunctionMapper = {
|
12
|
-
math: {
|
13
|
-
add: {
|
14
|
-
fn: add_1.default,
|
15
|
-
paramsSchema: types_1.mathAddParamsSchema,
|
16
|
-
outputSchema: types_1.mathAddOutputSchema,
|
17
|
-
},
|
18
|
-
},
|
19
|
-
slack: {
|
20
|
-
listConversations: {
|
21
|
-
fn: list_conversations_1.default,
|
22
|
-
paramsSchema: types_1.slackListConversationsParamsSchema,
|
23
|
-
outputSchema: types_1.slackListConversationsOutputSchema,
|
24
|
-
},
|
25
|
-
},
|
26
|
-
confluence: {
|
27
|
-
updatePage: {
|
28
|
-
fn: updatePage_1.default,
|
29
|
-
paramsSchema: types_1.confluenceUpdatePageParamsSchema,
|
30
|
-
outputSchema: types_1.confluenceUpdatePageOutputSchema,
|
31
|
-
},
|
32
|
-
},
|
33
|
-
};
|
@@ -1,43 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
function getConfluenceRequestConfig(baseUrl, username, apiToken) {
|
14
|
-
return {
|
15
|
-
baseURL: baseUrl,
|
16
|
-
headers: {
|
17
|
-
Accept: "application/json",
|
18
|
-
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
19
|
-
},
|
20
|
-
};
|
21
|
-
}
|
22
|
-
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
23
|
-
const { pageId, username, content, title } = params;
|
24
|
-
const { baseUrl, authToken } = authParams;
|
25
|
-
const config = getConfluenceRequestConfig(baseUrl, username, authToken);
|
26
|
-
// Get current version number
|
27
|
-
const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
|
28
|
-
const currVersion = response.data.version.number;
|
29
|
-
const payload = {
|
30
|
-
id: pageId,
|
31
|
-
status: "current",
|
32
|
-
title,
|
33
|
-
body: {
|
34
|
-
representation: "storage",
|
35
|
-
value: content,
|
36
|
-
},
|
37
|
-
version: {
|
38
|
-
number: currVersion + 1,
|
39
|
-
},
|
40
|
-
};
|
41
|
-
yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
|
42
|
-
});
|
43
|
-
exports.default = confluenceUpdatePage;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const sdk_1 = require("@credal/sdk");
|
13
|
-
const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
var _b;
|
15
|
-
const requestBody = {
|
16
|
-
agentId: params.agentId,
|
17
|
-
query: params.query,
|
18
|
-
userEmail: params.userEmail,
|
19
|
-
};
|
20
|
-
const baseUrl = (_b = authParams.baseUrl) !== null && _b !== void 0 ? _b : "https://app.credal.ai/api";
|
21
|
-
const client = new sdk_1.CredalClient({ environment: baseUrl, apiKey: authParams.apiKey });
|
22
|
-
const response = yield client.copilots.sendMessage({
|
23
|
-
agentId: requestBody.agentId,
|
24
|
-
message: requestBody.query,
|
25
|
-
userEmail: requestBody.userEmail,
|
26
|
-
});
|
27
|
-
return {
|
28
|
-
response: response.sendChatResult.type === "ai_response_result"
|
29
|
-
? response.sendChatResult.response.message
|
30
|
-
: "Error getting response",
|
31
|
-
referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
|
32
|
-
sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
|
33
|
-
webSearchResults: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.webSearchResults : [],
|
34
|
-
};
|
35
|
-
});
|
36
|
-
exports.default = callCopilot;
|
@@ -1,98 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
-
const decodeMessage_1 = require("./utils/decodeMessage");
|
15
|
-
const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
|
-
if (!authParams.authToken) {
|
17
|
-
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, threads: [] };
|
18
|
-
}
|
19
|
-
const { query, maxResults } = params;
|
20
|
-
const allThreads = [];
|
21
|
-
const errorMessages = [];
|
22
|
-
const max = maxResults !== null && maxResults !== void 0 ? maxResults : 100;
|
23
|
-
let fetched = 0;
|
24
|
-
let pageToken = undefined;
|
25
|
-
try {
|
26
|
-
while (fetched < max) {
|
27
|
-
const url = `https://gmail.googleapis.com/gmail/v1/users/me/threads?q=${encodeURIComponent(query)}` +
|
28
|
-
(pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
|
29
|
-
`&maxResults=${Math.min(100, max - fetched)}`;
|
30
|
-
const listRes = yield axiosClient_1.axiosClient.get(url, {
|
31
|
-
headers: {
|
32
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
33
|
-
},
|
34
|
-
});
|
35
|
-
const { threads: threadList = [], nextPageToken } = listRes.data;
|
36
|
-
if (!Array.isArray(threadList) || threadList.length === 0)
|
37
|
-
break;
|
38
|
-
const remaining = max - allThreads.length;
|
39
|
-
const batch = threadList.slice(0, remaining);
|
40
|
-
const results = yield Promise.all(batch.map((thread) => __awaiter(void 0, void 0, void 0, function* () {
|
41
|
-
try {
|
42
|
-
const threadRes = yield axiosClient_1.axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${thread.id}?format=full`, {
|
43
|
-
headers: {
|
44
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
45
|
-
},
|
46
|
-
});
|
47
|
-
const { id, historyId, messages } = threadRes.data;
|
48
|
-
return {
|
49
|
-
id,
|
50
|
-
historyId,
|
51
|
-
messages: Array.isArray(messages)
|
52
|
-
? messages.map(msg => {
|
53
|
-
const { id, threadId, snippet, labelIds, internalDate } = msg;
|
54
|
-
const emailBody = (0, decodeMessage_1.getEmailContent)(msg) || "";
|
55
|
-
return {
|
56
|
-
id,
|
57
|
-
threadId,
|
58
|
-
snippet,
|
59
|
-
labelIds,
|
60
|
-
internalDate,
|
61
|
-
emailBody,
|
62
|
-
};
|
63
|
-
})
|
64
|
-
: [],
|
65
|
-
};
|
66
|
-
}
|
67
|
-
catch (err) {
|
68
|
-
errorMessages.push(err instanceof Error ? err.message : "Failed to fetch thread details");
|
69
|
-
return {
|
70
|
-
id: thread.id,
|
71
|
-
snippet: "",
|
72
|
-
historyId: "",
|
73
|
-
messages: [],
|
74
|
-
error: err instanceof Error ? err.message : "Failed to fetch thread details",
|
75
|
-
};
|
76
|
-
}
|
77
|
-
})));
|
78
|
-
allThreads.push(...results);
|
79
|
-
fetched = allThreads.length;
|
80
|
-
if (!nextPageToken || allThreads.length >= max)
|
81
|
-
break;
|
82
|
-
pageToken = nextPageToken;
|
83
|
-
}
|
84
|
-
return {
|
85
|
-
success: errorMessages.length === 0,
|
86
|
-
threads: allThreads,
|
87
|
-
error: errorMessages.join("; "),
|
88
|
-
};
|
89
|
-
}
|
90
|
-
catch (error) {
|
91
|
-
return {
|
92
|
-
success: false,
|
93
|
-
error: error instanceof Error ? error.message : "Unknown error listing Gmail threads",
|
94
|
-
threads: [],
|
95
|
-
};
|
96
|
-
}
|
97
|
-
});
|
98
|
-
exports.default = listGmailThreads;
|