@elizaos/plugin-slack 2.0.0-alpha.5 → 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 +329 -23
- package/dist/index.js.map +16 -16
- 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);
|
|
@@ -259,8 +280,29 @@ var editMessage = {
|
|
|
259
280
|
"SLACK_UPDATE"
|
|
260
281
|
],
|
|
261
282
|
description: "Edit an existing Slack message",
|
|
262
|
-
validate: async (
|
|
263
|
-
|
|
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
|
+
}
|
|
264
306
|
},
|
|
265
307
|
handler: async (runtime, message, state, _options, callback) => {
|
|
266
308
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -366,8 +408,29 @@ var emojiList = {
|
|
|
366
408
|
"WORKSPACE_EMOJI"
|
|
367
409
|
],
|
|
368
410
|
description: "List custom emoji available in the Slack workspace",
|
|
369
|
-
validate: async (
|
|
370
|
-
|
|
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
|
+
}
|
|
371
434
|
},
|
|
372
435
|
handler: async (runtime, message, _state, _options, callback) => {
|
|
373
436
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -500,8 +563,29 @@ var getUserInfo = {
|
|
|
500
563
|
"WHO_IS"
|
|
501
564
|
],
|
|
502
565
|
description: "Get information about a Slack user",
|
|
503
|
-
validate: async (
|
|
504
|
-
|
|
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
|
+
}
|
|
505
589
|
},
|
|
506
590
|
handler: async (runtime, message, state, _options, callback) => {
|
|
507
591
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -651,8 +735,29 @@ var listChannels = {
|
|
|
651
735
|
"CHANNELS_LIST"
|
|
652
736
|
],
|
|
653
737
|
description: "List available Slack channels in the workspace",
|
|
654
|
-
validate: async (
|
|
655
|
-
|
|
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
|
+
}
|
|
656
761
|
},
|
|
657
762
|
handler: async (runtime, message, _state, _options, callback) => {
|
|
658
763
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -767,8 +872,29 @@ var listPins = {
|
|
|
767
872
|
"PINNED_MESSAGES"
|
|
768
873
|
],
|
|
769
874
|
description: "List pinned messages in a Slack channel",
|
|
770
|
-
validate: async (
|
|
771
|
-
|
|
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
|
+
}
|
|
772
898
|
},
|
|
773
899
|
handler: async (runtime, message, state, _options, callback) => {
|
|
774
900
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -938,8 +1064,29 @@ var pinMessage = {
|
|
|
938
1064
|
name: "SLACK_PIN_MESSAGE",
|
|
939
1065
|
similes: ["PIN_SLACK_MESSAGE", "PIN_MESSAGE", "SLACK_PIN", "SAVE_MESSAGE"],
|
|
940
1066
|
description: "Pin a message in a Slack channel",
|
|
941
|
-
validate: async (
|
|
942
|
-
|
|
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
|
+
}
|
|
943
1090
|
},
|
|
944
1091
|
handler: async (runtime, message, state, _options, callback) => {
|
|
945
1092
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1070,8 +1217,29 @@ var reactToMessage = {
|
|
|
1070
1217
|
"REMOVE_REACTION"
|
|
1071
1218
|
],
|
|
1072
1219
|
description: "Add or remove an emoji reaction to a Slack message",
|
|
1073
|
-
validate: async (
|
|
1074
|
-
|
|
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
|
+
}
|
|
1075
1243
|
},
|
|
1076
1244
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1077
1245
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1228,8 +1396,29 @@ var readChannel = {
|
|
|
1228
1396
|
"LIST_MESSAGES"
|
|
1229
1397
|
],
|
|
1230
1398
|
description: "Read message history from a Slack channel",
|
|
1231
|
-
validate: async (
|
|
1232
|
-
|
|
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
|
+
}
|
|
1233
1422
|
},
|
|
1234
1423
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1235
1424
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1396,8 +1585,29 @@ var sendMessage = {
|
|
|
1396
1585
|
"SEND_TO_CHANNEL"
|
|
1397
1586
|
],
|
|
1398
1587
|
description: "Send a message to a Slack channel or thread",
|
|
1399
|
-
validate: async (
|
|
1400
|
-
|
|
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
|
+
}
|
|
1401
1611
|
},
|
|
1402
1612
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1403
1613
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1551,8 +1761,29 @@ var unpinMessage = {
|
|
|
1551
1761
|
"REMOVE_PIN"
|
|
1552
1762
|
],
|
|
1553
1763
|
description: "Unpin a message from a Slack channel",
|
|
1554
|
-
validate: async (
|
|
1555
|
-
|
|
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
|
+
}
|
|
1556
1787
|
},
|
|
1557
1788
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1558
1789
|
const slackService = runtime.getService(SLACK_SERVICE_NAME);
|
|
@@ -1646,10 +1877,35 @@ var unpinMessage = {
|
|
|
1646
1877
|
var unpinMessage_default = unpinMessage;
|
|
1647
1878
|
|
|
1648
1879
|
// src/providers/channelState.ts
|
|
1880
|
+
import { validateActionKeywords, validateActionRegex } from "@elizaos/core";
|
|
1649
1881
|
var channelStateProvider = {
|
|
1650
1882
|
name: "slackChannelState",
|
|
1651
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
|
+
],
|
|
1652
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
|
+
}
|
|
1653
1909
|
const room = state.data?.room ?? await runtime.getRoom(message.roomId);
|
|
1654
1910
|
if (!room) {
|
|
1655
1911
|
return {
|
|
@@ -1767,10 +2023,35 @@ This is a threaded conversation (thread timestamp: ${threadTs}).`;
|
|
|
1767
2023
|
};
|
|
1768
2024
|
|
|
1769
2025
|
// src/providers/memberList.ts
|
|
2026
|
+
import { validateActionKeywords as validateActionKeywords2, validateActionRegex as validateActionRegex2 } from "@elizaos/core";
|
|
1770
2027
|
var memberListProvider = {
|
|
1771
2028
|
name: "slackMemberList",
|
|
1772
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
|
+
],
|
|
1773
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
|
+
}
|
|
1774
2055
|
if (message.content.source !== "slack") {
|
|
1775
2056
|
return {
|
|
1776
2057
|
data: {},
|
|
@@ -1867,10 +2148,35 @@ ${memberDescriptions.join(`
|
|
|
1867
2148
|
};
|
|
1868
2149
|
|
|
1869
2150
|
// src/providers/workspaceInfo.ts
|
|
2151
|
+
import { validateActionKeywords as validateActionKeywords3, validateActionRegex as validateActionRegex3 } from "@elizaos/core";
|
|
1870
2152
|
var workspaceInfoProvider = {
|
|
1871
2153
|
name: "slackWorkspaceInfo",
|
|
1872
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
|
+
],
|
|
1873
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
|
+
}
|
|
1874
2180
|
if (message.content.source !== "slack") {
|
|
1875
2181
|
return {
|
|
1876
2182
|
data: {},
|
|
@@ -3209,4 +3515,4 @@ export {
|
|
|
3209
3515
|
DEFAULT_ACCOUNT_ID
|
|
3210
3516
|
};
|
|
3211
3517
|
|
|
3212
|
-
//# debugId=
|
|
3518
|
+
//# debugId=496ED72648C509CD64756E2164756E21
|