@elizaos/plugin-slack 2.0.0-alpha.4 → 2.0.0-alpha.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/index.js +369 -32
- package/dist/index.js.map +21 -21
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -130,8 +130,29 @@ var deleteMessage = {
|
|
|
130
130
|
name: "SLACK_DELETE_MESSAGE",
|
|
131
131
|
similes: ["REMOVE_SLACK_MESSAGE", "DELETE_MESSAGE", "SLACK_REMOVE"],
|
|
132
132
|
description: "Delete a Slack message",
|
|
133
|
-
validate: async (
|
|
134
|
-
|
|
133
|
+
validate: async (runtime, message, state, options) => {
|
|
134
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
135
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
136
|
+
const __avKeywords = ["slack", "delete", "message"];
|
|
137
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
138
|
+
const __avRegex = new RegExp("\\b(?:slack|delete|message)\\b", "i");
|
|
139
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
140
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
141
|
+
const __avExpectedSource = "slack";
|
|
142
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
143
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
144
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
145
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
149
|
+
return message2.content.source === "slack";
|
|
150
|
+
};
|
|
151
|
+
try {
|
|
152
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
153
|
+
} catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
135
156
|
},
|
|
136
157
|
handler: async (runtime, message, state, _options, callback) => {
|
|
137
158
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -252,10 +273,36 @@ Respond with a JSON object like:
|
|
|
252
273
|
Only respond with the JSON object, no other text.`;
|
|
253
274
|
var editMessage = {
|
|
254
275
|
name: "SLACK_EDIT_MESSAGE",
|
|
255
|
-
similes: [
|
|
276
|
+
similes: [
|
|
277
|
+
"UPDATE_SLACK_MESSAGE",
|
|
278
|
+
"MODIFY_MESSAGE",
|
|
279
|
+
"CHANGE_MESSAGE",
|
|
280
|
+
"SLACK_UPDATE"
|
|
281
|
+
],
|
|
256
282
|
description: "Edit an existing Slack message",
|
|
257
|
-
validate: async (
|
|
258
|
-
|
|
283
|
+
validate: async (runtime, message, state, options) => {
|
|
284
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
285
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
286
|
+
const __avKeywords = ["slack", "edit", "message"];
|
|
287
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
288
|
+
const __avRegex = new RegExp("\\b(?:slack|edit|message)\\b", "i");
|
|
289
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
290
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
291
|
+
const __avExpectedSource = "slack";
|
|
292
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
293
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
294
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
295
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
299
|
+
return message2.content.source === "slack";
|
|
300
|
+
};
|
|
301
|
+
try {
|
|
302
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
303
|
+
} catch {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
259
306
|
},
|
|
260
307
|
handler: async (runtime, message, state, _options, callback) => {
|
|
261
308
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -361,8 +408,29 @@ var emojiList = {
|
|
|
361
408
|
"WORKSPACE_EMOJI"
|
|
362
409
|
],
|
|
363
410
|
description: "List custom emoji available in the Slack workspace",
|
|
364
|
-
validate: async (
|
|
365
|
-
|
|
411
|
+
validate: async (runtime, message, state, options) => {
|
|
412
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
413
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
414
|
+
const __avKeywords = ["slack", "emoji", "list"];
|
|
415
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
416
|
+
const __avRegex = new RegExp("\\b(?:slack|emoji|list)\\b", "i");
|
|
417
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
418
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
419
|
+
const __avExpectedSource = "slack";
|
|
420
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
421
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
422
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
423
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
427
|
+
return message2.content.source === "slack";
|
|
428
|
+
};
|
|
429
|
+
try {
|
|
430
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
431
|
+
} catch {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
366
434
|
},
|
|
367
435
|
handler: async (runtime, message, _state, _options, callback) => {
|
|
368
436
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -487,10 +555,37 @@ Respond with a JSON object like:
|
|
|
487
555
|
Only respond with the JSON object, no other text.`;
|
|
488
556
|
var getUserInfo = {
|
|
489
557
|
name: "SLACK_GET_USER_INFO",
|
|
490
|
-
similes: [
|
|
558
|
+
similes: [
|
|
559
|
+
"GET_SLACK_USER",
|
|
560
|
+
"USER_INFO",
|
|
561
|
+
"SLACK_USER",
|
|
562
|
+
"MEMBER_INFO",
|
|
563
|
+
"WHO_IS"
|
|
564
|
+
],
|
|
491
565
|
description: "Get information about a Slack user",
|
|
492
|
-
validate: async (
|
|
493
|
-
|
|
566
|
+
validate: async (runtime, message, state, options) => {
|
|
567
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
568
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
569
|
+
const __avKeywords = ["slack", "get", "user", "info"];
|
|
570
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
571
|
+
const __avRegex = new RegExp("\\b(?:slack|get|user|info)\\b", "i");
|
|
572
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
573
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
574
|
+
const __avExpectedSource = "slack";
|
|
575
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
576
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
577
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
578
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
581
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
582
|
+
return message2.content.source === "slack";
|
|
583
|
+
};
|
|
584
|
+
try {
|
|
585
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
586
|
+
} catch {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
494
589
|
},
|
|
495
590
|
handler: async (runtime, message, state, _options, callback) => {
|
|
496
591
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -633,10 +728,36 @@ var getUserInfo_default = getUserInfo;
|
|
|
633
728
|
// src/actions/listChannels.ts
|
|
634
729
|
var listChannels = {
|
|
635
730
|
name: "SLACK_LIST_CHANNELS",
|
|
636
|
-
similes: [
|
|
731
|
+
similes: [
|
|
732
|
+
"LIST_SLACK_CHANNELS",
|
|
733
|
+
"SHOW_CHANNELS",
|
|
734
|
+
"GET_CHANNELS",
|
|
735
|
+
"CHANNELS_LIST"
|
|
736
|
+
],
|
|
637
737
|
description: "List available Slack channels in the workspace",
|
|
638
|
-
validate: async (
|
|
639
|
-
|
|
738
|
+
validate: async (runtime, message, state, options) => {
|
|
739
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
740
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
741
|
+
const __avKeywords = ["slack", "list", "channels"];
|
|
742
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
743
|
+
const __avRegex = new RegExp("\\b(?:slack|list|channels)\\b", "i");
|
|
744
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
745
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
746
|
+
const __avExpectedSource = "slack";
|
|
747
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
748
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
749
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
750
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
754
|
+
return message2.content.source === "slack";
|
|
755
|
+
};
|
|
756
|
+
try {
|
|
757
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
758
|
+
} catch {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
640
761
|
},
|
|
641
762
|
handler: async (runtime, message, _state, _options, callback) => {
|
|
642
763
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -744,10 +865,36 @@ Respond with a JSON object like:
|
|
|
744
865
|
Only respond with the JSON object, no other text.`;
|
|
745
866
|
var listPins = {
|
|
746
867
|
name: "SLACK_LIST_PINS",
|
|
747
|
-
similes: [
|
|
868
|
+
similes: [
|
|
869
|
+
"LIST_SLACK_PINS",
|
|
870
|
+
"SHOW_PINS",
|
|
871
|
+
"GET_PINNED_MESSAGES",
|
|
872
|
+
"PINNED_MESSAGES"
|
|
873
|
+
],
|
|
748
874
|
description: "List pinned messages in a Slack channel",
|
|
749
|
-
validate: async (
|
|
750
|
-
|
|
875
|
+
validate: async (runtime, message, state, options) => {
|
|
876
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
877
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
878
|
+
const __avKeywords = ["slack", "list", "pins"];
|
|
879
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
880
|
+
const __avRegex = new RegExp("\\b(?:slack|list|pins)\\b", "i");
|
|
881
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
882
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
883
|
+
const __avExpectedSource = "slack";
|
|
884
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
885
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
886
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
887
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
891
|
+
return message2.content.source === "slack";
|
|
892
|
+
};
|
|
893
|
+
try {
|
|
894
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
895
|
+
} catch {
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
751
898
|
},
|
|
752
899
|
handler: async (runtime, message, state, _options, callback) => {
|
|
753
900
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -917,8 +1064,29 @@ var pinMessage = {
|
|
|
917
1064
|
name: "SLACK_PIN_MESSAGE",
|
|
918
1065
|
similes: ["PIN_SLACK_MESSAGE", "PIN_MESSAGE", "SLACK_PIN", "SAVE_MESSAGE"],
|
|
919
1066
|
description: "Pin a message in a Slack channel",
|
|
920
|
-
validate: async (
|
|
921
|
-
|
|
1067
|
+
validate: async (runtime, message, state, options) => {
|
|
1068
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
1069
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
1070
|
+
const __avKeywords = ["slack", "pin", "message"];
|
|
1071
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
1072
|
+
const __avRegex = new RegExp("\\b(?:slack|pin|message)\\b", "i");
|
|
1073
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
1074
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
1075
|
+
const __avExpectedSource = "slack";
|
|
1076
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
1077
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
1078
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
1079
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
1080
|
+
return false;
|
|
1081
|
+
}
|
|
1082
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
1083
|
+
return message2.content.source === "slack";
|
|
1084
|
+
};
|
|
1085
|
+
try {
|
|
1086
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
1087
|
+
} catch {
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
922
1090
|
},
|
|
923
1091
|
handler: async (runtime, message, state, _options, callback) => {
|
|
924
1092
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1041,10 +1209,37 @@ Respond with a JSON object like:
|
|
|
1041
1209
|
Only respond with the JSON object, no other text.`;
|
|
1042
1210
|
var reactToMessage = {
|
|
1043
1211
|
name: "SLACK_REACT_TO_MESSAGE",
|
|
1044
|
-
similes: [
|
|
1212
|
+
similes: [
|
|
1213
|
+
"ADD_SLACK_REACTION",
|
|
1214
|
+
"REACT_SLACK",
|
|
1215
|
+
"SLACK_EMOJI",
|
|
1216
|
+
"ADD_EMOJI",
|
|
1217
|
+
"REMOVE_REACTION"
|
|
1218
|
+
],
|
|
1045
1219
|
description: "Add or remove an emoji reaction to a Slack message",
|
|
1046
|
-
validate: async (
|
|
1047
|
-
|
|
1220
|
+
validate: async (runtime, message, state, options) => {
|
|
1221
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
1222
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
1223
|
+
const __avKeywords = ["slack", "react", "message"];
|
|
1224
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
1225
|
+
const __avRegex = new RegExp("\\b(?:slack|react|message)\\b", "i");
|
|
1226
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
1227
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
1228
|
+
const __avExpectedSource = "slack";
|
|
1229
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
1230
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
1231
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
1232
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
1235
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
1236
|
+
return message2.content.source === "slack";
|
|
1237
|
+
};
|
|
1238
|
+
try {
|
|
1239
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
1240
|
+
} catch {
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1048
1243
|
},
|
|
1049
1244
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1050
1245
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1201,8 +1396,29 @@ var readChannel = {
|
|
|
1201
1396
|
"LIST_MESSAGES"
|
|
1202
1397
|
],
|
|
1203
1398
|
description: "Read message history from a Slack channel",
|
|
1204
|
-
validate: async (
|
|
1205
|
-
|
|
1399
|
+
validate: async (runtime, message, state, options) => {
|
|
1400
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
1401
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
1402
|
+
const __avKeywords = ["slack", "read", "channel"];
|
|
1403
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
1404
|
+
const __avRegex = new RegExp("\\b(?:slack|read|channel)\\b", "i");
|
|
1405
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
1406
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
1407
|
+
const __avExpectedSource = "slack";
|
|
1408
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
1409
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
1410
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
1411
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
1412
|
+
return false;
|
|
1413
|
+
}
|
|
1414
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
1415
|
+
return message2.content.source === "slack";
|
|
1416
|
+
};
|
|
1417
|
+
try {
|
|
1418
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
1419
|
+
} catch {
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1206
1422
|
},
|
|
1207
1423
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1208
1424
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1369,8 +1585,29 @@ var sendMessage = {
|
|
|
1369
1585
|
"SEND_TO_CHANNEL"
|
|
1370
1586
|
],
|
|
1371
1587
|
description: "Send a message to a Slack channel or thread",
|
|
1372
|
-
validate: async (
|
|
1373
|
-
|
|
1588
|
+
validate: async (runtime, message, state, options) => {
|
|
1589
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
1590
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
1591
|
+
const __avKeywords = ["slack", "send", "message"];
|
|
1592
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
1593
|
+
const __avRegex = new RegExp("\\b(?:slack|send|message)\\b", "i");
|
|
1594
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
1595
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
1596
|
+
const __avExpectedSource = "slack";
|
|
1597
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
1598
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
1599
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
1600
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
1604
|
+
return message2.content.source === "slack";
|
|
1605
|
+
};
|
|
1606
|
+
try {
|
|
1607
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
1608
|
+
} catch {
|
|
1609
|
+
return false;
|
|
1610
|
+
}
|
|
1374
1611
|
},
|
|
1375
1612
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1376
1613
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1517,10 +1754,36 @@ Respond with a JSON object like:
|
|
|
1517
1754
|
Only respond with the JSON object, no other text.`;
|
|
1518
1755
|
var unpinMessage = {
|
|
1519
1756
|
name: "SLACK_UNPIN_MESSAGE",
|
|
1520
|
-
similes: [
|
|
1757
|
+
similes: [
|
|
1758
|
+
"UNPIN_SLACK_MESSAGE",
|
|
1759
|
+
"UNPIN_MESSAGE",
|
|
1760
|
+
"SLACK_UNPIN",
|
|
1761
|
+
"REMOVE_PIN"
|
|
1762
|
+
],
|
|
1521
1763
|
description: "Unpin a message from a Slack channel",
|
|
1522
|
-
validate: async (
|
|
1523
|
-
|
|
1764
|
+
validate: async (runtime, message, state, options) => {
|
|
1765
|
+
const __avTextRaw = typeof message?.content?.text === "string" ? message.content.text : "";
|
|
1766
|
+
const __avText = __avTextRaw.toLowerCase();
|
|
1767
|
+
const __avKeywords = ["slack", "unpin", "message"];
|
|
1768
|
+
const __avKeywordOk = __avKeywords.length > 0 && __avKeywords.some((kw) => kw.length > 0 && __avText.includes(kw));
|
|
1769
|
+
const __avRegex = new RegExp("\\b(?:slack|unpin|message)\\b", "i");
|
|
1770
|
+
const __avRegexOk = __avRegex.test(__avText);
|
|
1771
|
+
const __avSource = String(message?.content?.source ?? message?.source ?? "");
|
|
1772
|
+
const __avExpectedSource = "slack";
|
|
1773
|
+
const __avSourceOk = __avExpectedSource ? __avSource === __avExpectedSource : Boolean(__avSource || state || runtime?.agentId || runtime?.getService);
|
|
1774
|
+
const __avOptions = options && typeof options === "object" ? options : {};
|
|
1775
|
+
const __avInputOk = __avText.trim().length > 0 || Object.keys(__avOptions).length > 0 || Boolean(message?.content && typeof message.content === "object");
|
|
1776
|
+
if (!(__avKeywordOk && __avRegexOk && __avSourceOk && __avInputOk)) {
|
|
1777
|
+
return false;
|
|
1778
|
+
}
|
|
1779
|
+
const __avLegacyValidate = async (_runtime, message2, _state) => {
|
|
1780
|
+
return message2.content.source === "slack";
|
|
1781
|
+
};
|
|
1782
|
+
try {
|
|
1783
|
+
return Boolean(await __avLegacyValidate(runtime, message, state, options));
|
|
1784
|
+
} catch {
|
|
1785
|
+
return false;
|
|
1786
|
+
}
|
|
1524
1787
|
},
|
|
1525
1788
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1526
1789
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1614,10 +1877,35 @@ var unpinMessage = {
|
|
|
1614
1877
|
var unpinMessage_default = unpinMessage;
|
|
1615
1878
|
|
|
1616
1879
|
// src/providers/channelState.ts
|
|
1880
|
+
import { validateActionKeywords, validateActionRegex } from "@elizaos/core";
|
|
1617
1881
|
var channelStateProvider = {
|
|
1618
1882
|
name: "slackChannelState",
|
|
1619
1883
|
description: "Provides information about the current Slack channel context",
|
|
1884
|
+
dynamic: true,
|
|
1885
|
+
relevanceKeywords: [
|
|
1886
|
+
"slackchannelstate",
|
|
1887
|
+
"channelstateprovider",
|
|
1888
|
+
"plugin",
|
|
1889
|
+
"slack",
|
|
1890
|
+
"status",
|
|
1891
|
+
"state",
|
|
1892
|
+
"context",
|
|
1893
|
+
"info",
|
|
1894
|
+
"details",
|
|
1895
|
+
"chat",
|
|
1896
|
+
"conversation",
|
|
1897
|
+
"agent",
|
|
1898
|
+
"room",
|
|
1899
|
+
"channel"
|
|
1900
|
+
],
|
|
1620
1901
|
get: async (runtime, message, state) => {
|
|
1902
|
+
const __providerKeywords = ["slackchannelstate", "channelstateprovider", "plugin", "slack", "status", "state", "context", "info", "details", "chat", "conversation", "agent", "room", "channel"];
|
|
1903
|
+
const __providerRegex = new RegExp(`\\b(${__providerKeywords.join("|")})\\b`, "i");
|
|
1904
|
+
const __recentMessages = state?.recentMessagesData || [];
|
|
1905
|
+
const __isRelevant = validateActionKeywords(message, __recentMessages, __providerKeywords) || validateActionRegex(message, __recentMessages, __providerRegex);
|
|
1906
|
+
if (!__isRelevant) {
|
|
1907
|
+
return { text: "" };
|
|
1908
|
+
}
|
|
1621
1909
|
const room = state.data?.room ?? await runtime.getRoom(message.roomId);
|
|
1622
1910
|
if (!room) {
|
|
1623
1911
|
return {
|
|
@@ -1735,10 +2023,35 @@ This is a threaded conversation (thread timestamp: ${threadTs}).`;
|
|
|
1735
2023
|
};
|
|
1736
2024
|
|
|
1737
2025
|
// src/providers/memberList.ts
|
|
2026
|
+
import { validateActionKeywords as validateActionKeywords2, validateActionRegex as validateActionRegex2 } from "@elizaos/core";
|
|
1738
2027
|
var memberListProvider = {
|
|
1739
2028
|
name: "slackMemberList",
|
|
1740
2029
|
description: "Provides information about members in the current Slack channel",
|
|
2030
|
+
dynamic: true,
|
|
2031
|
+
relevanceKeywords: [
|
|
2032
|
+
"slackmemberlist",
|
|
2033
|
+
"memberlistprovider",
|
|
2034
|
+
"plugin",
|
|
2035
|
+
"slack",
|
|
2036
|
+
"status",
|
|
2037
|
+
"state",
|
|
2038
|
+
"context",
|
|
2039
|
+
"info",
|
|
2040
|
+
"details",
|
|
2041
|
+
"chat",
|
|
2042
|
+
"conversation",
|
|
2043
|
+
"agent",
|
|
2044
|
+
"room",
|
|
2045
|
+
"channel"
|
|
2046
|
+
],
|
|
1741
2047
|
get: async (runtime, message, state) => {
|
|
2048
|
+
const __providerKeywords = ["slackmemberlist", "memberlistprovider", "plugin", "slack", "status", "state", "context", "info", "details", "chat", "conversation", "agent", "room", "channel"];
|
|
2049
|
+
const __providerRegex = new RegExp(`\\b(${__providerKeywords.join("|")})\\b`, "i");
|
|
2050
|
+
const __recentMessages = state?.recentMessagesData || [];
|
|
2051
|
+
const __isRelevant = validateActionKeywords2(message, __recentMessages, __providerKeywords) || validateActionRegex2(message, __recentMessages, __providerRegex);
|
|
2052
|
+
if (!__isRelevant) {
|
|
2053
|
+
return { text: "" };
|
|
2054
|
+
}
|
|
1742
2055
|
if (message.content.source !== "slack") {
|
|
1743
2056
|
return {
|
|
1744
2057
|
data: {},
|
|
@@ -1835,10 +2148,35 @@ ${memberDescriptions.join(`
|
|
|
1835
2148
|
};
|
|
1836
2149
|
|
|
1837
2150
|
// src/providers/workspaceInfo.ts
|
|
2151
|
+
import { validateActionKeywords as validateActionKeywords3, validateActionRegex as validateActionRegex3 } from "@elizaos/core";
|
|
1838
2152
|
var workspaceInfoProvider = {
|
|
1839
2153
|
name: "slackWorkspaceInfo",
|
|
1840
2154
|
description: "Provides information about the Slack workspace",
|
|
2155
|
+
dynamic: true,
|
|
2156
|
+
relevanceKeywords: [
|
|
2157
|
+
"slackworkspaceinfo",
|
|
2158
|
+
"workspaceinfoprovider",
|
|
2159
|
+
"plugin",
|
|
2160
|
+
"slack",
|
|
2161
|
+
"status",
|
|
2162
|
+
"state",
|
|
2163
|
+
"context",
|
|
2164
|
+
"info",
|
|
2165
|
+
"details",
|
|
2166
|
+
"chat",
|
|
2167
|
+
"conversation",
|
|
2168
|
+
"agent",
|
|
2169
|
+
"room",
|
|
2170
|
+
"channel"
|
|
2171
|
+
],
|
|
1841
2172
|
get: async (runtime, message, state) => {
|
|
2173
|
+
const __providerKeywords = ["slackworkspaceinfo", "workspaceinfoprovider", "plugin", "slack", "status", "state", "context", "info", "details", "chat", "conversation", "agent", "room", "channel"];
|
|
2174
|
+
const __providerRegex = new RegExp(`\\b(${__providerKeywords.join("|")})\\b`, "i");
|
|
2175
|
+
const __recentMessages = state?.recentMessagesData || [];
|
|
2176
|
+
const __isRelevant = validateActionKeywords3(message, __recentMessages, __providerKeywords) || validateActionRegex3(message, __recentMessages, __providerRegex);
|
|
2177
|
+
if (!__isRelevant) {
|
|
2178
|
+
return { text: "" };
|
|
2179
|
+
}
|
|
1842
2180
|
if (message.content.source !== "slack") {
|
|
1843
2181
|
return {
|
|
1844
2182
|
data: {},
|
|
@@ -1955,6 +2293,7 @@ class SlackService extends Service {
|
|
|
1955
2293
|
botToken = null;
|
|
1956
2294
|
appToken = null;
|
|
1957
2295
|
signingSecret = null;
|
|
2296
|
+
userToken = undefined;
|
|
1958
2297
|
allowedChannelIds = new Set;
|
|
1959
2298
|
dynamicChannelIds = new Set;
|
|
1960
2299
|
userCache = new Map;
|
|
@@ -1967,9 +2306,7 @@ class SlackService extends Service {
|
|
|
1967
2306
|
this.settings = this.loadSettings();
|
|
1968
2307
|
const channelIdsRaw = runtime.getSetting("SLACK_CHANNEL_IDS");
|
|
1969
2308
|
if (channelIdsRaw?.trim()) {
|
|
1970
|
-
channelIdsRaw.split(",").map((s) => s.trim()).filter((s) => s.length > 0 && isValidChannelId(s)).forEach((id) =>
|
|
1971
|
-
this.allowedChannelIds.add(id);
|
|
1972
|
-
});
|
|
2309
|
+
channelIdsRaw.split(",").map((s) => s.trim()).filter((s) => s.length > 0 && isValidChannelId(s)).forEach((id) => this.allowedChannelIds.add(id));
|
|
1973
2310
|
this.runtime.logger.debug({
|
|
1974
2311
|
src: "plugin:slack",
|
|
1975
2312
|
agentId: this.runtime.agentId,
|
|
@@ -3178,4 +3515,4 @@ export {
|
|
|
3178
3515
|
DEFAULT_ACCOUNT_ID
|
|
3179
3516
|
};
|
|
3180
3517
|
|
|
3181
|
-
//# debugId=
|
|
3518
|
+
//# debugId=496ED72648C509CD64756E2164756E21
|