@openclaw/discord 2026.5.28 → 2026.5.30-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/{account-inspect-C4sJZNbI.js → account-inspect-BkL-fm-M.js} +7 -5
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-CN_E7nkQ.js → approval-handler.runtime-BFLqemq4.js} +4 -4
- package/dist/{audit-BFCBp74H.js → audit-CKzCd_nb.js} +4 -4
- package/dist/{channel-COXb22wL.js → channel-DnUKVkVn.js} +16 -16
- package/dist/{channel-actions-C2g9OmnG.js → channel-actions-D60aLg8q.js} +3 -3
- package/dist/{channel-actions.runtime-drnbrgpt.js → channel-actions.runtime-D6awrVWB.js} +5 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-BsrP5-hv.js → channel.setup-Cqfoar5h.js} +6 -20
- package/dist/{components-CjQujWa1.js → components-CWgTTA0J.js} +1 -1
- package/dist/{config-schema-3tZYNVTM.js → config-schema-C1lzB2Ld.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{conversation-identity-CsPV1Gjx.js → conversation-identity-Dvi-8LyR.js} +2 -2
- package/dist/{directory-config-BqPvRoDv.js → directory-config-B-i4XzWZ.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-CCI0IMZq.js → directory-live-B5E-IbgC.js} +1 -1
- package/dist/{doctor-Dy7sI1sL.js → doctor-DT41iqQA.js} +2 -2
- package/dist/{handle-action.guild-admin-BmjclQbR.js → handle-action.guild-admin-B39nAL5c.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +3 -1
- package/dist/{manager.runtime-ClhnLsZf.js → manager.runtime-ClHe315Q.js} +16 -8
- package/dist/{message-handler-BnhAHqem.js → message-handler-Deidymb-.js} +182 -29
- package/dist/{message-handler.preflight-B1RTQ6ZO.js → message-handler.preflight-DeTwc2nk.js} +11 -11
- package/dist/{message-handler.process-B1ODKav3.js → message-handler.process-DJkFWirK.js} +30 -28
- package/dist/{message-utils-CmB03FoF.js → message-utils-C4OlktSy.js} +19 -15
- package/dist/{outbound-adapter-DfY2Dtf3.js → outbound-adapter-DCC3zPuC.js} +51 -86
- package/dist/{pluralkit-DAZN3ZMK.js → pluralkit-Dhad974D.js} +1 -1
- package/dist/{provider-DCcqVFp-.js → provider-SeIwaTTJ.js} +127 -133
- package/dist/{provider-session.runtime-mKSG07RE.js → provider-session.runtime-B5aLy8NA.js} +3 -3
- package/dist/provider.runtime-DVHYE9ZI.js +2 -0
- package/dist/{resolve-channels-D1zgoxnw.js → resolve-channels-LMOlvXSw.js} +1 -1
- package/dist/{resolve-users-wPAvLk_8.js → resolve-users-WNAKeCd_.js} +1 -1
- package/dist/{runtime-gaB5-Wsj.js → runtime-Dg0INaGm.js} +7 -7
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +21 -21
- package/dist/runtime-api.lookup.js +4 -4
- package/dist/runtime-api.monitor-C56AP2ZG.js +6 -0
- package/dist/runtime-api.monitor.js +5 -5
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-CBxhnbKU.js → send-DwUf-fzH.js} +6 -6
- package/dist/{send.components-uuQuHL3t.js → send.components-BVfuI0-G.js} +25 -11
- package/dist/{send.outbound-DZHJYmNF.js → send.outbound-4IJRwYbJ.js} +3 -3
- package/dist/{send.receipt-3y2lVFRf.js → send.receipt-CxFJX9o3.js} +22 -10
- package/dist/{send.shared-Ddl21-Gt.js → send.shared-DQwyGjXe.js} +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-D3NkInmq.js → shared-D-ePFtjZ.js} +3 -3
- package/dist/{subagent-hooks-BacIbIBD.js → subagent-hooks-CqhiwYpb.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -5
- package/dist/{system-events-Cw6Hp8RF.js → system-events-DZdHRt2j.js} +1 -1
- package/dist/{target-resolver-jjQzAS6T.js → target-resolver-DTD90GqZ.js} +2 -2
- package/dist/targets-xBATI2q7.js +3 -0
- package/dist/{thread-bindings-BBq-yzq2.js → thread-bindings-VrlFUPDW.js} +6 -6
- package/dist/{thread-bindings.discord-api-5QgEd_dW.js → thread-bindings.discord-api-CItgvv24.js} +5 -5
- package/dist/{thread-bindings.manager-COkxjwR9.js → thread-bindings.manager-hhqHJlGr.js} +4 -4
- package/dist/{thread-bindings.session-updates-D5gY2ZTE.js → thread-bindings.session-updates-0BaqAU8S.js} +1 -1
- package/dist/{thread-bindings.state-BsOnj5NX.js → thread-bindings.state-B-iprgEM.js} +8 -2
- package/dist/{timeouts-l_PsHQvX.js → timeouts-CEJ3--Uw.js} +5 -2
- package/dist/timeouts.js +1 -1
- package/dist/{transcripts-source-DDrS8HrV.js → transcripts-source-CFsqnHc4.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-B7bCMPJJ.js → typing-Bfns8H17.js} +2 -2
- package/npm-shrinkwrap.json +3 -3
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -4
- package/dist/provider.runtime-BmpunJHX.js +0 -2
- package/dist/runtime-api.monitor-B38upMUK.js +0 -5
- package/dist/targets-BVKF5wbg.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-
|
|
1
|
+
import { o as normalizeDiscordOutboundTarget, s as chunkDiscordTextWithMode, t as createDiscordSendReceipt, x as DiscordError } from "./send.receipt-CxFJX9o3.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-dXTfmnSZ.js";
|
|
3
|
-
import { d as readDiscordComponentSpec } from "./components-
|
|
3
|
+
import { d as readDiscordComponentSpec } from "./components-CWgTTA0J.js";
|
|
4
4
|
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-D5_VmM-_.js";
|
|
5
5
|
import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -86,11 +86,11 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
86
86
|
let discordComponentSendPromise;
|
|
87
87
|
let discordSharedInteractivePromise;
|
|
88
88
|
async function sendDiscordComponentMessageLazy(...args) {
|
|
89
|
-
discordComponentSendPromise ??= import("./send.components-
|
|
89
|
+
discordComponentSendPromise ??= import("./send.components-BVfuI0-G.js").then((n) => n.i).then((module) => module.sendDiscordComponentMessage);
|
|
90
90
|
return await (await discordComponentSendPromise)(...args);
|
|
91
91
|
}
|
|
92
92
|
function loadDiscordSharedInteractive() {
|
|
93
|
-
discordSharedInteractivePromise ??= import("./components-
|
|
93
|
+
discordSharedInteractivePromise ??= import("./components-CWgTTA0J.js").then((n) => n.a);
|
|
94
94
|
return discordSharedInteractivePromise;
|
|
95
95
|
}
|
|
96
96
|
function addPayloadTextFallback(spec, payload) {
|
|
@@ -125,7 +125,7 @@ async function resolveDiscordComponentSpec(payload) {
|
|
|
125
125
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
126
126
|
let discordSendRuntimePromise;
|
|
127
127
|
async function loadDiscordSendRuntime() {
|
|
128
|
-
discordSendRuntimePromise ??= import("./send-
|
|
128
|
+
discordSendRuntimePromise ??= import("./send-DwUf-fzH.js").then((n) => n.t);
|
|
129
129
|
return await discordSendRuntimePromise;
|
|
130
130
|
}
|
|
131
131
|
function resolveDiscordOutboundTarget(params) {
|
|
@@ -167,6 +167,40 @@ async function createDiscordPayloadSendContext(ctx) {
|
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region extensions/discord/src/outbound-payload.ts
|
|
170
|
+
function createDiscordUnknownPayloadResult(target) {
|
|
171
|
+
return {
|
|
172
|
+
messageId: "",
|
|
173
|
+
channelId: target,
|
|
174
|
+
receipt: createDiscordSendReceipt({
|
|
175
|
+
platformMessageIds: [],
|
|
176
|
+
channelId: target,
|
|
177
|
+
kind: "unknown"
|
|
178
|
+
})
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function resolveDiscordDeliveryOptions(ctx, sendContext) {
|
|
182
|
+
return {
|
|
183
|
+
replyTo: sendContext.resolveReplyTo(),
|
|
184
|
+
accountId: ctx.accountId ?? void 0,
|
|
185
|
+
silent: ctx.silent ?? void 0,
|
|
186
|
+
cfg: ctx.cfg
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function resolveDiscordFormattedDeliveryOptions(ctx, sendContext) {
|
|
190
|
+
return {
|
|
191
|
+
...resolveDiscordDeliveryOptions(ctx, sendContext),
|
|
192
|
+
...sendContext.formatting
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl) {
|
|
196
|
+
return {
|
|
197
|
+
mediaUrl,
|
|
198
|
+
mediaAccess: ctx.mediaAccess,
|
|
199
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
200
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
201
|
+
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
170
204
|
async function sendDiscordOutboundPayload(params) {
|
|
171
205
|
const ctx = params.ctx;
|
|
172
206
|
const payload = normalizeDiscordApprovalPayload({
|
|
@@ -176,31 +210,14 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
176
210
|
const mediaUrls = resolvePayloadMediaUrls(payload);
|
|
177
211
|
const sendContext = await createDiscordPayloadSendContext(ctx);
|
|
178
212
|
if (payload.audioAsVoice && mediaUrls.length > 0) {
|
|
179
|
-
let lastResult = await sendContext.withRetry(async () => await sendContext.sendVoice(sendContext.target, mediaUrls[0],
|
|
180
|
-
cfg: ctx.cfg,
|
|
181
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
182
|
-
accountId: ctx.accountId ?? void 0,
|
|
183
|
-
silent: ctx.silent ?? void 0
|
|
184
|
-
}));
|
|
213
|
+
let lastResult = await sendContext.withRetry(async () => await sendContext.sendVoice(sendContext.target, mediaUrls[0], resolveDiscordDeliveryOptions(ctx, sendContext)));
|
|
185
214
|
if (payload.text?.trim()) lastResult = await sendContext.withRetry(async () => await sendContext.send(sendContext.target, payload.text, {
|
|
186
215
|
verbose: false,
|
|
187
|
-
|
|
188
|
-
accountId: ctx.accountId ?? void 0,
|
|
189
|
-
silent: ctx.silent ?? void 0,
|
|
190
|
-
cfg: ctx.cfg,
|
|
191
|
-
...sendContext.formatting
|
|
216
|
+
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext)
|
|
192
217
|
}));
|
|
193
218
|
for (const mediaUrl of mediaUrls.slice(1)) lastResult = await sendContext.withRetry(async () => await sendContext.send(sendContext.target, "", {
|
|
194
219
|
verbose: false,
|
|
195
|
-
mediaUrl
|
|
196
|
-
mediaAccess: ctx.mediaAccess,
|
|
197
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
198
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
199
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
200
|
-
accountId: ctx.accountId ?? void 0,
|
|
201
|
-
silent: ctx.silent ?? void 0,
|
|
202
|
-
cfg: ctx.cfg,
|
|
203
|
-
...sendContext.formatting
|
|
220
|
+
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl)
|
|
204
221
|
}));
|
|
205
222
|
return attachChannelToResult("discord", lastResult);
|
|
206
223
|
}
|
|
@@ -213,40 +230,20 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
213
230
|
if (nativeComponents || embeds?.length || filename) return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
|
|
214
231
|
text: payload.text ?? "",
|
|
215
232
|
mediaUrls,
|
|
216
|
-
fallbackResult:
|
|
217
|
-
messageId: "",
|
|
218
|
-
channelId: sendContext.target,
|
|
219
|
-
receipt: createDiscordSendReceipt({
|
|
220
|
-
platformMessageIds: [],
|
|
221
|
-
channelId: sendContext.target,
|
|
222
|
-
kind: "unknown"
|
|
223
|
-
})
|
|
224
|
-
},
|
|
233
|
+
fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
|
|
225
234
|
sendNoMedia: async () => await sendContext.withRetry(async () => await sendContext.send(sendContext.target, payload.text ?? "", {
|
|
226
235
|
verbose: false,
|
|
227
236
|
components: nativeComponents,
|
|
228
237
|
embeds,
|
|
229
238
|
filename,
|
|
230
|
-
|
|
231
|
-
accountId: ctx.accountId ?? void 0,
|
|
232
|
-
silent: ctx.silent ?? void 0,
|
|
233
|
-
cfg: ctx.cfg,
|
|
234
|
-
...sendContext.formatting
|
|
239
|
+
...resolveDiscordFormattedDeliveryOptions(ctx, sendContext)
|
|
235
240
|
})),
|
|
236
241
|
send: async ({ text, mediaUrl, isFirst }) => await sendContext.withRetry(async () => await sendContext.send(sendContext.target, text, {
|
|
237
242
|
verbose: false,
|
|
238
|
-
mediaUrl,
|
|
239
|
-
mediaAccess: ctx.mediaAccess,
|
|
240
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
241
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
243
|
+
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl),
|
|
242
244
|
components: isFirst ? nativeComponents : void 0,
|
|
243
245
|
embeds: isFirst ? embeds : void 0,
|
|
244
|
-
filename: isFirst ? filename : void 0
|
|
245
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
246
|
-
accountId: ctx.accountId ?? void 0,
|
|
247
|
-
silent: ctx.silent ?? void 0,
|
|
248
|
-
cfg: ctx.cfg,
|
|
249
|
-
...sendContext.formatting
|
|
246
|
+
filename: isFirst ? filename : void 0
|
|
250
247
|
}))
|
|
251
248
|
}));
|
|
252
249
|
return await sendTextMediaPayload({
|
|
@@ -261,45 +258,13 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
261
258
|
return attachChannelToResult("discord", await sendPayloadMediaSequenceOrFallback({
|
|
262
259
|
text: payload.text ?? "",
|
|
263
260
|
mediaUrls,
|
|
264
|
-
fallbackResult:
|
|
265
|
-
|
|
266
|
-
channelId: sendContext.target,
|
|
267
|
-
receipt: createDiscordSendReceipt({
|
|
268
|
-
platformMessageIds: [],
|
|
269
|
-
channelId: sendContext.target,
|
|
270
|
-
kind: "unknown"
|
|
271
|
-
})
|
|
272
|
-
},
|
|
273
|
-
sendNoMedia: async () => await sendContext.withRetry(async () => await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
274
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
275
|
-
accountId: ctx.accountId ?? void 0,
|
|
276
|
-
silent: ctx.silent ?? void 0,
|
|
277
|
-
cfg: ctx.cfg,
|
|
278
|
-
...sendContext.formatting
|
|
279
|
-
})),
|
|
261
|
+
fallbackResult: createDiscordUnknownPayloadResult(sendContext.target),
|
|
262
|
+
sendNoMedia: async () => await sendContext.withRetry(async () => await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, { ...resolveDiscordFormattedDeliveryOptions(ctx, sendContext) })),
|
|
280
263
|
send: async ({ text, mediaUrl, isFirst }) => {
|
|
281
|
-
if (isFirst) return await sendContext.withRetry(async () => await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, {
|
|
282
|
-
mediaUrl,
|
|
283
|
-
mediaAccess: ctx.mediaAccess,
|
|
284
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
285
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
286
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
287
|
-
accountId: ctx.accountId ?? void 0,
|
|
288
|
-
silent: ctx.silent ?? void 0,
|
|
289
|
-
cfg: ctx.cfg,
|
|
290
|
-
...sendContext.formatting
|
|
291
|
-
}));
|
|
264
|
+
if (isFirst) return await sendContext.withRetry(async () => await sendDiscordComponentMessageLazy(sendContext.target, componentSpec, { ...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl) }));
|
|
292
265
|
return await sendContext.withRetry(async () => await sendContext.send(sendContext.target, text, {
|
|
293
266
|
verbose: false,
|
|
294
|
-
mediaUrl
|
|
295
|
-
mediaAccess: ctx.mediaAccess,
|
|
296
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
297
|
-
mediaReadFile: ctx.mediaReadFile,
|
|
298
|
-
replyTo: sendContext.resolveReplyTo(),
|
|
299
|
-
accountId: ctx.accountId ?? void 0,
|
|
300
|
-
silent: ctx.silent ?? void 0,
|
|
301
|
-
cfg: ctx.cfg,
|
|
302
|
-
...sendContext.formatting
|
|
267
|
+
...resolveDiscordMediaDeliveryOptions(ctx, sendContext, mediaUrl)
|
|
303
268
|
}));
|
|
304
269
|
}
|
|
305
270
|
}));
|
|
@@ -315,7 +280,7 @@ function stripDiscordInternalRuntimeScaffolding(text) {
|
|
|
315
280
|
}
|
|
316
281
|
let discordThreadBindingsPromise;
|
|
317
282
|
function loadDiscordThreadBindings() {
|
|
318
|
-
discordThreadBindingsPromise ??= import("./thread-bindings-
|
|
283
|
+
discordThreadBindingsPromise ??= import("./thread-bindings-VrlFUPDW.js").then((n) => n.t);
|
|
319
284
|
return discordThreadBindingsPromise;
|
|
320
285
|
}
|
|
321
286
|
function resolveDiscordWebhookIdentity(params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CxFJX9o3.js";
|
|
2
2
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
3
|
//#region extensions/discord/src/pluralkit.ts
|
|
4
4
|
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-
|
|
1
|
+
import { $ as BaseMessageInteractiveComponent, A as User, B as Container, D as CommandWithSubcommands, E as Command, F as Modal, J as Separator, K as Row, O as Guild, R as Button, S as RateLimitError, Wt as __exportAll, X as TextDisplay, Y as StringSelectMenu, c as discord_exports, ct as createThread, d as MessageReactionAddListener, dt as editChannel, f as MessageReactionRemoveListener, g as ThreadUpdateListener, k as Message, l as InteractionCreateListener, m as ReadyListener, mt as getChannelMessage, p as PresenceUpdateListener, s as chunkDiscordTextWithMode, u as MessageCreateListener, v as Client, y as Plugin } from "./send.receipt-CxFJX9o3.js";
|
|
2
2
|
import { c as resolveDiscordAccountAllowFrom, d as resolveDiscordAccountDmPolicy, f as resolveDiscordMaxLinesPerMessage, p as normalizeDiscordToken, s as resolveDiscordAccount } from "./accounts-dXTfmnSZ.js";
|
|
3
|
-
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-
|
|
4
|
-
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-
|
|
3
|
+
import { _ as parseDiscordComponentCustomId, b as parseDiscordModalCustomIdForInteraction, v as parseDiscordComponentCustomIdForInteraction, y as parseDiscordModalCustomId } from "./components-CWgTTA0J.js";
|
|
4
|
+
import { a as resolveDiscordComponentEntryWithPersistence, o as resolveDiscordModalEntryWithPersistence, t as editDiscordComponentMessage } from "./send.components-BVfuI0-G.js";
|
|
5
5
|
import { c as setPresence, i as unregisterGateway, r as registerGateway } from "./gateway-registry-DPxmW0Db.js";
|
|
6
|
-
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-
|
|
6
|
+
import { B as DISCORD_REST_TIMEOUT_MS, D as canViewDiscordGuildChannel, H as withValidatedDiscordProxy, I as createDiscordRestClient, V as validateDiscordProxyUrl } from "./send.shared-DQwyGjXe.js";
|
|
7
7
|
import { a as summarizeDiscordResponseBody, i as isDiscordRateLimitResponseBody } from "./api-BmXlcjYW.js";
|
|
8
8
|
import { S as resolveTimestampMs, _ as resolveGroupDmAllow, a as normalizeDiscordSlug, b as formatDiscordUserTag, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, f as resolveDiscordMemberAccessState, h as resolveDiscordOwnerAllowFrom, i as normalizeDiscordDisplaySlug, l as resolveDiscordChannelPolicyCommandAuthorizer, m as resolveDiscordOwnerAccess, n as isDiscordGroupAllowedByPolicy, o as resolveDiscordAllowListMatch, p as resolveDiscordMemberAllowed, r as normalizeDiscordAllowList, v as shouldEmitDiscordReactionNotification, y as formatDiscordReactionEmoji } from "./allow-list-BnkWtVpA.js";
|
|
9
|
-
import { s as sendVoiceMessageDiscord } from "./send-
|
|
10
|
-
import { i as formatMention, t as sendMessageDiscord } from "./send.outbound-
|
|
9
|
+
import { s as sendVoiceMessageDiscord } from "./send-DwUf-fzH.js";
|
|
10
|
+
import { i as formatMention, t as sendMessageDiscord } from "./send.outbound-4IJRwYbJ.js";
|
|
11
11
|
import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
12
|
-
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-
|
|
13
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
14
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
15
|
-
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-
|
|
12
|
+
import { a as getDiscordExecApprovalApprovers, s as isDiscordExecApprovalClientEnabled, t as resolveDiscordConversationIdentity } from "./conversation-identity-Dvi-8LyR.js";
|
|
13
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-LMOlvXSw.js";
|
|
14
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-WNAKeCd_.js";
|
|
15
|
+
import { _ as formatThreadBindingDurationLabel, a as isThreadArchived, d as resolveDiscordChannelNameSafe, f as resolveDiscordChannelParentIdSafe, l as resolveDiscordChannelIdSafe, m as resolveDiscordChannelTopicSafe, p as resolveDiscordChannelParentSafe, u as resolveDiscordChannelInfoSafe } from "./thread-bindings.discord-api-CItgvv24.js";
|
|
16
16
|
import { r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-BiEg-_i1.js";
|
|
17
|
-
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-
|
|
18
|
-
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-
|
|
17
|
+
import { o as raceWithTimeout, s as withAbortTimeout } from "./timeouts-CEJ3--Uw.js";
|
|
18
|
+
import { d as resolveDiscordMessageChannelId, n as resolveDiscordForwardedMessagesTextFromSnapshots, t as resolveDiscordEmbedText, u as resolveDiscordChannelInfo } from "./message-utils-C4OlktSy.js";
|
|
19
19
|
import { t as resolveDiscordSenderIdentity } from "./sender-identity-BFp5w0F8.js";
|
|
20
|
-
import "./approval-handler.runtime-
|
|
20
|
+
import "./approval-handler.runtime-BFLqemq4.js";
|
|
21
21
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
22
22
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeOptionalStringifiedId, normalizeStringEntries, normalizeStringEntriesLower, summarizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
23
23
|
import { buildAgentSessionKey, deriveLastRoutePolicy, isAcpSessionKey, isSubagentSessionKey, parseAgentSessionKey, resolveAgentIdFromSessionKey, resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
@@ -26,10 +26,10 @@ import { ApplicationCommandOptionType, ButtonStyle, ChannelType, ComponentType,
|
|
|
26
26
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
27
|
import path from "node:path";
|
|
28
28
|
import { resolvePinnedMainDmOwnerFromAllowlist as resolvePinnedMainDmOwnerFromAllowlist$1 } from "openclaw/plugin-sdk/security-runtime";
|
|
29
|
+
import { MAX_DATE_TIMESTAMP_MS, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, resolveDateTimestampMs, resolveTimestampMsToIsoString, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
29
30
|
import { Type } from "typebox";
|
|
30
31
|
import { Check, Errors } from "typebox/value";
|
|
31
32
|
import { inspect } from "node:util";
|
|
32
|
-
import { parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
33
33
|
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
|
34
34
|
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
|
|
35
35
|
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
|
@@ -76,6 +76,7 @@ import { captureHttpExchange, captureWsEvent, resolveDebugProxySettings, resolve
|
|
|
76
76
|
import * as dns from "node:dns";
|
|
77
77
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
78
78
|
import { logDebug, logError } from "openclaw/plugin-sdk/logging-core";
|
|
79
|
+
import { stripPlainTextToolCallBlocks } from "openclaw/plugin-sdk/tool-payload";
|
|
79
80
|
import { resolveApprovalOverGateway } from "openclaw/plugin-sdk/approval-gateway-runtime";
|
|
80
81
|
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
|
|
81
82
|
import { Agent as Agent$1, fetch as fetch$1 } from "undici";
|
|
@@ -2231,6 +2232,7 @@ const PREFERENCE_MAX_ENTRIES = 2e3;
|
|
|
2231
2232
|
const MAX_PLUGIN_STATE_KEY_BYTES = 512;
|
|
2232
2233
|
const textEncoder = new TextEncoder();
|
|
2233
2234
|
let lastPreferenceTimestampMs = 0;
|
|
2235
|
+
let lastPreferenceOrder = 0;
|
|
2234
2236
|
const legacyPreferenceImports = /* @__PURE__ */ new Map();
|
|
2235
2237
|
function openPreferenceStore(env) {
|
|
2236
2238
|
return getDiscordRuntime().state.openKeyedStore({
|
|
@@ -2289,7 +2291,8 @@ function sanitizeStoredPreferenceEntry(value) {
|
|
|
2289
2291
|
return {
|
|
2290
2292
|
scopeKey: typedValue.scopeKey,
|
|
2291
2293
|
modelRef,
|
|
2292
|
-
updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : ""
|
|
2294
|
+
updatedAt: typeof typedValue.updatedAt === "string" ? typedValue.updatedAt : "",
|
|
2295
|
+
updatedOrder: typeof typedValue.updatedOrder === "number" && Number.isSafeInteger(typedValue.updatedOrder) ? typedValue.updatedOrder : void 0
|
|
2293
2296
|
};
|
|
2294
2297
|
}
|
|
2295
2298
|
function hashSegment(value, length) {
|
|
@@ -2302,12 +2305,25 @@ function timestampMs(value) {
|
|
|
2302
2305
|
const parsed = Date.parse(value);
|
|
2303
2306
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
2304
2307
|
}
|
|
2305
|
-
function
|
|
2306
|
-
return
|
|
2308
|
+
function timestampOrder(value) {
|
|
2309
|
+
return value !== void 0 && value >= 0 ? value : 0;
|
|
2307
2310
|
}
|
|
2308
|
-
function
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
+
function comparePreferenceEntries(left, right) {
|
|
2312
|
+
return timestampMs(right.value.updatedAt) - timestampMs(left.value.updatedAt) || timestampOrder(right.value.updatedOrder) - timestampOrder(left.value.updatedOrder) || left.key.localeCompare(right.key);
|
|
2313
|
+
}
|
|
2314
|
+
function legacyUpdatedAtForIndex(updatedAt, index, total) {
|
|
2315
|
+
const baseMs = timestampMs(updatedAt);
|
|
2316
|
+
return timestampMsToIsoString(Math.min(baseMs + Math.max(0, total), MAX_DATE_TIMESTAMP_MS) - Math.max(0, index)) ?? timestampMsToIsoString(baseMs) ?? timestampMsToIsoString(Math.max(0, total - index)) ?? "1970-01-01T00:00:00.000Z";
|
|
2317
|
+
}
|
|
2318
|
+
function nextPreferenceTimestamp(existingEntries) {
|
|
2319
|
+
const existingMaxTimestampMs = existingEntries.reduce((max, entry) => Math.max(max, timestampMs(entry.updatedAt)), 0);
|
|
2320
|
+
lastPreferenceTimestampMs = Math.min(Math.max(resolveDateTimestampMs(Date.now(), 0), lastPreferenceTimestampMs + 1, existingMaxTimestampMs + 1), MAX_DATE_TIMESTAMP_MS);
|
|
2321
|
+
const existingMaxOrder = existingEntries.reduce((max, entry) => Math.max(max, timestampOrder(entry.updatedOrder)), 0);
|
|
2322
|
+
lastPreferenceOrder = Math.max(lastPreferenceOrder + 1, existingMaxOrder + 1);
|
|
2323
|
+
return {
|
|
2324
|
+
updatedAt: resolveTimestampMsToIsoString(lastPreferenceTimestampMs),
|
|
2325
|
+
updatedOrder: lastPreferenceOrder
|
|
2326
|
+
};
|
|
2311
2327
|
}
|
|
2312
2328
|
function normalizeLegacyPreferenceKey(key) {
|
|
2313
2329
|
const trimmed = key.trim();
|
|
@@ -2356,7 +2372,10 @@ async function readDiscordModelPickerRecentModels(params) {
|
|
|
2356
2372
|
const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
|
|
2357
2373
|
try {
|
|
2358
2374
|
await importLegacyPreferences(params.env);
|
|
2359
|
-
const recent = (await openPreferenceStore(params.env).entries()).map((entry) =>
|
|
2375
|
+
const recent = (await openPreferenceStore(params.env).entries()).map((entry) => ({
|
|
2376
|
+
key: entry.key,
|
|
2377
|
+
value: sanitizeStoredPreferenceEntry(entry.value)
|
|
2378
|
+
})).filter((entry) => entry.value?.scopeKey === key).toSorted(comparePreferenceEntries).map((entry) => entry.value.modelRef);
|
|
2360
2379
|
if (!params.allowedModelRefs || params.allowedModelRefs.size === 0) return sanitizeRecentModels(recent, limit);
|
|
2361
2380
|
return sanitizeRecentModels(recent.filter((modelRef) => params.allowedModelRefs?.has(modelRef)), limit);
|
|
2362
2381
|
} catch {
|
|
@@ -2370,16 +2389,17 @@ async function recordDiscordModelPickerRecentModel(params) {
|
|
|
2370
2389
|
try {
|
|
2371
2390
|
await importLegacyPreferences(params.env);
|
|
2372
2391
|
const store = openPreferenceStore(params.env);
|
|
2392
|
+
const timestamp = nextPreferenceTimestamp((await store.entries()).map((entry) => sanitizeStoredPreferenceEntry(entry.value)).filter((entry) => entry?.scopeKey === key));
|
|
2373
2393
|
await store.register(buildPreferenceModelKey(key, normalizedModelRef), {
|
|
2374
2394
|
scopeKey: key,
|
|
2375
2395
|
modelRef: normalizedModelRef,
|
|
2376
|
-
|
|
2396
|
+
...timestamp
|
|
2377
2397
|
});
|
|
2378
2398
|
const limit = Math.max(1, Math.min(params.limit ?? DEFAULT_RECENT_LIMIT, 10));
|
|
2379
2399
|
const scopedEntries = (await store.entries()).map((entry) => ({
|
|
2380
2400
|
key: entry.key,
|
|
2381
2401
|
value: sanitizeStoredPreferenceEntry(entry.value)
|
|
2382
|
-
})).filter((entry) => entry.value?.scopeKey === key).toSorted(
|
|
2402
|
+
})).filter((entry) => entry.value?.scopeKey === key).toSorted(comparePreferenceEntries);
|
|
2383
2403
|
await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
|
|
2384
2404
|
} catch {
|
|
2385
2405
|
return;
|
|
@@ -7760,7 +7780,7 @@ function collapseExcessBlankLines(text) {
|
|
|
7760
7780
|
return text.replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n");
|
|
7761
7781
|
}
|
|
7762
7782
|
function sanitizeDiscordFrontChannelText(text) {
|
|
7763
|
-
return collapseExcessBlankLines(stripDiscordInternalTraceLines(sanitizeAssistantVisibleText(text))).trim();
|
|
7783
|
+
return collapseExcessBlankLines(stripDiscordInternalTraceLines(stripPlainTextToolCallBlocks(sanitizeAssistantVisibleText(stripPlainTextToolCallBlocks(text))))).trim();
|
|
7764
7784
|
}
|
|
7765
7785
|
function sanitizeDiscordFrontChannelReplyPayloads(payloads, options = {}) {
|
|
7766
7786
|
const preserveVerboseToolProgress = options.kind === "tool";
|
|
@@ -7876,7 +7896,7 @@ async function loadConversationRuntime$1() {
|
|
|
7876
7896
|
return await conversationRuntimePromise$1;
|
|
7877
7897
|
}
|
|
7878
7898
|
async function loadTypingRuntime() {
|
|
7879
|
-
typingRuntimePromise ??= import("./typing-
|
|
7899
|
+
typingRuntimePromise ??= import("./typing-Bfns8H17.js").then((n) => n.n);
|
|
7880
7900
|
return await typingRuntimePromise;
|
|
7881
7901
|
}
|
|
7882
7902
|
function buildDiscordComponentConversationLabel(params) {
|
|
@@ -8297,7 +8317,7 @@ async function dispatchPluginDiscordInteractiveEvent(params) {
|
|
|
8297
8317
|
//#region extensions/discord/src/monitor/agent-components.handlers.ts
|
|
8298
8318
|
let componentsRuntimePromise;
|
|
8299
8319
|
async function loadComponentsRuntime() {
|
|
8300
|
-
componentsRuntimePromise ??= import("./components-
|
|
8320
|
+
componentsRuntimePromise ??= import("./components-CWgTTA0J.js").then((n) => n.t);
|
|
8301
8321
|
return await componentsRuntimePromise;
|
|
8302
8322
|
}
|
|
8303
8323
|
async function handleDiscordComponentEvent(params) {
|
|
@@ -8616,6 +8636,66 @@ var DiscordComponentModal = class extends Modal {
|
|
|
8616
8636
|
};
|
|
8617
8637
|
//#endregion
|
|
8618
8638
|
//#region extensions/discord/src/monitor/agent-components.system-controls.ts
|
|
8639
|
+
async function runAgentSystemControlInteraction(params) {
|
|
8640
|
+
const parsed = parseAgentComponentData(params.data);
|
|
8641
|
+
if (!parsed) {
|
|
8642
|
+
logError(`${params.label}: failed to parse component data`);
|
|
8643
|
+
try {
|
|
8644
|
+
await params.interaction.reply({
|
|
8645
|
+
content: params.invalidReply,
|
|
8646
|
+
ephemeral: true
|
|
8647
|
+
});
|
|
8648
|
+
} catch {}
|
|
8649
|
+
return;
|
|
8650
|
+
}
|
|
8651
|
+
const { componentId } = parsed;
|
|
8652
|
+
const interactionCtx = await resolveInteractionContextWithDmAuth({
|
|
8653
|
+
ctx: params.ctx,
|
|
8654
|
+
interaction: params.interaction,
|
|
8655
|
+
label: params.label,
|
|
8656
|
+
componentLabel: params.interactionComponentLabel,
|
|
8657
|
+
defer: false
|
|
8658
|
+
});
|
|
8659
|
+
if (!interactionCtx) return;
|
|
8660
|
+
const { channelId, user, username, userId, replyOpts, rawGuildId, isDirectMessage, isGroupDm, memberRoleIds } = interactionCtx;
|
|
8661
|
+
const allowed = await ensureAgentComponentInteractionAllowed({
|
|
8662
|
+
ctx: params.ctx,
|
|
8663
|
+
interaction: params.interaction,
|
|
8664
|
+
channelId,
|
|
8665
|
+
rawGuildId,
|
|
8666
|
+
memberRoleIds,
|
|
8667
|
+
user,
|
|
8668
|
+
replyOpts,
|
|
8669
|
+
componentLabel: params.authorizationComponentLabel,
|
|
8670
|
+
unauthorizedReply: params.unauthorizedReply
|
|
8671
|
+
});
|
|
8672
|
+
if (!allowed) return;
|
|
8673
|
+
const route = resolveAgentComponentRoute({
|
|
8674
|
+
ctx: params.ctx,
|
|
8675
|
+
rawGuildId,
|
|
8676
|
+
memberRoleIds,
|
|
8677
|
+
isDirectMessage,
|
|
8678
|
+
isGroupDm,
|
|
8679
|
+
userId,
|
|
8680
|
+
channelId,
|
|
8681
|
+
parentId: allowed.parentId
|
|
8682
|
+
});
|
|
8683
|
+
const eventText = params.formatEventText({
|
|
8684
|
+
componentId,
|
|
8685
|
+
username,
|
|
8686
|
+
userId
|
|
8687
|
+
});
|
|
8688
|
+
logDebug(`${params.label}: enqueuing event for channel ${channelId}: ${eventText}`);
|
|
8689
|
+
enqueueSystemEvent$1(eventText, {
|
|
8690
|
+
sessionKey: route.sessionKey,
|
|
8691
|
+
contextKey: `${params.contextKeyPrefix}:${channelId}:${componentId}:${userId}`
|
|
8692
|
+
});
|
|
8693
|
+
await ackComponentInteraction({
|
|
8694
|
+
interaction: params.interaction,
|
|
8695
|
+
replyOpts,
|
|
8696
|
+
label: params.label
|
|
8697
|
+
});
|
|
8698
|
+
}
|
|
8619
8699
|
var AgentComponentButton = class extends Button {
|
|
8620
8700
|
constructor(ctx) {
|
|
8621
8701
|
super();
|
|
@@ -8625,60 +8705,17 @@ var AgentComponentButton = class extends Button {
|
|
|
8625
8705
|
this.ctx = ctx;
|
|
8626
8706
|
}
|
|
8627
8707
|
async run(interaction, data) {
|
|
8628
|
-
|
|
8629
|
-
if (!parsed) {
|
|
8630
|
-
logError("agent button: failed to parse component data");
|
|
8631
|
-
try {
|
|
8632
|
-
await interaction.reply({
|
|
8633
|
-
content: "This button is no longer valid.",
|
|
8634
|
-
ephemeral: true
|
|
8635
|
-
});
|
|
8636
|
-
} catch {}
|
|
8637
|
-
return;
|
|
8638
|
-
}
|
|
8639
|
-
const { componentId } = parsed;
|
|
8640
|
-
const interactionCtx = await resolveInteractionContextWithDmAuth({
|
|
8708
|
+
await runAgentSystemControlInteraction({
|
|
8641
8709
|
ctx: this.ctx,
|
|
8642
8710
|
interaction,
|
|
8711
|
+
data,
|
|
8643
8712
|
label: "agent button",
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
ctx: this.ctx,
|
|
8651
|
-
interaction,
|
|
8652
|
-
channelId,
|
|
8653
|
-
rawGuildId,
|
|
8654
|
-
memberRoleIds,
|
|
8655
|
-
user,
|
|
8656
|
-
replyOpts,
|
|
8657
|
-
componentLabel: "button",
|
|
8658
|
-
unauthorizedReply: "You are not authorized to use this button."
|
|
8659
|
-
});
|
|
8660
|
-
if (!allowed) return;
|
|
8661
|
-
const { parentId } = allowed;
|
|
8662
|
-
const route = resolveAgentComponentRoute({
|
|
8663
|
-
ctx: this.ctx,
|
|
8664
|
-
rawGuildId,
|
|
8665
|
-
memberRoleIds,
|
|
8666
|
-
isDirectMessage,
|
|
8667
|
-
isGroupDm,
|
|
8668
|
-
userId,
|
|
8669
|
-
channelId,
|
|
8670
|
-
parentId
|
|
8671
|
-
});
|
|
8672
|
-
const eventText = `[Discord component: ${componentId} clicked by ${username} (${userId})]`;
|
|
8673
|
-
logDebug(`agent button: enqueuing event for channel ${channelId}: ${eventText}`);
|
|
8674
|
-
enqueueSystemEvent$1(eventText, {
|
|
8675
|
-
sessionKey: route.sessionKey,
|
|
8676
|
-
contextKey: `discord:agent-button:${channelId}:${componentId}:${userId}`
|
|
8677
|
-
});
|
|
8678
|
-
await ackComponentInteraction({
|
|
8679
|
-
interaction,
|
|
8680
|
-
replyOpts,
|
|
8681
|
-
label: "agent button"
|
|
8713
|
+
interactionComponentLabel: "button",
|
|
8714
|
+
authorizationComponentLabel: "button",
|
|
8715
|
+
invalidReply: "This button is no longer valid.",
|
|
8716
|
+
unauthorizedReply: "You are not authorized to use this button.",
|
|
8717
|
+
contextKeyPrefix: "discord:agent-button",
|
|
8718
|
+
formatEventText: ({ componentId, username, userId }) => `[Discord component: ${componentId} clicked by ${username} (${userId})]`
|
|
8682
8719
|
});
|
|
8683
8720
|
}
|
|
8684
8721
|
};
|
|
@@ -8690,62 +8727,19 @@ var AgentSelectMenu = class extends StringSelectMenu {
|
|
|
8690
8727
|
this.ctx = ctx;
|
|
8691
8728
|
}
|
|
8692
8729
|
async run(interaction, data) {
|
|
8693
|
-
const parsed = parseAgentComponentData(data);
|
|
8694
|
-
if (!parsed) {
|
|
8695
|
-
logError("agent select: failed to parse component data");
|
|
8696
|
-
try {
|
|
8697
|
-
await interaction.reply({
|
|
8698
|
-
content: "This select menu is no longer valid.",
|
|
8699
|
-
ephemeral: true
|
|
8700
|
-
});
|
|
8701
|
-
} catch {}
|
|
8702
|
-
return;
|
|
8703
|
-
}
|
|
8704
|
-
const { componentId } = parsed;
|
|
8705
|
-
const interactionCtx = await resolveInteractionContextWithDmAuth({
|
|
8706
|
-
ctx: this.ctx,
|
|
8707
|
-
interaction,
|
|
8708
|
-
label: "agent select",
|
|
8709
|
-
componentLabel: "select menu",
|
|
8710
|
-
defer: false
|
|
8711
|
-
});
|
|
8712
|
-
if (!interactionCtx) return;
|
|
8713
|
-
const { channelId, user, username, userId, replyOpts, rawGuildId, isDirectMessage, isGroupDm, memberRoleIds } = interactionCtx;
|
|
8714
|
-
const allowed = await ensureAgentComponentInteractionAllowed({
|
|
8715
|
-
ctx: this.ctx,
|
|
8716
|
-
interaction,
|
|
8717
|
-
channelId,
|
|
8718
|
-
rawGuildId,
|
|
8719
|
-
memberRoleIds,
|
|
8720
|
-
user,
|
|
8721
|
-
replyOpts,
|
|
8722
|
-
componentLabel: "select",
|
|
8723
|
-
unauthorizedReply: "You are not authorized to use this select menu."
|
|
8724
|
-
});
|
|
8725
|
-
if (!allowed) return;
|
|
8726
|
-
const { parentId } = allowed;
|
|
8727
8730
|
const values = interaction.values ?? [];
|
|
8728
8731
|
const valuesText = values.length > 0 ? ` (selected: ${values.join(", ")})` : "";
|
|
8729
|
-
|
|
8732
|
+
await runAgentSystemControlInteraction({
|
|
8730
8733
|
ctx: this.ctx,
|
|
8731
|
-
rawGuildId,
|
|
8732
|
-
memberRoleIds,
|
|
8733
|
-
isDirectMessage,
|
|
8734
|
-
isGroupDm,
|
|
8735
|
-
userId,
|
|
8736
|
-
channelId,
|
|
8737
|
-
parentId
|
|
8738
|
-
});
|
|
8739
|
-
const eventText = `[Discord select menu: ${componentId} interacted by ${username} (${userId})${valuesText}]`;
|
|
8740
|
-
logDebug(`agent select: enqueuing event for channel ${channelId}: ${eventText}`);
|
|
8741
|
-
enqueueSystemEvent$1(eventText, {
|
|
8742
|
-
sessionKey: route.sessionKey,
|
|
8743
|
-
contextKey: `discord:agent-select:${channelId}:${componentId}:${userId}`
|
|
8744
|
-
});
|
|
8745
|
-
await ackComponentInteraction({
|
|
8746
8734
|
interaction,
|
|
8747
|
-
|
|
8748
|
-
label: "agent select"
|
|
8735
|
+
data,
|
|
8736
|
+
label: "agent select",
|
|
8737
|
+
interactionComponentLabel: "select menu",
|
|
8738
|
+
authorizationComponentLabel: "select",
|
|
8739
|
+
invalidReply: "This select menu is no longer valid.",
|
|
8740
|
+
unauthorizedReply: "You are not authorized to use this select menu.",
|
|
8741
|
+
contextKeyPrefix: "discord:agent-select",
|
|
8742
|
+
formatEventText: ({ componentId, username, userId }) => `[Discord select menu: ${componentId} interacted by ${username} (${userId})${valuesText}]`
|
|
8749
8743
|
});
|
|
8750
8744
|
}
|
|
8751
8745
|
};
|
|
@@ -9529,7 +9523,7 @@ async function runDiscordGatewayLifecycle(params) {
|
|
|
9529
9523
|
gatewayEmitter?.removeListener(DISCORD_GATEWAY_TRANSPORT_ACTIVITY_EVENT, onGatewayTransportActivity);
|
|
9530
9524
|
if (params.voiceManager) {
|
|
9531
9525
|
await params.voiceManager.destroy();
|
|
9532
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
9526
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CFsqnHc4.js").then((n) => n.n);
|
|
9533
9527
|
setDiscordTranscriptsVoiceManager({
|
|
9534
9528
|
accountId: params.accountId,
|
|
9535
9529
|
manager: null
|
|
@@ -9807,7 +9801,7 @@ function logDiscordStartupPhase(params) {
|
|
|
9807
9801
|
});
|
|
9808
9802
|
}
|
|
9809
9803
|
async function loadDiscordVoiceRuntime() {
|
|
9810
|
-
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-
|
|
9804
|
+
const promise = discordVoiceRuntimePromise ?? import("./manager.runtime-ClHe315Q.js");
|
|
9811
9805
|
discordVoiceRuntimePromise = promise;
|
|
9812
9806
|
try {
|
|
9813
9807
|
return await promise;
|
|
@@ -9817,7 +9811,7 @@ async function loadDiscordVoiceRuntime() {
|
|
|
9817
9811
|
}
|
|
9818
9812
|
}
|
|
9819
9813
|
async function loadDiscordProviderSessionRuntime() {
|
|
9820
|
-
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-
|
|
9814
|
+
const promise = discordProviderSessionRuntimePromise ?? import("./provider-session.runtime-B5aLy8NA.js");
|
|
9821
9815
|
discordProviderSessionRuntimePromise = promise;
|
|
9822
9816
|
try {
|
|
9823
9817
|
return await promise;
|
|
@@ -10087,7 +10081,7 @@ async function monitorDiscordProvider(opts = {}) {
|
|
|
10087
10081
|
runtime,
|
|
10088
10082
|
botUserId
|
|
10089
10083
|
});
|
|
10090
|
-
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-
|
|
10084
|
+
const { setDiscordTranscriptsVoiceManager } = await import("./transcripts-source-CFsqnHc4.js").then((n) => n.n);
|
|
10091
10085
|
setDiscordTranscriptsVoiceManager({
|
|
10092
10086
|
accountId: account.accountId,
|
|
10093
10087
|
manager: voiceManager
|
|
@@ -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-VrlFUPDW.js";
|
|
2
|
+
import { n as createThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-hhqHJlGr.js";
|
|
3
|
+
import { t as createDiscordMessageHandler } from "./message-handler-Deidymb-.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,4 +1,4 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CxFJX9o3.js";
|
|
2
2
|
import { n as fetchDiscord, t as DiscordApiError } from "./api-BmXlcjYW.js";
|
|
3
3
|
import { a as normalizeDiscordSlug } from "./allow-list-BnkWtVpA.js";
|
|
4
4
|
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-DAIbZobr.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wt as __exportAll } from "./send.receipt-
|
|
1
|
+
import { Wt as __exportAll } from "./send.receipt-CxFJX9o3.js";
|
|
2
2
|
import { n as fetchDiscord } from "./api-BmXlcjYW.js";
|
|
3
3
|
import { i as listGuilds, n as filterDiscordGuilds, r as resolveDiscordAllowlistToken, t as buildDiscordUnresolvedResults } from "./resolve-allowlist-common-DAIbZobr.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|