@credal/actions 0.2.4 → 0.2.5
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.js +69 -1
- package/dist/actions/autogen/definitions.d.ts +5 -0
- package/dist/actions/autogen/definitions.js +132 -0
- package/dist/actions/autogen/templates.d.ts +11 -0
- package/dist/actions/autogen/templates.js +888 -0
- package/dist/actions/autogen/types.d.ts +997 -0
- package/dist/actions/autogen/types.js +290 -0
- package/dist/actions/definitions.js +35 -0
- package/dist/actions/groups.js +17 -1
- package/dist/actions/invokeMapper.d.ts +9 -0
- package/dist/actions/invokeMapper.js +33 -0
- package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +43 -0
- package/dist/actions/providers/credal/callCopilot.d.ts +3 -0
- package/dist/actions/providers/credal/callCopilot.js +36 -0
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +3 -0
- package/dist/actions/providers/google-oauth/listGmailThreads.js +98 -0
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +91 -0
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
- package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
- package/dist/actions/providers/jira/createTicket.d.ts +3 -0
- package/dist/actions/providers/jira/createTicket.js +34 -0
- package/dist/actions/providers/math/index.d.ts +1 -0
- package/dist/actions/providers/math/index.js +37 -0
- package/dist/actions/providers/okta/addUserToGroup.d.ts +3 -0
- package/dist/actions/providers/okta/addUserToGroup.js +56 -0
- package/dist/actions/providers/okta/getOktaGroup.d.ts +3 -0
- package/dist/actions/providers/okta/getOktaGroup.js +73 -0
- package/dist/actions/providers/okta/getOktaUser.d.ts +3 -0
- package/dist/actions/providers/okta/getOktaUser.js +40 -0
- package/dist/actions/providers/okta/listMFA.d.ts +3 -0
- package/dist/actions/providers/okta/listMFA.js +52 -0
- package/dist/actions/providers/okta/listOktaGroupMembers.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaGroupMembers.js +99 -0
- package/dist/actions/providers/okta/listOktaGroups.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaGroups.js +92 -0
- package/dist/actions/providers/okta/listOktaUserGroups.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaUserGroups.js +83 -0
- package/dist/actions/providers/okta/listOktaUsers.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaUsers.js +100 -0
- package/dist/actions/providers/okta/removeUserFromGroup.d.ts +3 -0
- package/dist/actions/providers/okta/removeUserFromGroup.js +56 -0
- package/dist/actions/providers/okta/resetMFA.d.ts +3 -0
- package/dist/actions/providers/okta/resetMFA.js +62 -0
- package/dist/actions/providers/okta/resetPassword.d.ts +3 -0
- package/dist/actions/providers/okta/resetPassword.js +57 -0
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +3 -0
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +43 -0
- package/dist/actions/providers/slack/index.d.ts +1 -0
- package/dist/actions/providers/slack/index.js +37 -0
- package/dist/actions/providers/slack/listConversations.d.ts +3 -0
- package/dist/actions/providers/slack/listConversations.js +41 -0
- package/dist/actions/providers/slack/list_conversations.d.ts +3 -0
- package/dist/actions/providers/slack/list_conversations.js +60 -0
- package/dist/actions/providers/slack/summarizeChannel.d.ts +3 -0
- package/dist/actions/providers/slack/summarizeChannel.js +51 -0
- package/dist/actions/schema.js +6 -0
- package/dist/actions/types.js +2 -0
- package/dist/main.js +11 -0
- package/package.json +1 -1
- package/dist/server.d.ts +0 -2
- package/dist/server.js +0 -8
@@ -0,0 +1,60 @@
|
|
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 slackListConversations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
14
|
+
var _b;
|
15
|
+
const client = new web_api_1.WebClient(authParams.authToken);
|
16
|
+
const allChannels = [];
|
17
|
+
let cursor;
|
18
|
+
const limit = 100;
|
19
|
+
try {
|
20
|
+
do {
|
21
|
+
const response = yield client.conversations.list({
|
22
|
+
exclude_archived: true,
|
23
|
+
limit: limit,
|
24
|
+
cursor: cursor,
|
25
|
+
});
|
26
|
+
if (!response.ok) {
|
27
|
+
throw new Error(`Slack API error: ${response.error}`);
|
28
|
+
}
|
29
|
+
// Add channels from this page to our results
|
30
|
+
if (response.channels && Array.isArray(response.channels)) {
|
31
|
+
allChannels.push(...response.channels);
|
32
|
+
}
|
33
|
+
// Get cursor for next page
|
34
|
+
cursor = (_b = response.response_metadata) === null || _b === void 0 ? void 0 : _b.next_cursor;
|
35
|
+
// If user specified a limit and we've hit it, stop paginating
|
36
|
+
if (limit && allChannels.length >= limit) {
|
37
|
+
allChannels.splice(limit); // Trim to exact limit
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
} while (cursor && cursor.length > 0);
|
41
|
+
return {
|
42
|
+
channels: allChannels.map(channel => ({
|
43
|
+
id: channel.id,
|
44
|
+
name: channel.name,
|
45
|
+
topic: channel.topic.value,
|
46
|
+
purpose: channel.purpose.value,
|
47
|
+
})),
|
48
|
+
};
|
49
|
+
}
|
50
|
+
catch (error) {
|
51
|
+
if (error instanceof Error) {
|
52
|
+
// Enhance error with more context
|
53
|
+
throw new Error(`Failed to list Slack conversations: ${error.message}`);
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
throw error;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
});
|
60
|
+
exports.default = slackListConversations;
|
@@ -0,0 +1,51 @@
|
|
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 web_api_1 = require("@slack/web-api");
|
16
|
+
const helpers_1 = require("./helpers");
|
17
|
+
const openai_1 = __importDefault(require("openai"));
|
18
|
+
const summarizeChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
19
|
+
var _b;
|
20
|
+
const client = new web_api_1.WebClient(authParams.authToken);
|
21
|
+
const { channelName } = params;
|
22
|
+
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
23
|
+
const channel = allChannels.find(channel => channel.name === channelName && channel.is_private === false);
|
24
|
+
if (!channel || !channel.id) {
|
25
|
+
throw Error(`Channel with name ${channelName} not found`);
|
26
|
+
}
|
27
|
+
// summarize last 50 messages
|
28
|
+
const messages = yield client.conversations.history({
|
29
|
+
channel: channel.id,
|
30
|
+
limit: 50,
|
31
|
+
});
|
32
|
+
if (!messages.ok) {
|
33
|
+
throw Error(`Failed to fetch messages from channel ${channel.name}`);
|
34
|
+
}
|
35
|
+
const history = ((_b = messages.messages) === null || _b === void 0 ? void 0 : _b.reverse().map(message => message.user + ":" + message.text).join("\n")) || "";
|
36
|
+
const oai = new openai_1.default();
|
37
|
+
const completion = yield oai.chat.completions.create({
|
38
|
+
model: "gpt-4o-mini",
|
39
|
+
messages: [
|
40
|
+
{
|
41
|
+
role: "user",
|
42
|
+
content: "Summarize the following messages in the Slack channel:\n" + history,
|
43
|
+
},
|
44
|
+
],
|
45
|
+
});
|
46
|
+
const summary = completion.choices[0].message.content || "";
|
47
|
+
return {
|
48
|
+
summary: summary,
|
49
|
+
};
|
50
|
+
});
|
51
|
+
exports.default = summarizeChannel;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createParametersObject = createParametersObject;
|
4
|
+
function createParametersObject(parameters) {
|
5
|
+
return Object.fromEntries(Object.entries(parameters).map(([key, param]) => [key, param.type]));
|
6
|
+
}
|
package/dist/main.js
ADDED
@@ -0,0 +1,11 @@
|
|
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
|
+
const list_conversations_1 = __importDefault(require("./actions/providers/slack/list_conversations"));
|
7
|
+
const result = (0, list_conversations_1.default)({
|
8
|
+
accessToken: "xoxp-4172665288294-8092684180551-8154529379075-89f1f70cc06e5648e8f912ba96f56626"
|
9
|
+
}).then((result) => {
|
10
|
+
console.log(result);
|
11
|
+
});
|
package/package.json
CHANGED
package/dist/server.d.ts
DELETED
package/dist/server.js
DELETED
@@ -1,8 +0,0 @@
|
|
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; } });
|