@openclaw/discord 2026.7.1-beta.6 → 2026.7.2-beta.1
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/action-runtime-api.js +1 -1
- package/dist/{allow-list-C-MqM-B_.js → allow-list-B7qOH5xu.js} +22 -1
- package/dist/{api-DPRqYi4Z.js → api--f62GFaS.js} +38 -23
- package/dist/api.js +15 -15
- package/dist/approval-custom-id-NYPYj9Po.js +58 -0
- package/dist/{approval-handler.runtime-Bw2pZNk1.js → approval-handler.runtime-DeyIiw5I.js} +28 -23
- package/dist/approval-message-safety-C-8BL6Kv.js +47 -0
- package/dist/{audit-MLpDpN3Z.js → audit-Df2w046a.js} +3 -3
- package/dist/{channel-actions-D_fjVUZ_.js → channel-actions-ChpBSRcu.js} +6 -4
- package/dist/{channel-actions.runtime-CVHlFqQg.js → channel-actions.runtime-D8V8tyCq.js} +41 -12
- package/dist/channel-config-api.js +1 -1
- package/dist/{channel-DGWPH5u3.js → channel-nYmJ7FKQ.js} +275 -62
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-tZcpIn4e.js → channel.setup-DyihrqHH.js} +3 -3
- package/dist/{components-BIBizbtZ.js → components-BVrfRS-F.js} +78 -52
- package/dist/config-api-B18fR8M5.js +3 -0
- package/dist/{config-schema-BgIhO3ko.js → config-schema-_bUKcWRm.js} +42 -82
- package/dist/conversation-identity-BpkAzklg.js +94 -0
- package/dist/{directory-config-ByaUKL1f.js → directory-config-BUe-qq_C.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BX79ImQA.js → directory-live-DZByMdPO.js} +6 -6
- package/dist/{doctor-Bgoxm5AN.js → doctor-bMaWXFKu.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-CU7lnZTF.js → doctor-contract-wId6pV41.js} +41 -37
- package/dist/{handle-action.guild-admin-CgJSNVui.js → handle-action.guild-admin-C_PQcBEV.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +24 -2
- package/dist/{manager.runtime-DaB-CTrt.js → manager.runtime-3RVMVkyx.js} +546 -154
- package/dist/{message-handler-DcgvugZt.js → message-handler-CIxWq5Yh.js} +8 -9
- package/dist/{message-handler.preflight-DvLXiYVH.js → message-handler.preflight-BI86IbHz.js} +46 -22
- package/dist/{message-handler.process-Cjf30P_B.js → message-handler.process-bPS_9_tb.js} +241 -107
- package/dist/{message-utils-B_3yA5bN.js → message-utils-D4j07taS.js} +2 -3
- package/dist/{outbound-adapter-82RWi_SR.js → outbound-adapter-Czny0Fae.js} +16 -68
- package/dist/outbound-components-oJKLj62G.js +99 -0
- package/dist/pluralkit-UXq1OyUI.js +40 -0
- package/dist/{probe-D1ImJEo2.js → probe-DxjMBeVG.js} +1 -1
- package/dist/{probe.runtime-B1dsEeBD.js → probe.runtime-Bc8Oo6e8.js} +1 -1
- package/dist/{provider-BkfbC9FQ.js → provider-DWvDNb4J.js} +702 -236
- package/dist/{provider-session.runtime-BDjyFw6Y.js → provider-session.runtime-D5pCGibh.js} +3 -3
- package/dist/provider.runtime-C2iIfbTs.js +2 -0
- package/dist/{resolve-allowlist-common-CWbE8XlH.js → resolve-allowlist-common-B9S8LLBd.js} +5 -5
- package/dist/{resolve-channels-CcpvWoRa.js → resolve-channels-BrkWOKdG.js} +7 -7
- package/dist/{resolve-users-DJamun9s.js → resolve-users-OjrXXvJP.js} +5 -5
- package/dist/{runtime-C6rRmQ6l.js → runtime-C618lis9.js} +223 -33
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +23 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-DSbfGnzS.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-iJ0B4bAX.js → send-BFpa_DHn.js} +21 -12
- package/dist/{send.components-D0I39utR.js → send.components-BaXQJKWT.js} +15 -10
- package/dist/{send.outbound-Bj61Q3a0.js → send.outbound-BlA6VzSE.js} +22 -12
- package/dist/{send.receipt-BpBQED_5.js → send.receipt-aegk69an.js} +59 -75
- package/dist/{send.shared-wAwMhHDN.js → send.shared-Xz7IMVpu.js} +44 -20
- package/dist/{sender-identity-CEsfDF0L.js → sender-identity-C62lBe18.js} +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BQVKfnev.js → shared-BLYBt5SA.js} +3 -3
- package/dist/{subagent-hooks-B-bJxxGg.js → subagent-hooks-DKJ4p-Oy.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DVnqSyTt.js → system-events-DKwfE-2z.js} +2 -2
- package/dist/{target-resolver-CwHaSLt3.js → target-resolver-BQyEHyeS.js} +2 -2
- package/dist/targets-DvItNIvP.js +3 -0
- package/dist/thread-binding-api-BDZJD4na.js +4 -0
- package/dist/thread-binding-api.js +1 -3
- package/dist/{thread-bindings-DsTxqu3E.js → thread-bindings-BbzjUuNB.js} +26 -43
- package/dist/{thread-bindings.discord-api-BjIf9lGs.js → thread-bindings.discord-api-DJD3qwIN.js} +8 -10
- package/dist/{thread-bindings.manager-Bwmtqc3E.js → thread-bindings.manager-BIBm6bQd.js} +4 -4
- package/dist/{thread-bindings.session-updates-Chs3HgGa.js → thread-bindings.session-updates-eRcJlzIU.js} +1 -1
- package/dist/{thread-bindings.state-iSWjCYjB.js → thread-bindings.state-9VAxhVf6.js} +3 -14
- package/dist/{timeouts-C5TBc_9x.js → timeouts-ZRc9Lw4y.js} +3 -15
- package/dist/timeouts.js +1 -1
- package/dist/{transcripts-source-BvvM5Ns9.js → transcripts-source-CLZ5X8fh.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BVcJgILg.js → typing-BnYT7Szq.js} +2 -2
- package/node_modules/p-map/index.d.ts +155 -0
- package/node_modules/p-map/index.js +284 -0
- package/node_modules/p-map/license +9 -0
- package/node_modules/p-map/package.json +57 -0
- package/node_modules/p-map/readme.md +190 -0
- package/npm-shrinkwrap.json +16 -3
- package/openclaw.plugin.json +70 -2
- package/package.json +6 -4
- package/dist/config-api-JiPdJeb0.js +0 -2
- package/dist/conversation-identity-DWC5d8Sy.js +0 -272
- package/dist/pluralkit-DcD-3EcL.js +0 -24
- package/dist/preview-streaming-DXT8oJdo.js +0 -8
- package/dist/provider.runtime-WrJXikSv.js +0 -2
- package/dist/runtime-api.monitor-C2_WVtJf.js +0 -6
- package/dist/targets-69w7c3vU.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-
|
|
2
|
-
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
3
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
1
|
+
import { a as reconcileAcpThreadBindingsOnStartup } from "./thread-bindings-BbzjUuNB.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-BIBm6bQd.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CIxWq5Yh.js";
|
|
4
4
|
import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled } from "openclaw/plugin-sdk/conversation-runtime";
|
|
5
5
|
import { getAcpSessionManager, isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
|
|
6
6
|
export { createDiscordMessageHandler, createNoopThreadBindingManager, createThreadBindingManager, getAcpSessionManager, isAcpRuntimeError, reconcileAcpThreadBindingsOnStartup, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as normalizeDiscordSlug } from "./allow-list-
|
|
2
|
+
import { r as fetchDiscord } from "./api--f62GFaS.js";
|
|
3
|
+
import { a as normalizeDiscordSlug } from "./allow-list-B7qOH5xu.js";
|
|
4
4
|
//#region extensions/discord/src/guilds.ts
|
|
5
|
-
async function listGuilds(token, fetcher) {
|
|
6
|
-
return (await fetchDiscord("/users/@me/guilds", token, fetcher)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
|
|
5
|
+
async function listGuilds(token, fetcher, options) {
|
|
6
|
+
return (await fetchDiscord("/users/@me/guilds", token, fetcher, options)).filter((guild) => typeof guild.id === "string" && typeof guild.name === "string").map((guild) => ({
|
|
7
7
|
id: guild.id,
|
|
8
8
|
name: guild.name,
|
|
9
9
|
slug: normalizeDiscordSlug(guild.name)
|
|
@@ -15,7 +15,7 @@ function resolveDiscordAllowlistToken(token) {
|
|
|
15
15
|
return normalizeDiscordToken(token, "channels.discord.token");
|
|
16
16
|
}
|
|
17
17
|
function buildDiscordUnresolvedResults(entries, buildResult) {
|
|
18
|
-
return entries.map(
|
|
18
|
+
return entries.map(buildResult);
|
|
19
19
|
}
|
|
20
20
|
function findDiscordGuildByName(guilds, input) {
|
|
21
21
|
const slug = normalizeDiscordSlug(input);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as fetchDiscord, t as
|
|
3
|
-
import { a as normalizeDiscordSlug } from "./allow-list-
|
|
4
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
1
|
+
import { Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { n as DiscordApiError, r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api--f62GFaS.js";
|
|
3
|
+
import { a as normalizeDiscordSlug } from "./allow-list-B7qOH5xu.js";
|
|
4
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-B9S8LLBd.js";
|
|
5
5
|
//#region extensions/discord/src/resolve-channels.ts
|
|
6
6
|
var resolve_channels_exports = /* @__PURE__ */ __exportAll({ resolveDiscordChannelAllowlist: () => resolveDiscordChannelAllowlist });
|
|
7
7
|
function parseDiscordChannelInput(raw) {
|
|
@@ -45,7 +45,7 @@ function parseDiscordChannelInput(raw) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
async function listGuildChannels(token, fetcher, guildId) {
|
|
48
|
-
return (await fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher)).map((channel) => {
|
|
48
|
+
return (await fetchDiscord(`/guilds/${guildId}/channels`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS })).map((channel) => {
|
|
49
49
|
const archived = channel.thread_metadata?.archived;
|
|
50
50
|
return {
|
|
51
51
|
id: typeof channel.id === "string" ? channel.id : "",
|
|
@@ -59,7 +59,7 @@ async function listGuildChannels(token, fetcher, guildId) {
|
|
|
59
59
|
async function fetchChannel(token, fetcher, channelId) {
|
|
60
60
|
let raw;
|
|
61
61
|
try {
|
|
62
|
-
raw = await fetchDiscord(`/channels/${channelId}`, token, fetcher);
|
|
62
|
+
raw = await fetchDiscord(`/channels/${channelId}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
63
63
|
} catch (err) {
|
|
64
64
|
if (err instanceof DiscordApiError && err.status === 403) return { status: "forbidden" };
|
|
65
65
|
if (err instanceof DiscordApiError && err.status === 404) return { status: "not-found" };
|
|
@@ -95,7 +95,7 @@ async function resolveDiscordChannelAllowlist(params) {
|
|
|
95
95
|
resolved: false
|
|
96
96
|
}));
|
|
97
97
|
const fetcher = params.fetcher ?? fetch;
|
|
98
|
-
const guilds = await listGuilds(token, fetcher);
|
|
98
|
+
const guilds = await listGuilds(token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
99
99
|
const channelsByGuild = /* @__PURE__ */ new Map();
|
|
100
100
|
const getChannels = (guildId) => {
|
|
101
101
|
const existing = channelsByGuild.get(guildId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-
|
|
1
|
+
import { Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api--f62GFaS.js";
|
|
3
|
+
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-B9S8LLBd.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/discord/src/resolve-users.ts
|
|
6
6
|
var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
|
|
@@ -52,7 +52,7 @@ async function resolveDiscordUserAllowlist(params) {
|
|
|
52
52
|
const fetcher = params.fetcher ?? fetch;
|
|
53
53
|
let guilds = null;
|
|
54
54
|
const getGuilds = async () => {
|
|
55
|
-
if (!guilds) guilds = await listGuilds(token, fetcher);
|
|
55
|
+
if (!guilds) guilds = await listGuilds(token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
56
56
|
return guilds;
|
|
57
57
|
};
|
|
58
58
|
const results = [];
|
|
@@ -85,7 +85,7 @@ async function resolveDiscordUserAllowlist(params) {
|
|
|
85
85
|
query,
|
|
86
86
|
limit: "25"
|
|
87
87
|
});
|
|
88
|
-
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token, fetcher);
|
|
88
|
+
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
|
|
89
89
|
for (const member of members) {
|
|
90
90
|
const score = scoreDiscordMember(member, query);
|
|
91
91
|
if (score === 0) continue;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Yt as resolveDiscordChannelId, r as createReusableDiscordReplyReference } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { a as mergeDiscordAccountConfig, o as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
4
|
-
import { _ as withNormalizedTimestamp, c as jsonResult, d as readNonNegativeIntegerParam, f as readPositiveIntegerParam, g as resolvePollMaxSelections, h as readStringParam, l as parseAvailableTags, m as readStringArrayParam, p as readReactionParams, r as sendDiscordComponentMessage, s as assertMediaNotDataUrl, u as readBooleanParam } from "./send.components-
|
|
3
|
+
import { d as readDiscordComponentSpec } from "./components-BVrfRS-F.js";
|
|
4
|
+
import { _ as withNormalizedTimestamp, c as jsonResult, d as readNonNegativeIntegerParam, f as readPositiveIntegerParam, g as resolvePollMaxSelections, h as readStringParam, l as parseAvailableTags, m as readStringArrayParam, p as readReactionParams, r as sendDiscordComponentMessage, s as assertMediaNotDataUrl, u as readBooleanParam } from "./send.components-BaXQJKWT.js";
|
|
5
5
|
import { n as getPresence } from "./presence-cache-z1N8MbJ3.js";
|
|
6
|
-
import { E as canManageGuildRoleDiscord, L as createDiscordRuntimeAccountContext, M as hasAnyGuildPermissionDiscord, N as isThreadChannelType$1, O as fetchChannelPermissionsDiscord, T as canManageGuildMemberRoleDiscord, W as getGateway, d as resolveDiscordTargetChannelId, j as hasAnyChannelPermissionDiscord } from "./send.shared-
|
|
7
|
-
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy } from "./allow-list-
|
|
8
|
-
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
9
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
10
|
-
import "./targets-
|
|
6
|
+
import { E as canManageGuildRoleDiscord, L as createDiscordRuntimeAccountContext, M as hasAnyGuildPermissionDiscord, N as isThreadChannelType$1, O as fetchChannelPermissionsDiscord, T as canManageGuildMemberRoleDiscord, W as getGateway, d as resolveDiscordTargetChannelId, j as hasAnyChannelPermissionDiscord } from "./send.shared-Xz7IMVpu.js";
|
|
7
|
+
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy, v as resolveGroupDmAllow } from "./allow-list-B7qOH5xu.js";
|
|
8
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-BFpa_DHn.js";
|
|
9
|
+
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
10
|
+
import "./targets-DvItNIvP.js";
|
|
11
11
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
12
|
import { ChannelType, PermissionFlagsBits } from "discord-api-types/v10";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
14
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
14
15
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
15
16
|
//#region extensions/discord/src/actions/runtime.messaging.runtime.ts
|
|
16
17
|
const discordMessagingActionRuntime = {
|
|
@@ -145,6 +146,40 @@ function resolveDiscordActionGuildEntry(params) {
|
|
|
145
146
|
id: guildId
|
|
146
147
|
} : null;
|
|
147
148
|
}
|
|
149
|
+
async function resolveDiscordReadAncestry(params) {
|
|
150
|
+
const ancestors = [];
|
|
151
|
+
const visited = /* @__PURE__ */ new Set([params.channelId]);
|
|
152
|
+
let parentId = params.parentId;
|
|
153
|
+
for (let depth = 0; parentId && depth < 2; depth++) {
|
|
154
|
+
if (visited.has(parentId)) return {
|
|
155
|
+
ancestors,
|
|
156
|
+
complete: false
|
|
157
|
+
};
|
|
158
|
+
visited.add(parentId);
|
|
159
|
+
const parent = await params.loadChannel(parentId);
|
|
160
|
+
if (!parent) {
|
|
161
|
+
ancestors.push({
|
|
162
|
+
channelId: parentId,
|
|
163
|
+
channelSlug: normalizeDiscordSlug(parentId) || parentId
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
ancestors,
|
|
167
|
+
complete: false
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const parentName = readDiscordChannelStringField(parent, "name");
|
|
171
|
+
ancestors.push({
|
|
172
|
+
channelId: parentId,
|
|
173
|
+
...parentName ? { channelName: parentName } : {},
|
|
174
|
+
channelSlug: parentName ? normalizeDiscordSlug(parentName) : parentId
|
|
175
|
+
});
|
|
176
|
+
parentId = readDiscordChannelStringField(parent, "parent_id", "parentId");
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
ancestors,
|
|
180
|
+
complete: !parentId
|
|
181
|
+
};
|
|
182
|
+
}
|
|
148
183
|
function readDiscordChannelStringField(value, ...keys) {
|
|
149
184
|
if (!value || typeof value !== "object") return;
|
|
150
185
|
const record = value;
|
|
@@ -162,7 +197,24 @@ function isDiscordThreadChannel(value) {
|
|
|
162
197
|
const type = readDiscordChannelType(value);
|
|
163
198
|
return type === 10 || type === 11 || type === 12;
|
|
164
199
|
}
|
|
200
|
+
function isDiscordReadAncestryAllowed(params) {
|
|
201
|
+
for (const ancestor of params.target.ancestors) {
|
|
202
|
+
const config = resolveDiscordChannelConfigWithFallback({
|
|
203
|
+
guildInfo: params.guildInfo,
|
|
204
|
+
channelId: ancestor.channelId,
|
|
205
|
+
channelName: ancestor.channelName,
|
|
206
|
+
channelSlug: ancestor.channelSlug
|
|
207
|
+
});
|
|
208
|
+
if (config?.matchSource === "direct" && !config.allowed) return false;
|
|
209
|
+
}
|
|
210
|
+
return params.target.ancestryComplete || !hasExplicitlyDisabledDiscordChannels(params.guildInfo?.channels);
|
|
211
|
+
}
|
|
165
212
|
function isDiscordReadTargetAllowedInGuild(params) {
|
|
213
|
+
if (!params.target.metadataKnown) {
|
|
214
|
+
if (hasExplicitlyDisabledDiscordChannels(params.guildInfo?.channels)) return false;
|
|
215
|
+
return isDiscordReadTargetExplicitlyAllowedById(params);
|
|
216
|
+
}
|
|
217
|
+
if (!isDiscordReadAncestryAllowed(params)) return false;
|
|
166
218
|
if (resolveDiscordChannelConfigWithFallback({
|
|
167
219
|
guildInfo: params.guildInfo,
|
|
168
220
|
channelId: params.target.channelId,
|
|
@@ -190,23 +242,41 @@ function isDiscordReadTargetExplicitlyAllowedById(params) {
|
|
|
190
242
|
channelAllowed: true
|
|
191
243
|
});
|
|
192
244
|
}
|
|
245
|
+
function hasExplicitlyDisabledDiscordChannelConfig(guilds) {
|
|
246
|
+
return Object.values(guilds ?? {}).some((guild) => hasExplicitlyDisabledDiscordChannels(guild?.channels));
|
|
247
|
+
}
|
|
248
|
+
function hasExplicitlyDisabledDiscordChannels(channels) {
|
|
249
|
+
return Object.values(channels ?? {}).some((channel) => channel.enabled === false);
|
|
250
|
+
}
|
|
193
251
|
function createDiscordMessagingActionContext(params) {
|
|
194
252
|
const accountId = readStringParam(params.input, "accountId");
|
|
195
253
|
const cfgOptions = { cfg: params.cfg };
|
|
196
254
|
const accountConfig = mergeDiscordAccountConfig(params.cfg, accountId ?? resolveDefaultDiscordAccountId(params.cfg));
|
|
197
255
|
const guilds = accountConfig.guilds;
|
|
198
|
-
const hasGuildEntries = Object.keys(guilds ?? {}).length > 0;
|
|
199
256
|
const { groupPolicy } = resolveOpenProviderRuntimeGroupPolicy({
|
|
200
257
|
providerConfigPresent: params.cfg.channels?.discord !== void 0,
|
|
201
258
|
groupPolicy: accountConfig.groupPolicy,
|
|
202
259
|
defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
|
|
203
260
|
});
|
|
261
|
+
const directOperator = params.options?.conversationReadOrigin === "direct-operator";
|
|
262
|
+
const currentReadContext = params.options?.readContext;
|
|
263
|
+
const directDmEnabled = accountConfig.dm?.enabled !== false && (accountConfig.dmPolicy ?? accountConfig.dm?.policy ?? "pairing") !== "disabled";
|
|
204
264
|
const withOpts = (extra) => createDiscordActionOptions({
|
|
205
265
|
cfg: params.cfg,
|
|
206
266
|
accountId,
|
|
207
267
|
extra
|
|
208
268
|
});
|
|
209
269
|
const resolvedReactionAccountId = accountId ?? resolveDefaultDiscordAccountId(params.cfg);
|
|
270
|
+
const isCurrentReadTarget = (channelId) => {
|
|
271
|
+
const requesterAccountId = currentReadContext?.requesterAccountId?.trim();
|
|
272
|
+
const currentChannelId = currentReadContext?.currentChannelId?.trim();
|
|
273
|
+
if (currentReadContext?.currentChannelProvider?.trim().toLowerCase() !== "discord" || !requesterAccountId || !currentChannelId || normalizeAccountId(requesterAccountId) !== normalizeAccountId(resolvedReactionAccountId)) return false;
|
|
274
|
+
try {
|
|
275
|
+
return discordMessagingActionRuntime.resolveDiscordChannelId(currentChannelId) === channelId;
|
|
276
|
+
} catch {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
210
280
|
const reactionRuntimeOptions = resolvedReactionAccountId ? createDiscordRuntimeAccountContext({
|
|
211
281
|
cfg: params.cfg,
|
|
212
282
|
accountId: resolvedReactionAccountId
|
|
@@ -246,7 +316,10 @@ function createDiscordMessagingActionContext(params) {
|
|
|
246
316
|
const resolveReadTargetContext = async (channelId) => {
|
|
247
317
|
const fallback = {
|
|
248
318
|
channelId,
|
|
249
|
-
channelSlug: normalizeDiscordSlug(channelId) || channelId
|
|
319
|
+
channelSlug: normalizeDiscordSlug(channelId) || channelId,
|
|
320
|
+
metadataKnown: false,
|
|
321
|
+
ancestryComplete: false,
|
|
322
|
+
ancestors: []
|
|
250
323
|
};
|
|
251
324
|
let channelInfo;
|
|
252
325
|
try {
|
|
@@ -257,24 +330,67 @@ function createDiscordMessagingActionContext(params) {
|
|
|
257
330
|
const channelName = readDiscordChannelStringField(channelInfo, "name");
|
|
258
331
|
const target = {
|
|
259
332
|
channelId,
|
|
260
|
-
channelSlug: channelName ? normalizeDiscordSlug(channelName) : fallback.channelSlug
|
|
333
|
+
channelSlug: channelName ? normalizeDiscordSlug(channelName) : fallback.channelSlug,
|
|
334
|
+
metadataKnown: true,
|
|
335
|
+
ancestryComplete: true,
|
|
336
|
+
ancestors: []
|
|
261
337
|
};
|
|
338
|
+
const channelType = readDiscordChannelType(channelInfo);
|
|
339
|
+
if (channelType !== void 0) target.channelType = channelType;
|
|
262
340
|
const targetGuildId = readDiscordChannelStringField(channelInfo, "guild_id", "guildId");
|
|
263
341
|
if (targetGuildId) target.guildId = targetGuildId;
|
|
264
342
|
if (channelName) target.channelName = channelName;
|
|
265
|
-
if (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
343
|
+
if (isDiscordThreadChannel(channelInfo)) target.scope = "thread";
|
|
344
|
+
const ancestry = await resolveDiscordReadAncestry({
|
|
345
|
+
channelId,
|
|
346
|
+
parentId: readDiscordChannelStringField(channelInfo, "parent_id", "parentId"),
|
|
347
|
+
loadChannel: async (parentId) => {
|
|
348
|
+
try {
|
|
349
|
+
return await discordMessagingActionRuntime.fetchChannelInfoDiscord(parentId, withOpts());
|
|
350
|
+
} catch {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
274
353
|
}
|
|
275
|
-
}
|
|
354
|
+
});
|
|
355
|
+
target.ancestors = ancestry.ancestors;
|
|
356
|
+
target.ancestryComplete = ancestry.complete;
|
|
357
|
+
const immediateParent = target.ancestors[0];
|
|
358
|
+
if (!immediateParent) return target;
|
|
359
|
+
target.parentId = immediateParent.channelId;
|
|
360
|
+
if (immediateParent.channelName) target.parentName = immediateParent.channelName;
|
|
361
|
+
target.parentSlug = immediateParent.channelSlug;
|
|
276
362
|
return target;
|
|
277
363
|
};
|
|
364
|
+
const isExpandedReadTargetEnabled = (guildInfo, target, currentConversation) => {
|
|
365
|
+
const groupDmEnabled = accountConfig.dm?.groupEnabled === true && (currentConversation || resolveGroupDmAllow({
|
|
366
|
+
channels: accountConfig.dm?.groupChannels,
|
|
367
|
+
channelId: target.channelId,
|
|
368
|
+
channelName: target.channelName,
|
|
369
|
+
channelSlug: target.channelSlug
|
|
370
|
+
}));
|
|
371
|
+
if (!target.metadataKnown) return groupPolicy !== "disabled" && directDmEnabled && groupDmEnabled && !hasExplicitlyDisabledDiscordChannelConfig(guilds);
|
|
372
|
+
if (!target.guildId) {
|
|
373
|
+
if (target.channelType === ChannelType.GroupDM) return groupDmEnabled;
|
|
374
|
+
if (target.channelType === ChannelType.DM) return directDmEnabled;
|
|
375
|
+
return directDmEnabled && groupDmEnabled;
|
|
376
|
+
}
|
|
377
|
+
if (groupPolicy === "disabled") return false;
|
|
378
|
+
if (!isDiscordReadAncestryAllowed({
|
|
379
|
+
guildInfo,
|
|
380
|
+
target
|
|
381
|
+
})) return false;
|
|
382
|
+
const channelConfig = resolveDiscordChannelConfigWithFallback({
|
|
383
|
+
guildInfo,
|
|
384
|
+
channelId: target.channelId,
|
|
385
|
+
channelName: target.channelName,
|
|
386
|
+
channelSlug: target.channelSlug,
|
|
387
|
+
parentId: target.parentId,
|
|
388
|
+
parentName: target.parentName,
|
|
389
|
+
parentSlug: target.parentSlug,
|
|
390
|
+
scope: target.scope
|
|
391
|
+
});
|
|
392
|
+
return !channelConfig?.matchSource || channelConfig.allowed;
|
|
393
|
+
};
|
|
278
394
|
return {
|
|
279
395
|
action: params.action,
|
|
280
396
|
params: params.input,
|
|
@@ -285,11 +401,12 @@ function createDiscordMessagingActionContext(params) {
|
|
|
285
401
|
resolveChannelId: () => discordMessagingActionRuntime.resolveDiscordChannelId(readStringParam(params.input, "channelId", { required: true })),
|
|
286
402
|
assertReadTargetAllowed: async ({ guildId, channelId }) => {
|
|
287
403
|
const targetChannelId = discordMessagingActionRuntime.resolveDiscordChannelId(channelId);
|
|
288
|
-
if (!hasGuildEntries && groupPolicy !== "disabled" && groupPolicy !== "allowlist") return;
|
|
289
404
|
const target = await resolveReadTargetContext(targetChannelId);
|
|
405
|
+
const currentConversation = isCurrentReadTarget(targetChannelId);
|
|
290
406
|
if (guildId) {
|
|
291
|
-
if (target.
|
|
407
|
+
if (target.metadataKnown && target.guildId !== guildId) throw new Error("Discord read target channel is not allowed.");
|
|
292
408
|
const guildInfo = await resolveReadGuildEntry(guildId);
|
|
409
|
+
if (directOperator && isExpandedReadTargetEnabled(guildInfo, target, false) || currentConversation && isExpandedReadTargetEnabled(guildInfo, target, true)) return;
|
|
293
410
|
if (!isDiscordReadTargetAllowedInGuild({
|
|
294
411
|
groupPolicy,
|
|
295
412
|
guildInfo,
|
|
@@ -299,6 +416,7 @@ function createDiscordMessagingActionContext(params) {
|
|
|
299
416
|
}
|
|
300
417
|
if (target.guildId) {
|
|
301
418
|
const guildInfo = await resolveReadGuildEntry(target.guildId);
|
|
419
|
+
if (directOperator && isExpandedReadTargetEnabled(guildInfo, target, false) || currentConversation && isExpandedReadTargetEnabled(guildInfo, target, true)) return;
|
|
302
420
|
if (!isDiscordReadTargetAllowedInGuild({
|
|
303
421
|
groupPolicy,
|
|
304
422
|
guildInfo,
|
|
@@ -306,14 +424,17 @@ function createDiscordMessagingActionContext(params) {
|
|
|
306
424
|
})) throw new Error("Discord read target channel is not allowed.");
|
|
307
425
|
return;
|
|
308
426
|
}
|
|
309
|
-
|
|
427
|
+
const allowed = !target.metadataKnown && Object.values(guilds ?? {}).some((guildInfo) => isDiscordReadTargetAllowedInGuild({
|
|
310
428
|
groupPolicy,
|
|
311
429
|
guildInfo: guildInfo ?? null,
|
|
312
430
|
target
|
|
313
|
-
}))
|
|
431
|
+
}));
|
|
432
|
+
if (directOperator && isExpandedReadTargetEnabled(null, target, false) || currentConversation && isExpandedReadTargetEnabled(null, target, true)) return;
|
|
433
|
+
if (!allowed) throw new Error("Discord read target channel is not allowed.");
|
|
314
434
|
},
|
|
315
|
-
assertGuildReadTargetAllowed: async ({ guildId, channelTargetRequiredMessage }) => {
|
|
435
|
+
assertGuildReadTargetAllowed: async ({ guildId, channelTargetRequiredMessage, filteredResults }) => {
|
|
316
436
|
const guildInfo = await resolveReadGuildEntry(guildId);
|
|
437
|
+
if (directOperator && groupPolicy !== "disabled" && (filteredResults === true || !hasExplicitlyDisabledDiscordChannels(guildInfo?.channels))) return;
|
|
317
438
|
if (!isDiscordGroupAllowedByPolicy({
|
|
318
439
|
groupPolicy,
|
|
319
440
|
guildAllowlisted: Boolean(guildInfo),
|
|
@@ -322,6 +443,61 @@ function createDiscordMessagingActionContext(params) {
|
|
|
322
443
|
})) throw new Error("Discord read target channel is not allowed.");
|
|
323
444
|
if (hasDiscordGuildEntries(guildInfo?.channels) && !allowsAllDiscordGuildChannels(guildInfo.channels)) throw new Error(channelTargetRequiredMessage ?? "Discord message search requires channelId or channelIds so each read target can be authorized.");
|
|
324
445
|
},
|
|
446
|
+
filterGuildChannelList: async ({ guildId, channels }) => {
|
|
447
|
+
if (!directOperator) return channels;
|
|
448
|
+
const guildInfo = await resolveReadGuildEntry(guildId);
|
|
449
|
+
const channelById = new Map(channels.flatMap((channel) => {
|
|
450
|
+
const channelId = readDiscordChannelStringField(channel, "id");
|
|
451
|
+
return channelId ? [[channelId, channel]] : [];
|
|
452
|
+
}));
|
|
453
|
+
const visibleChannels = [];
|
|
454
|
+
for (const channel of channels) {
|
|
455
|
+
const channelId = readDiscordChannelStringField(channel, "id");
|
|
456
|
+
if (!channelId) continue;
|
|
457
|
+
const channelName = readDiscordChannelStringField(channel, "name");
|
|
458
|
+
const channelType = readDiscordChannelType(channel);
|
|
459
|
+
const target = {
|
|
460
|
+
channelId,
|
|
461
|
+
channelSlug: channelName ? normalizeDiscordSlug(channelName) : channelId,
|
|
462
|
+
guildId,
|
|
463
|
+
metadataKnown: true,
|
|
464
|
+
ancestryComplete: true,
|
|
465
|
+
ancestors: [],
|
|
466
|
+
...channelName ? { channelName } : {},
|
|
467
|
+
...channelType !== void 0 ? { channelType } : {},
|
|
468
|
+
...isDiscordThreadChannel(channel) ? { scope: "thread" } : {}
|
|
469
|
+
};
|
|
470
|
+
const ancestry = await resolveDiscordReadAncestry({
|
|
471
|
+
channelId,
|
|
472
|
+
parentId: readDiscordChannelStringField(channel, "parent_id", "parentId"),
|
|
473
|
+
loadChannel: async (parentId) => channelById.get(parentId)
|
|
474
|
+
});
|
|
475
|
+
target.ancestors = ancestry.ancestors;
|
|
476
|
+
target.ancestryComplete = ancestry.complete;
|
|
477
|
+
const immediateParent = target.ancestors[0];
|
|
478
|
+
if (immediateParent) {
|
|
479
|
+
target.parentId = immediateParent.channelId;
|
|
480
|
+
if (immediateParent.channelName) target.parentName = immediateParent.channelName;
|
|
481
|
+
target.parentSlug = immediateParent.channelSlug;
|
|
482
|
+
}
|
|
483
|
+
if (!isDiscordReadAncestryAllowed({
|
|
484
|
+
guildInfo,
|
|
485
|
+
target
|
|
486
|
+
})) continue;
|
|
487
|
+
const channelConfig = resolveDiscordChannelConfigWithFallback({
|
|
488
|
+
guildInfo,
|
|
489
|
+
channelId,
|
|
490
|
+
channelName,
|
|
491
|
+
channelSlug: target.channelSlug,
|
|
492
|
+
parentId: target.parentId,
|
|
493
|
+
parentName: target.parentName,
|
|
494
|
+
parentSlug: target.parentSlug,
|
|
495
|
+
scope: target.scope
|
|
496
|
+
});
|
|
497
|
+
if (!channelConfig?.matchSource || channelConfig.allowed) visibleChannels.push(channel);
|
|
498
|
+
}
|
|
499
|
+
return visibleChannels;
|
|
500
|
+
},
|
|
325
501
|
resolveReactionChannelId: async () => {
|
|
326
502
|
const target = readStringParam(params.input, "channelId") ?? readStringParam(params.input, "to", { required: true });
|
|
327
503
|
return await discordMessagingActionRuntime.resolveDiscordReactionTargetChannelId({
|
|
@@ -533,9 +709,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
533
709
|
accountId,
|
|
534
710
|
extra
|
|
535
711
|
});
|
|
536
|
-
const assertGuildMetadataReadAllowed = async (guildId) => {
|
|
712
|
+
const assertGuildMetadataReadAllowed = async (guildId, readOptions) => {
|
|
537
713
|
await readTargetGate.assertGuildReadTargetAllowed({
|
|
538
714
|
guildId,
|
|
715
|
+
filteredResults: readOptions?.filteredResults,
|
|
539
716
|
channelTargetRequiredMessage: "Discord guild metadata reads require a wildcard channel allowlist for this guild."
|
|
540
717
|
});
|
|
541
718
|
};
|
|
@@ -644,10 +821,14 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
644
821
|
case "channelList": {
|
|
645
822
|
if (!isActionEnabled("channelInfo")) throw new Error("Discord channel info is disabled.");
|
|
646
823
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
647
|
-
await assertGuildMetadataReadAllowed(guildId);
|
|
824
|
+
await assertGuildMetadataReadAllowed(guildId, { filteredResults: true });
|
|
825
|
+
const channels = await discordGuildActionRuntime.listGuildChannelsDiscord(guildId, withOpts());
|
|
648
826
|
return jsonResult({
|
|
649
827
|
ok: true,
|
|
650
|
-
channels: await
|
|
828
|
+
channels: await readTargetGate.filterGuildChannelList({
|
|
829
|
+
guildId,
|
|
830
|
+
channels
|
|
831
|
+
})
|
|
651
832
|
});
|
|
652
833
|
}
|
|
653
834
|
case "voiceStatus": {
|
|
@@ -858,6 +1039,7 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
858
1039
|
const channelId = ctx.resolveChannelId();
|
|
859
1040
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
860
1041
|
const content = readStringParam(ctx.params, "content", { required: true });
|
|
1042
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
861
1043
|
return jsonResult({
|
|
862
1044
|
ok: true,
|
|
863
1045
|
message: await discordMessagingActionRuntime.editMessageDiscord(channelId, messageId, { content }, ctx.withOpts())
|
|
@@ -867,6 +1049,7 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
867
1049
|
if (!ctx.isActionEnabled("messages")) throw new Error("Discord message deletes are disabled.");
|
|
868
1050
|
const channelId = ctx.resolveChannelId();
|
|
869
1051
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1052
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
870
1053
|
await discordMessagingActionRuntime.deleteMessageDiscord(channelId, messageId, ctx.withOpts());
|
|
871
1054
|
return jsonResult({ ok: true });
|
|
872
1055
|
}
|
|
@@ -874,6 +1057,7 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
874
1057
|
if (!ctx.isActionEnabled("pins")) throw new Error("Discord pins are disabled.");
|
|
875
1058
|
const channelId = ctx.resolveChannelId();
|
|
876
1059
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1060
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
877
1061
|
await discordMessagingActionRuntime.pinMessageDiscord(channelId, messageId, ctx.withOpts());
|
|
878
1062
|
return jsonResult({ ok: true });
|
|
879
1063
|
}
|
|
@@ -881,6 +1065,7 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
881
1065
|
if (!ctx.isActionEnabled("pins")) throw new Error("Discord pins are disabled.");
|
|
882
1066
|
const channelId = ctx.resolveChannelId();
|
|
883
1067
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1068
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
884
1069
|
await discordMessagingActionRuntime.unpinMessageDiscord(channelId, messageId, ctx.withOpts());
|
|
885
1070
|
return jsonResult({ ok: true });
|
|
886
1071
|
}
|
|
@@ -957,16 +1142,21 @@ async function handleDiscordReactionMessagingAction(ctx) {
|
|
|
957
1142
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
958
1143
|
const { emoji, remove, isEmpty } = readReactionParams(ctx.params, { removeErrorMessage: "Emoji is required to remove a Discord reaction." });
|
|
959
1144
|
if (remove) {
|
|
1145
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
960
1146
|
await discordMessagingActionRuntime.removeReactionDiscord(channelId, messageId, emoji, ctx.withReactionRuntimeOptions());
|
|
961
1147
|
return jsonResult({
|
|
962
1148
|
ok: true,
|
|
963
1149
|
removed: emoji
|
|
964
1150
|
});
|
|
965
1151
|
}
|
|
966
|
-
if (isEmpty)
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1152
|
+
if (isEmpty) {
|
|
1153
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
1154
|
+
return jsonResult({
|
|
1155
|
+
ok: true,
|
|
1156
|
+
removed: (await discordMessagingActionRuntime.removeOwnReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions())).removed
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
await ctx.assertReadTargetAllowed({ channelId });
|
|
970
1160
|
await discordMessagingActionRuntime.reactMessageDiscord(channelId, messageId, emoji, ctx.withReactionRuntimeOptions());
|
|
971
1161
|
return jsonResult({
|
|
972
1162
|
ok: true,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-
|
|
2
|
-
import { t as discordMessageActions } from "./channel-actions-
|
|
1
|
+
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-C618lis9.js";
|
|
2
|
+
import { t as discordMessageActions } from "./channel-actions-ChpBSRcu.js";
|
|
3
3
|
export { discordMessageActions, handleDiscordAction, isDiscordModerationAction, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, requiredGuildPermissionForModerationAction };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { C as resolveDiscordOutboundSessionRoute } from "./components-BVrfRS-F.js";
|
|
2
|
+
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-BaXQJKWT.js";
|
|
3
3
|
import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
4
|
-
import { A as hasAllGuildPermissionsDiscord, G as registerGateway, K as unregisterGateway, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, U as clearGateways, W as getGateway, k as fetchMemberGuildPermissionsDiscord, w as DiscordSendError } from "./send.shared-
|
|
5
|
-
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
6
|
-
import { _ as
|
|
7
|
-
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
8
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
4
|
+
import { A as hasAllGuildPermissionsDiscord, G as registerGateway, K as unregisterGateway, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, U as clearGateways, W as getGateway, k as fetchMemberGuildPermissionsDiscord, w as DiscordSendError } from "./send.shared-Xz7IMVpu.js";
|
|
5
|
+
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DZByMdPO.js";
|
|
6
|
+
import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-B7qOH5xu.js";
|
|
7
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-BFpa_DHn.js";
|
|
8
|
+
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
9
|
+
import { a as isAbortError, c as normalizeDiscordListenerTimeoutMs, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as mergeAbortSignals, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordInboundWorkerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, u as runDiscordTaskWithTimeout } from "./timeouts-ZRc9Lw4y.js";
|
|
9
10
|
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
10
|
-
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-
|
|
11
|
-
import { t as discordMessageActions } from "./channel-actions-
|
|
12
|
-
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-
|
|
13
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { i as
|
|
20
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-D1ImJEo2.js";
|
|
11
|
+
import { a as readDiscordChannelCreateParams, c as readDiscordParentIdParam, i as requiredGuildPermissionForModerationAction, n as isDiscordModerationAction, o as readDiscordChannelEditParams, r as readDiscordModerationCommand, s as readDiscordChannelMoveParams, t as handleDiscordAction } from "./runtime-C618lis9.js";
|
|
12
|
+
import { t as discordMessageActions } from "./channel-actions-ChpBSRcu.js";
|
|
13
|
+
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-9VAxhVf6.js";
|
|
14
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-eRcJlzIU.js";
|
|
15
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BrkWOKdG.js";
|
|
16
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-OjrXXvJP.js";
|
|
17
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-DJD3qwIN.js";
|
|
18
|
+
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-BbzjUuNB.js";
|
|
19
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-BIBm6bQd.js";
|
|
20
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DxjMBeVG.js";
|
|
21
21
|
import "./runtime-api.actions.js";
|
|
22
|
-
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-
|
|
22
|
+
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-Df2w046a.js";
|
|
23
23
|
import "./runtime-api.lookup.js";
|
|
24
|
-
import {
|
|
25
|
-
import { i as buildDiscordMediaPayload } from "./message-utils-
|
|
26
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
27
|
-
import "./runtime-api.monitor-
|
|
24
|
+
import { C as registerDiscordListener, E as resolveDiscordReplyTarget, O as sanitizeDiscordThreadName, d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, m as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin } from "./provider-DWvDNb4J.js";
|
|
25
|
+
import { i as buildDiscordMediaPayload } from "./message-utils-D4j07taS.js";
|
|
26
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CIxWq5Yh.js";
|
|
27
|
+
import "./runtime-api.monitor-DSbfGnzS.js";
|
|
28
28
|
import "./runtime-api.send.js";
|
|
29
29
|
import "./runtime-api.threads.js";
|
|
30
30
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DiscordSendError, testing as __testing, testing, addRoleDiscord, allowListMatches, auditDiscordChannelPermissions, autoBindSpawnedDiscordSubagent, banMemberDiscord, buildDiscordMediaPayload, clearGateways, clearPresences, collectDiscordAuditChannelIds, createChannelDiscord, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, createNoopThreadBindingManager, createScheduledEventDiscord, createThreadBindingManager, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, discordMessageActions, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, formatThreadBindingDurationLabel, getGateway, getPresence, getThreadBindingManager, handleDiscordAction, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, isAbortError, isDiscordGroupAllowedByPolicy, isDiscordModerationAction, isRecentlyUnboundThreadWebhookMessage, kickMemberDiscord, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadBindingsBySessionKey, listThreadBindingsForAccount, listThreadsDiscord, mergeAbortSignals, monitorDiscordProvider, moveChannelDiscord, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, parseApplicationIdFromToken, pinMessageDiscord, presenceCacheSize, probeDiscord, reactMessageDiscord, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, readMessagesDiscord, reconcileAcpThreadBindingsOnStartup, registerBuiltDiscordComponentMessage, registerDiscordListener, registerGateway, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, requiredGuildPermissionForModerationAction, resolveDiscordChannelAllowlist, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordOutboundSessionRoute, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveDiscordUserAllowlist, resolveEventCoverImage, resolveGroupDmAllow, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, setDiscordRuntime, setPresence, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, shouldEmitDiscordReactionNotification, timeoutMemberDiscord, unbindThreadBindingsBySessionKey, unpinMessageDiscord, unregisterGateway, uploadEmojiDiscord, uploadStickerDiscord, waitForDiscordGatewayPluginRegistration };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
1
|
+
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DZByMdPO.js";
|
|
2
2
|
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
3
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
4
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
5
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
6
|
-
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-
|
|
3
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-BrkWOKdG.js";
|
|
4
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-OjrXXvJP.js";
|
|
5
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DxjMBeVG.js";
|
|
6
|
+
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-Df2w046a.js";
|
|
7
7
|
export { auditDiscordChannelPermissions, collectDiscordAuditChannelIds, fetchDiscordApplicationId, fetchDiscordApplicationSummary, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, parseApplicationIdFromToken, probeDiscord, resolveDiscordChannelAllowlist, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordUserAllowlist, setDiscordRuntime };
|