@kodelyth/discord 2026.5.39 → 2026.6.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.
Files changed (126) hide show
  1. package/dist/account-inspect-Dqw-enky.js +81 -0
  2. package/dist/account-inspect-api.js +10 -0
  3. package/dist/accounts-B7OBFePq.js +224 -0
  4. package/dist/action-runtime-api.js +2 -0
  5. package/dist/agent-components.runtime-DVY_1VB4.js +4 -0
  6. package/dist/allow-list-B0s7evD7.js +354 -0
  7. package/dist/api-CXAcv9nZ.js +130 -0
  8. package/dist/api.js +23 -0
  9. package/dist/approval-handler.runtime-B9xUAF3n.js +426 -0
  10. package/dist/audit-DoiK49WO.js +24 -0
  11. package/dist/audit-core-BGrq3G7r.js +105 -0
  12. package/dist/channel-U_aeoFwW.js +795 -0
  13. package/dist/channel-actions-BxEBnEuv.js +173 -0
  14. package/dist/channel-actions.runtime-CPtpH-yl.js +263 -0
  15. package/dist/channel-api-BfjklLby.js +21 -0
  16. package/dist/channel-config-api.js +2 -0
  17. package/dist/channel-plugin-api.js +2 -0
  18. package/dist/channel.setup-BUSC0apv.js +337 -0
  19. package/dist/components-luonoe13.js +909 -0
  20. package/dist/config-api-DSYGqaLQ.js +2 -0
  21. package/dist/config-schema-DIqJBGwC.js +357 -0
  22. package/dist/configured-state.js +6 -0
  23. package/dist/contract-api.js +8 -0
  24. package/dist/conversation-identity-DXAm0_Mk.js +270 -0
  25. package/dist/directory-config-CYbuMmPS.js +49 -0
  26. package/dist/directory-contract-api.js +2 -0
  27. package/dist/directory-live-DX4dLRpJ.js +159 -0
  28. package/dist/doctor-bbKSvGVD.js +244 -0
  29. package/dist/doctor-contract-Btjt6NJD.js +383 -0
  30. package/dist/doctor-contract-api.js +2 -0
  31. package/dist/gateway-registry-BKSpa4GB.js +74 -0
  32. package/dist/handle-action.guild-admin-B5BArS2n.js +286 -0
  33. package/dist/inbound-context-WAOqhGlT.js +48 -0
  34. package/dist/inbound-event-delivery-C-1Ji3WP.js +65 -0
  35. package/dist/index.js +26 -0
  36. package/dist/manager.runtime-DXHynKE4.js +2356 -0
  37. package/dist/message-handler-mXzc3tA_.js +381 -0
  38. package/dist/message-handler.preflight-BPD1a347.js +1113 -0
  39. package/dist/message-handler.process-GUa3aV8z.js +1438 -0
  40. package/dist/message-utils-dUbem16p.js +549 -0
  41. package/dist/outbound-adapter-C18OAc1y.js +536 -0
  42. package/dist/pluralkit-D1Q2x0w5.js +22 -0
  43. package/dist/preflight-audio-CZtpWcIm.js +72 -0
  44. package/dist/preflight-audio.runtime-Brx_0_xW.js +7 -0
  45. package/dist/preview-streaming-D_slNIiO.js +8 -0
  46. package/dist/probe-D--Ca4JF.js +139 -0
  47. package/dist/probe.runtime-DQBchZzv.js +2 -0
  48. package/dist/provider-B2-31CIT.js +9565 -0
  49. package/dist/provider-session.runtime-BwzzSsrH.js +6 -0
  50. package/dist/provider.runtime-CP3oHLls.js +2 -0
  51. package/dist/resolve-allowlist-common-CqxPLcJO.js +34 -0
  52. package/dist/resolve-channels-0LX4pUbB.js +265 -0
  53. package/dist/resolve-users-CztOv0Qs.js +120 -0
  54. package/dist/runtime-DUaw66V_.js +1073 -0
  55. package/dist/runtime-api.actions.js +3 -0
  56. package/dist/runtime-api.js +30 -0
  57. package/dist/runtime-api.lookup.js +7 -0
  58. package/dist/runtime-api.monitor-CvVKvEXW.js +5 -0
  59. package/dist/runtime-api.monitor.js +8 -0
  60. package/dist/runtime-api.send.js +6 -0
  61. package/dist/runtime-api.threads.js +6 -0
  62. package/dist/runtime-fC6f4UF2.js +8 -0
  63. package/dist/runtime-setter-api.js +2 -0
  64. package/dist/secret-config-contract-B6WW5V88.js +115 -0
  65. package/dist/secret-contract-api.js +2 -0
  66. package/dist/security-audit-CnyIQKz6.js +120 -0
  67. package/dist/security-audit-contract-api.js +2 -0
  68. package/dist/security-audit.runtime-CQSkjNLu.js +2 -0
  69. package/dist/security-contract-DLvYOgLM.js +26 -0
  70. package/dist/security-contract-api.js +2 -0
  71. package/dist/security-doctor-DepqtNCI.js +18 -0
  72. package/dist/send-DCtPCHGk.js +881 -0
  73. package/dist/send.components-Bcgxvm52.js +474 -0
  74. package/dist/send.outbound-S9t0UuHc.js +330 -0
  75. package/dist/send.receipt-CDn3GBWC.js +3119 -0
  76. package/dist/send.shared-D4iBnAmn.js +669 -0
  77. package/dist/sender-identity-CxCe3_1a.js +43 -0
  78. package/dist/session-contract-Dwhw3RTY.js +6 -0
  79. package/dist/session-key-api.js +2 -0
  80. package/dist/session-key-normalization-CP8dPUid.js +23 -0
  81. package/dist/setup-entry.js +11 -0
  82. package/dist/setup-plugin-api.js +2 -0
  83. package/dist/shared-AIlvuZXt.js +171 -0
  84. package/dist/subagent-hooks-8bK-mgiU.js +120 -0
  85. package/dist/subagent-hooks-api.js +22 -0
  86. package/dist/system-events-Ba1TklaL.js +34 -0
  87. package/dist/target-resolver-BrtFQtoK.js +82 -0
  88. package/dist/targets-DWLLZE2l.js +3 -0
  89. package/dist/test-api.js +45 -0
  90. package/dist/thread-binding-api.js +4 -0
  91. package/dist/thread-bindings-9aKRmZv0.js +255 -0
  92. package/dist/thread-bindings.discord-api-ssGH5wc2.js +244 -0
  93. package/dist/thread-bindings.manager-0YBHGemk.js +534 -0
  94. package/dist/thread-bindings.session-updates-DJZGIwaU.js +54 -0
  95. package/dist/thread-bindings.state-eTFl-PqJ.js +318 -0
  96. package/dist/timeouts-CEwuGaWT.js +52 -0
  97. package/dist/timeouts.js +2 -0
  98. package/dist/typing-BmJKRpCS.js +14 -0
  99. package/package.json +19 -7
  100. package/account-inspect-api.js +0 -7
  101. package/action-runtime-api.js +0 -7
  102. package/api.js +0 -7
  103. package/channel-config-api.js +0 -7
  104. package/channel-plugin-api.js +0 -7
  105. package/configured-state.js +0 -7
  106. package/contract-api.js +0 -7
  107. package/directory-contract-api.js +0 -7
  108. package/doctor-contract-api.js +0 -7
  109. package/index.js +0 -7
  110. package/runtime-api.actions.js +0 -7
  111. package/runtime-api.js +0 -7
  112. package/runtime-api.lookup.js +0 -7
  113. package/runtime-api.monitor.js +0 -7
  114. package/runtime-api.send.js +0 -7
  115. package/runtime-api.threads.js +0 -7
  116. package/runtime-setter-api.js +0 -7
  117. package/secret-contract-api.js +0 -7
  118. package/security-audit-contract-api.js +0 -7
  119. package/security-contract-api.js +0 -7
  120. package/session-key-api.js +0 -7
  121. package/setup-entry.js +0 -7
  122. package/setup-plugin-api.js +0 -7
  123. package/subagent-hooks-api.js +0 -7
  124. package/test-api.js +0 -7
  125. package/thread-binding-api.js +0 -7
  126. package/timeouts.js +0 -7
@@ -0,0 +1,173 @@
1
+ import { r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-B7OBFePq.js";
2
+ import { t as inspectDiscordAccount } from "./account-inspect-Dqw-enky.js";
3
+ import { d as readDiscordComponentSpec } from "./components-luonoe13.js";
4
+ import { i as withDiscordInboundEventDeliveryMetadata } from "./inbound-event-delivery-C-1Ji3WP.js";
5
+ import { normalizeOptionalString } from "klaw/plugin-sdk/string-coerce-runtime";
6
+ import { createUnionActionGate } from "klaw/plugin-sdk/channel-actions";
7
+ import { extractToolSend } from "klaw/plugin-sdk/tool-send";
8
+ //#region extensions/discord/src/channel-actions.ts
9
+ let discordChannelActionsRuntimePromise;
10
+ async function loadDiscordChannelActionsRuntime() {
11
+ discordChannelActionsRuntimePromise ??= import("./channel-actions.runtime-CPtpH-yl.js");
12
+ return await discordChannelActionsRuntimePromise;
13
+ }
14
+ function listDiscoverableDiscordAccounts(cfg) {
15
+ return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
16
+ cfg,
17
+ accountId
18
+ })).filter((account) => account.enabled && account.configured);
19
+ }
20
+ function resolveDiscordActionDiscovery(cfg) {
21
+ const accounts = listDiscoverableDiscordAccounts(cfg);
22
+ if (accounts.length === 0) return null;
23
+ const unionGate = createUnionActionGate(accounts, (account) => createDiscordActionGate({
24
+ cfg,
25
+ accountId: account.accountId
26
+ }));
27
+ return { isEnabled: (key, defaultValue = true) => unionGate(key, defaultValue) };
28
+ }
29
+ function resolveScopedDiscordActionDiscovery(params) {
30
+ if (!params.accountId) return resolveDiscordActionDiscovery(params.cfg);
31
+ const account = inspectDiscordAccount({
32
+ cfg: params.cfg,
33
+ accountId: params.accountId
34
+ });
35
+ if (!account.enabled || !account.configured) return null;
36
+ const gate = createDiscordActionGate({
37
+ cfg: params.cfg,
38
+ accountId: account.accountId
39
+ });
40
+ return { isEnabled: (key, defaultValue = true) => gate(key, defaultValue) };
41
+ }
42
+ function describeDiscordMessageTool({ cfg, accountId }) {
43
+ const discovery = resolveScopedDiscordActionDiscovery({
44
+ cfg,
45
+ accountId
46
+ });
47
+ if (!discovery) return {
48
+ actions: [],
49
+ capabilities: [],
50
+ schema: null
51
+ };
52
+ const actions = new Set(["send"]);
53
+ if (discovery.isEnabled("polls")) actions.add("poll");
54
+ if (discovery.isEnabled("reactions")) {
55
+ actions.add("react");
56
+ actions.add("reactions");
57
+ actions.add("emoji-list");
58
+ }
59
+ if (discovery.isEnabled("messages")) {
60
+ actions.add("upload-file");
61
+ actions.add("read");
62
+ actions.add("edit");
63
+ actions.add("delete");
64
+ }
65
+ if (discovery.isEnabled("pins")) {
66
+ actions.add("pin");
67
+ actions.add("unpin");
68
+ actions.add("list-pins");
69
+ }
70
+ if (discovery.isEnabled("permissions")) actions.add("permissions");
71
+ if (discovery.isEnabled("threads")) {
72
+ actions.add("thread-create");
73
+ actions.add("thread-list");
74
+ actions.add("thread-reply");
75
+ }
76
+ if (discovery.isEnabled("search")) actions.add("search");
77
+ if (discovery.isEnabled("stickers")) actions.add("sticker");
78
+ if (discovery.isEnabled("memberInfo")) actions.add("member-info");
79
+ if (discovery.isEnabled("roleInfo")) actions.add("role-info");
80
+ if (discovery.isEnabled("emojiUploads")) actions.add("emoji-upload");
81
+ if (discovery.isEnabled("stickerUploads")) actions.add("sticker-upload");
82
+ if (discovery.isEnabled("roles", false)) {
83
+ actions.add("role-add");
84
+ actions.add("role-remove");
85
+ }
86
+ if (discovery.isEnabled("channelInfo")) {
87
+ actions.add("channel-info");
88
+ actions.add("channel-list");
89
+ }
90
+ if (discovery.isEnabled("channels")) {
91
+ actions.add("channel-create");
92
+ actions.add("channel-edit");
93
+ actions.add("channel-delete");
94
+ actions.add("channel-move");
95
+ actions.add("category-create");
96
+ actions.add("category-edit");
97
+ actions.add("category-delete");
98
+ }
99
+ if (discovery.isEnabled("voiceStatus")) actions.add("voice-status");
100
+ if (discovery.isEnabled("events")) {
101
+ actions.add("event-list");
102
+ actions.add("event-create");
103
+ }
104
+ if (discovery.isEnabled("moderation", false)) {
105
+ actions.add("timeout");
106
+ actions.add("kick");
107
+ actions.add("ban");
108
+ }
109
+ if (discovery.isEnabled("presence", false)) actions.add("set-presence");
110
+ return {
111
+ actions: Array.from(actions),
112
+ capabilities: ["presentation"]
113
+ };
114
+ }
115
+ const discordMessageActions = {
116
+ resolveExecutionMode: ({ action }) => action === "read" || action === "search" ? "gateway" : "local",
117
+ describeMessageTool: describeDiscordMessageTool,
118
+ extractToolSend: ({ args }) => {
119
+ const action = normalizeOptionalString(args.action) ?? "";
120
+ if (action === "sendMessage") return extractToolSend(args, "sendMessage");
121
+ if (action === "threadReply") {
122
+ const channelId = normalizeOptionalString(args.channelId) ?? "";
123
+ return channelId ? { to: `channel:${channelId}` } : null;
124
+ }
125
+ return null;
126
+ },
127
+ prepareSendPayload: ({ ctx, payload }) => {
128
+ if (ctx.action !== "send") return null;
129
+ const payloadWithDeliveryMetadata = withDiscordInboundEventDeliveryMetadata(payload, {
130
+ sessionKey: ctx.sessionKey,
131
+ inboundEventKind: ctx.inboundEventKind
132
+ });
133
+ const rawComponents = ctx.params.components;
134
+ if (typeof rawComponents === "function") return null;
135
+ const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
136
+ const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
137
+ const embeds = Array.isArray(ctx.params.embeds) ? ctx.params.embeds : void 0;
138
+ if ((componentSpec || nativeComponents) && embeds?.length) return null;
139
+ const filename = normalizeOptionalString(ctx.params.filename);
140
+ if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payloadWithDeliveryMetadata;
141
+ const discordData = payloadWithDeliveryMetadata.channelData?.discord && typeof payloadWithDeliveryMetadata.channelData.discord === "object" && !Array.isArray(payloadWithDeliveryMetadata.channelData.discord) ? payloadWithDeliveryMetadata.channelData.discord : {};
142
+ return {
143
+ ...payloadWithDeliveryMetadata,
144
+ channelData: {
145
+ ...payloadWithDeliveryMetadata.channelData,
146
+ discord: {
147
+ ...discordData,
148
+ ...componentSpec ? { components: componentSpec } : {},
149
+ ...nativeComponents ? { components: nativeComponents } : {},
150
+ ...embeds?.length ? { embeds } : {},
151
+ ...filename ? { filename } : {}
152
+ }
153
+ }
154
+ };
155
+ },
156
+ handleAction: async ({ action, params, cfg, accountId, requesterSenderId, toolContext, mediaAccess, mediaLocalRoots, mediaReadFile, sessionKey, inboundEventKind }) => {
157
+ return await (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
158
+ action,
159
+ params,
160
+ cfg,
161
+ accountId,
162
+ requesterSenderId,
163
+ toolContext,
164
+ mediaAccess,
165
+ mediaLocalRoots,
166
+ mediaReadFile,
167
+ ...sessionKey ? { sessionKey } : {},
168
+ ...inboundEventKind ? { inboundEventKind } : {}
169
+ });
170
+ }
171
+ };
172
+ //#endregion
173
+ export { discordMessageActions as t };
@@ -0,0 +1,263 @@
1
+ import { Ut as resolveDiscordChannelId } from "./send.receipt-CDn3GBWC.js";
2
+ import { i as buildDiscordPresentationComponents, r as buildDiscordInteractiveComponents } from "./components-luonoe13.js";
3
+ import { t as handleDiscordAction } from "./runtime-DUaw66V_.js";
4
+ import "./targets-DWLLZE2l.js";
5
+ import "./action-runtime-api.js";
6
+ import { r as notifyDiscordInboundEventOutboundSuccess } from "./inbound-event-delivery-C-1Ji3WP.js";
7
+ import { t as tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin-B5BArS2n.js";
8
+ import { normalizeOptionalStringifiedId } from "klaw/plugin-sdk/string-coerce-runtime";
9
+ import { resolveReactionMessageId } from "klaw/plugin-sdk/channel-actions";
10
+ import { readBooleanParam } from "klaw/plugin-sdk/boolean-param";
11
+ import { normalizeInteractiveReply, normalizeMessagePresentation } from "klaw/plugin-sdk/interactive-runtime";
12
+ import { readNumberParam, readStringArrayParam, readStringParam } from "klaw/plugin-sdk/agent-runtime";
13
+ //#region extensions/discord/src/actions/handle-action.ts
14
+ const providerId = "discord";
15
+ function readCurrentDiscordTarget(toolContext) {
16
+ const provider = toolContext?.currentChannelProvider?.trim().toLowerCase();
17
+ if (provider && provider !== providerId) return;
18
+ return toolContext?.currentChannelId?.trim() || void 0;
19
+ }
20
+ async function handleDiscordMessageAction(ctx) {
21
+ const { action, params, cfg } = ctx;
22
+ const accountId = ctx.accountId ?? readStringParam(params, "accountId");
23
+ const actionOptions = {
24
+ mediaAccess: ctx.mediaAccess,
25
+ mediaLocalRoots: ctx.mediaLocalRoots,
26
+ mediaReadFile: ctx.mediaReadFile
27
+ };
28
+ const notifyVisibleOutbound = (to, fallbackSessionKey) => notifyDiscordInboundEventOutboundSuccess({
29
+ sessionKey: ctx.sessionKey ?? fallbackSessionKey ?? void 0,
30
+ to,
31
+ accountId,
32
+ inboundEventKind: ctx.inboundEventKind
33
+ });
34
+ const readTarget = () => {
35
+ const target = readStringParam(params, "channelId") ?? readStringParam(params, "to") ?? readCurrentDiscordTarget(ctx.toolContext);
36
+ if (!target) throw new Error("Discord channel target is required (use channel:<id>).");
37
+ return target;
38
+ };
39
+ const resolveChannelId = () => resolveDiscordChannelId(readTarget());
40
+ const readSendTarget = () => {
41
+ const target = readStringParam(params, "to") ?? readStringParam(params, "target") ?? readCurrentDiscordTarget(ctx.toolContext);
42
+ if (!target) throw new Error("Discord channel target is required (use channel:<id>).");
43
+ return target;
44
+ };
45
+ if (action === "send") {
46
+ const to = readSendTarget();
47
+ const asVoice = readBooleanParam(params, "asVoice") === true;
48
+ const rawComponents = params.components ?? buildDiscordPresentationComponents(normalizeMessagePresentation(params.presentation)) ?? buildDiscordInteractiveComponents(normalizeInteractiveReply(params.interactive));
49
+ const hasComponents = Boolean(rawComponents) && (typeof rawComponents === "function" || typeof rawComponents === "object");
50
+ const components = hasComponents ? rawComponents : void 0;
51
+ const mediaUrl = readStringParam(params, "media", { trim: false }) ?? readStringParam(params, "path", { trim: false }) ?? readStringParam(params, "filePath", { trim: false });
52
+ const content = readStringParam(params, "message", {
53
+ required: !asVoice && !hasComponents && !mediaUrl,
54
+ allowEmpty: true
55
+ });
56
+ const filename = readStringParam(params, "filename");
57
+ const replyTo = readStringParam(params, "replyTo");
58
+ const rawEmbeds = params.embeds;
59
+ const embeds = Array.isArray(rawEmbeds) ? rawEmbeds : void 0;
60
+ const silent = readBooleanParam(params, "silent") === true;
61
+ const suppressEmbeds = readBooleanParam(params, "suppressEmbeds");
62
+ const sessionKey = readStringParam(params, "__sessionKey");
63
+ const agentId = readStringParam(params, "__agentId");
64
+ const threadName = readStringParam(params, "threadName");
65
+ const result = await handleDiscordAction({
66
+ action: "sendMessage",
67
+ accountId: accountId ?? void 0,
68
+ to,
69
+ content: content ?? "",
70
+ ...threadName ? { threadName } : {},
71
+ mediaUrl: mediaUrl ?? void 0,
72
+ filename: filename ?? void 0,
73
+ replyTo: replyTo ?? void 0,
74
+ components,
75
+ embeds,
76
+ asVoice,
77
+ silent,
78
+ ...suppressEmbeds === void 0 ? {} : { suppressEmbeds },
79
+ __sessionKey: sessionKey ?? void 0,
80
+ __agentId: agentId ?? void 0
81
+ }, cfg, actionOptions);
82
+ notifyVisibleOutbound(to, sessionKey);
83
+ return result;
84
+ }
85
+ if (action === "upload-file") {
86
+ const to = readSendTarget();
87
+ const mediaUrl = readStringParam(params, "filePath", { trim: false }) ?? readStringParam(params, "path", { trim: false }) ?? readStringParam(params, "media", { trim: false });
88
+ if (!mediaUrl) throw new Error("upload-file requires filePath, path, or media.");
89
+ const content = readStringParam(params, "message", { allowEmpty: true }) ?? readStringParam(params, "content", { allowEmpty: true });
90
+ const filename = readStringParam(params, "filename");
91
+ const replyTo = readStringParam(params, "replyTo");
92
+ const silent = readBooleanParam(params, "silent") === true;
93
+ const suppressEmbeds = readBooleanParam(params, "suppressEmbeds");
94
+ const sessionKey = readStringParam(params, "__sessionKey");
95
+ const agentId = readStringParam(params, "__agentId");
96
+ const result = await handleDiscordAction({
97
+ action: "sendMessage",
98
+ accountId: accountId ?? void 0,
99
+ to,
100
+ content: content ?? "",
101
+ mediaUrl,
102
+ filename: filename ?? void 0,
103
+ replyTo: replyTo ?? void 0,
104
+ silent,
105
+ ...suppressEmbeds === void 0 ? {} : { suppressEmbeds },
106
+ __sessionKey: sessionKey ?? void 0,
107
+ __agentId: agentId ?? void 0
108
+ }, cfg, actionOptions);
109
+ notifyVisibleOutbound(to, sessionKey);
110
+ return result;
111
+ }
112
+ if (action === "poll") {
113
+ const to = readStringParam(params, "to", { required: true });
114
+ const question = readStringParam(params, "pollQuestion", { required: true });
115
+ const answers = readStringArrayParam(params, "pollOption", { required: true });
116
+ const allowMultiselect = readBooleanParam(params, "pollMulti");
117
+ const durationHours = readNumberParam(params, "pollDurationHours", {
118
+ integer: true,
119
+ strict: true
120
+ });
121
+ const result = await handleDiscordAction({
122
+ action: "poll",
123
+ accountId: accountId ?? void 0,
124
+ to,
125
+ question,
126
+ answers,
127
+ allowMultiselect,
128
+ durationHours: durationHours ?? void 0,
129
+ content: readStringParam(params, "message")
130
+ }, cfg, actionOptions);
131
+ notifyVisibleOutbound(to);
132
+ return result;
133
+ }
134
+ if (action === "react") {
135
+ const messageId = normalizeOptionalStringifiedId(resolveReactionMessageId({
136
+ args: params,
137
+ toolContext: ctx.toolContext
138
+ })) ?? "";
139
+ if (!messageId) throw new Error("messageId required. Provide messageId explicitly or react to the current inbound message.");
140
+ const emoji = readStringParam(params, "emoji", { allowEmpty: true });
141
+ const remove = readBooleanParam(params, "remove");
142
+ return await handleDiscordAction({
143
+ action: "react",
144
+ accountId: accountId ?? void 0,
145
+ channelId: readTarget(),
146
+ messageId,
147
+ emoji,
148
+ remove
149
+ }, cfg, actionOptions);
150
+ }
151
+ if (action === "reactions") {
152
+ const messageId = readStringParam(params, "messageId", { required: true });
153
+ const limit = readNumberParam(params, "limit", { integer: true });
154
+ return await handleDiscordAction({
155
+ action: "reactions",
156
+ accountId: accountId ?? void 0,
157
+ channelId: readTarget(),
158
+ messageId,
159
+ limit
160
+ }, cfg, actionOptions);
161
+ }
162
+ if (action === "read") {
163
+ const limit = readNumberParam(params, "limit", { integer: true });
164
+ return await handleDiscordAction({
165
+ action: "readMessages",
166
+ accountId: accountId ?? void 0,
167
+ channelId: resolveChannelId(),
168
+ limit,
169
+ before: readStringParam(params, "before"),
170
+ after: readStringParam(params, "after"),
171
+ around: readStringParam(params, "around")
172
+ }, cfg, actionOptions);
173
+ }
174
+ if (action === "edit") {
175
+ const messageId = readStringParam(params, "messageId", { required: true });
176
+ const content = readStringParam(params, "message", { required: true });
177
+ return await handleDiscordAction({
178
+ action: "editMessage",
179
+ accountId: accountId ?? void 0,
180
+ channelId: resolveChannelId(),
181
+ messageId,
182
+ content
183
+ }, cfg, actionOptions);
184
+ }
185
+ if (action === "delete") {
186
+ const messageId = readStringParam(params, "messageId", { required: true });
187
+ return await handleDiscordAction({
188
+ action: "deleteMessage",
189
+ accountId: accountId ?? void 0,
190
+ channelId: resolveChannelId(),
191
+ messageId
192
+ }, cfg, actionOptions);
193
+ }
194
+ if (action === "pin" || action === "unpin" || action === "list-pins") {
195
+ const messageId = action === "list-pins" ? void 0 : readStringParam(params, "messageId", { required: true });
196
+ return await handleDiscordAction({
197
+ action: action === "pin" ? "pinMessage" : action === "unpin" ? "unpinMessage" : "listPins",
198
+ accountId: accountId ?? void 0,
199
+ channelId: resolveChannelId(),
200
+ messageId
201
+ }, cfg, actionOptions);
202
+ }
203
+ if (action === "permissions") return await handleDiscordAction({
204
+ action: "permissions",
205
+ accountId: accountId ?? void 0,
206
+ channelId: resolveChannelId()
207
+ }, cfg, actionOptions);
208
+ if (action === "thread-create") {
209
+ const name = readStringParam(params, "threadName", { required: true });
210
+ const messageId = readStringParam(params, "messageId");
211
+ const content = readStringParam(params, "message");
212
+ const autoArchiveMinutes = readNumberParam(params, "autoArchiveMin", { integer: true });
213
+ const appliedTags = readStringArrayParam(params, "appliedTags");
214
+ const result = await handleDiscordAction({
215
+ action: "threadCreate",
216
+ accountId: accountId ?? void 0,
217
+ channelId: resolveChannelId(),
218
+ name,
219
+ messageId,
220
+ content,
221
+ autoArchiveMinutes,
222
+ appliedTags: appliedTags ?? void 0
223
+ }, cfg, actionOptions);
224
+ notifyVisibleOutbound(resolveChannelId());
225
+ return result;
226
+ }
227
+ if (action === "sticker") {
228
+ const to = readStringParam(params, "to", { required: true });
229
+ const stickerIds = readStringArrayParam(params, "stickerId", {
230
+ required: true,
231
+ label: "sticker-id"
232
+ }) ?? [];
233
+ const result = await handleDiscordAction({
234
+ action: "sticker",
235
+ accountId: accountId ?? void 0,
236
+ to,
237
+ stickerIds,
238
+ content: readStringParam(params, "message")
239
+ }, cfg, actionOptions);
240
+ notifyVisibleOutbound(to);
241
+ return result;
242
+ }
243
+ if (action === "set-presence") return await handleDiscordAction({
244
+ action: "setPresence",
245
+ accountId: accountId ?? void 0,
246
+ status: readStringParam(params, "status"),
247
+ activityType: readStringParam(params, "activityType"),
248
+ activityName: readStringParam(params, "activityName"),
249
+ activityUrl: readStringParam(params, "activityUrl"),
250
+ activityState: readStringParam(params, "activityState")
251
+ }, cfg, actionOptions);
252
+ const adminResult = await tryHandleDiscordMessageActionGuildAdmin({
253
+ ctx,
254
+ resolveChannelId
255
+ });
256
+ if (adminResult !== void 0) {
257
+ if (action === "thread-reply") notifyVisibleOutbound(readStringParam(params, "threadId") ?? readTarget());
258
+ return adminResult;
259
+ }
260
+ throw new Error(`Action ${action} is not supported for provider ${providerId}.`);
261
+ }
262
+ //#endregion
263
+ export { handleDiscordMessageAction };
@@ -0,0 +1,21 @@
1
+ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "klaw/plugin-sdk/account-id";
2
+ import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses } from "klaw/plugin-sdk/channel-status";
3
+ //#region extensions/discord/src/channel-api.ts
4
+ const DISCORD_CHANNEL_META = {
5
+ id: "discord",
6
+ label: "Discord",
7
+ selectionLabel: "Discord (Bot API)",
8
+ detailLabel: "Discord Bot",
9
+ docsPath: "/channels/discord",
10
+ docsLabel: "discord",
11
+ blurb: "very well supported right now.",
12
+ systemImage: "bubble.left.and.bubble.right",
13
+ markdownCapable: true,
14
+ preferSessionLookupForAnnounceTarget: true
15
+ };
16
+ function getChatChannelMeta(id) {
17
+ if (id !== DISCORD_CHANNEL_META.id) throw new Error(`Unsupported Discord channel meta lookup: ${id}`);
18
+ return DISCORD_CHANNEL_META;
19
+ }
20
+ //#endregion
21
+ export { projectCredentialSnapshotFields as a, getChatChannelMeta as i, PAIRING_APPROVED_MESSAGE as n, resolveConfiguredFromCredentialStatuses as o, buildTokenChannelStatusSummary as r, DEFAULT_ACCOUNT_ID$1 as t };
@@ -0,0 +1,2 @@
1
+ import { t as DiscordChannelConfigSchema } from "./config-schema-DIqJBGwC.js";
2
+ export { DiscordChannelConfigSchema };
@@ -0,0 +1,2 @@
1
+ import { t as discordPlugin } from "./channel-U_aeoFwW.js";
2
+ export { discordPlugin };