@poolzin/pool-bot 2026.3.25 → 2026.3.26
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/agents/model-fallback.js +5 -4
- package/dist/agents/tools/common.js +16 -201
- package/dist/auto-reply/auto-reply/reply/agent-runner-execution.js +502 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-helpers.js +65 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-memory.js +160 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-payloads.js +85 -0
- package/dist/auto-reply/auto-reply/reply/agent-runner-utils.js +101 -0
- package/dist/auto-reply/auto-reply/reply/bash-command.js +338 -0
- package/dist/auto-reply/auto-reply/reply/block-streaming.js +91 -0
- package/dist/auto-reply/auto-reply/reply/commands-approve.js +88 -0
- package/dist/auto-reply/auto-reply/reply/commands-bash.js +26 -0
- package/dist/auto-reply/auto-reply/reply/commands-compact.js +107 -0
- package/dist/auto-reply/auto-reply/reply/commands-config.js +241 -0
- package/dist/auto-reply/auto-reply/reply/commands-context-report.js +295 -0
- package/dist/auto-reply/auto-reply/reply/commands-context.js +30 -0
- package/dist/auto-reply/auto-reply/reply/commands-core.js +151 -0
- package/dist/auto-reply/auto-reply/reply/commands-export-session.js +163 -0
- package/dist/auto-reply/auto-reply/reply/commands-info.js +184 -0
- package/dist/auto-reply/auto-reply/reply/commands-models.js +299 -0
- package/dist/auto-reply/auto-reply/reply/commands-plugin.js +35 -0
- package/dist/auto-reply/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset-standard.js +13 -0
- package/dist/auto-reply/auto-reply/reply/commands-setunset.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-slash-parse.js +31 -0
- package/dist/auto-reply/auto-reply/reply/commands-status.js +178 -0
- package/dist/auto-reply/auto-reply/reply/commands-subagents.js +73 -0
- package/dist/auto-reply/auto-reply/reply/commands-system-prompt.js +117 -0
- package/dist/auto-reply/auto-reply/reply/commands-tts.js +231 -0
- package/dist/auto-reply/auto-reply/reply/directive-handling.impl.js +380 -0
- package/dist/auto-reply/auto-reply/reply/followup-runner.js +227 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-apply.js +201 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives-utils.js +54 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-directives.js +332 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-inline-actions.js +258 -0
- package/dist/auto-reply/auto-reply/reply/get-reply-run.js +297 -0
- package/dist/auto-reply/auto-reply/reply/groups.js +102 -0
- package/dist/auto-reply/auto-reply/reply/mentions.js +129 -0
- package/dist/auto-reply/auto-reply/reply/reply-delivery.js +92 -0
- package/dist/auto-reply/auto-reply/reply/reply-directives.js +30 -0
- package/dist/auto-reply/auto-reply/reply/reply-dispatcher.js +152 -0
- package/dist/auto-reply/auto-reply/reply/reply-elevated.js +166 -0
- package/dist/auto-reply/auto-reply/reply/reply-inline.js +28 -0
- package/dist/auto-reply/auto-reply/reply/reply-payloads.js +114 -0
- package/dist/auto-reply/auto-reply/reply/reply-reference.js +36 -0
- package/dist/auto-reply/auto-reply/reply/reply-tags.js +13 -0
- package/dist/auto-reply/auto-reply/reply/reply-threading.js +41 -0
- package/dist/auto-reply/auto-reply/reply/session-updates.js +233 -0
- package/dist/auto-reply/auto-reply/reply/stage-sandbox-media.js +146 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +2 -17772
- package/dist/canvas-host/a2ui/index.html +1 -307
- package/dist/channels/channels/directory-config.js +185 -0
- package/dist/channels/channels/discord/handle-action.guild-admin.js +332 -0
- package/dist/channels/channels/discord/handle-action.js +165 -0
- package/dist/channels/channels/discord.js +413 -0
- package/dist/channels/channels/dock.js +436 -0
- package/dist/channels/channels/index.js +51 -0
- package/dist/channels/channels/plugins/outbound/discord.js +101 -0
- package/dist/channels/channels/whatsapp.js +17 -0
- package/dist/channels/plugins/types.js +1 -1
- package/dist/channels/run-state-machine.js +7 -0
- package/dist/commands/models/auth.js +47 -1
- package/dist/commands-subagents/action-agents.js +44 -0
- package/dist/commands-subagents/action-focus.js +64 -0
- package/dist/commands-subagents/action-help.js +4 -0
- package/dist/commands-subagents/action-info.js +45 -0
- package/dist/commands-subagents/action-kill.js +60 -0
- package/dist/commands-subagents/action-list.js +44 -0
- package/dist/commands-subagents/action-log.js +29 -0
- package/dist/commands-subagents/action-send.js +119 -0
- package/dist/commands-subagents/action-spawn.js +52 -0
- package/dist/commands-subagents/action-unfocus.js +30 -0
- package/dist/commands-subagents/shared.js +303 -0
- package/dist/config/config.js +1 -8
- package/dist/config/types.secrets.js +61 -0
- package/dist/control-ui/assets/{index-D7shnQwQ.js → index-umCsvrWy.js} +884 -741
- package/dist/control-ui/assets/index-umCsvrWy.js.map +1 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js +2 -0
- package/dist/control-ui/assets/pt-BR-DedEVAvY.js.map +1 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js +2 -0
- package/dist/control-ui/assets/zh-CN-CDzeklK-.js.map +1 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js +2 -0
- package/dist/control-ui/assets/zh-TW-BJCRYNWH.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/method-scopes.js +9 -1
- package/dist/gateway/node-pending-work.js +142 -0
- package/dist/gateway/protocol/index.js +5 -1
- package/dist/gateway/protocol/schema/nodes.js +18 -0
- package/dist/gateway/server-methods/nodes-pending.js +96 -0
- package/dist/gateway/server-methods-list.js +4 -0
- package/dist/gateway/server-methods.js +2 -0
- package/dist/imessage/channel.js +253 -0
- package/dist/imessage/monitor/echo-cache.js +70 -0
- package/dist/imessage/monitor/loop-rate-limiter.js +51 -0
- package/dist/imessage/monitor/reflection-guard.js +50 -0
- package/dist/imessage/monitor/sanitize-outbound.js +25 -0
- package/dist/imessage/monitor/self-chat-cache.js +75 -0
- package/dist/imessage/runtime.js +3 -0
- package/dist/infra/exec-approval-reply.js +7 -0
- package/dist/infra/tmp-openclaw-dir.js +84 -0
- package/dist/pairing/pairing-challenge.js +15 -0
- package/dist/plugin-sdk/account-id.d.ts +1 -0
- package/dist/plugin-sdk/agent-media-payload.d.ts +12 -0
- package/dist/plugin-sdk/allow-from.d.ts +27 -0
- package/dist/plugin-sdk/command-auth.d.ts +25 -0
- package/dist/plugin-sdk/command-auth.js +3 -1
- package/dist/plugin-sdk/config-paths.d.ts +6 -0
- package/dist/plugin-sdk/file-lock.d.ts +16 -0
- package/dist/plugin-sdk/index.d.ts +428 -0
- package/dist/plugin-sdk/index.js +237 -103
- package/dist/plugin-sdk/json-store.d.ts +5 -0
- package/dist/plugin-sdk/keyed-async-queue.d.ts +12 -0
- package/dist/plugin-sdk/onboarding.d.ts +11 -0
- package/dist/plugin-sdk/provider-auth-result.d.ts +14 -0
- package/dist/plugin-sdk/slack-message-actions.d.ts +11 -0
- package/dist/plugin-sdk/status-helpers.d.ts +25 -0
- package/dist/plugin-sdk/temp-path.d.ts +12 -0
- package/dist/plugin-sdk/text-chunking.d.ts +1 -0
- package/dist/plugin-sdk/tool-send.d.ts +4 -0
- package/dist/plugin-sdk/webhook-path.d.ts +6 -0
- package/dist/plugin-sdk/webhook-targets.d.ts +23 -0
- package/dist/plugin-sdk/windows-spawn.d.ts +39 -0
- package/dist/plugin-sdk-internal/accounts.js +6 -0
- package/dist/plugin-sdk-internal/discord.js +23 -0
- package/dist/plugin-sdk-internal/imessage.js +13 -0
- package/dist/plugin-sdk-internal/setup.js +9 -0
- package/dist/plugin-sdk-internal/signal.js +13 -0
- package/dist/plugin-sdk-internal/slack.js +22 -0
- package/dist/plugin-sdk-internal/telegram.js +32 -0
- package/dist/plugin-sdk-internal/whatsapp.js +29 -0
- package/dist/routing/session-key.js +4 -185
- package/dist/shared/pid-alive.js +2 -61
- package/dist/shared/process-scoped-map.js +5 -7
- package/dist/signal/channel.js +264 -0
- package/dist/signal/monitor/access-policy.js +60 -0
- package/dist/signal/runtime.js +3 -0
- package/dist/slack/account-inspect.js +135 -0
- package/dist/slack/blocks-input.js +7 -38
- package/dist/slack/channel.js +394 -0
- package/dist/slack/interactive-replies.js +28 -0
- package/dist/slack/monitor/channel-type.js +31 -0
- package/dist/slack/monitor/dm-auth.js +49 -0
- package/dist/slack/monitor/events/interactions.modal.js +137 -0
- package/dist/slack/monitor/events/message-subtype-handlers.js +68 -0
- package/dist/slack/monitor/events/system-event-context.js +29 -0
- package/dist/slack/monitor/events/system-event-test-harness.js +41 -0
- package/dist/slack/monitor/external-arg-menu-store.js +46 -0
- package/dist/slack/monitor/message-handler/prepare-content.js +69 -0
- package/dist/slack/monitor/message-handler/prepare-thread-context.js +91 -0
- package/dist/slack/monitor/message-handler/prepare.test-helpers.js +55 -0
- package/dist/slack/monitor/reconnect-policy.js +78 -0
- package/dist/slack/monitor/slash-commands.runtime.js +1 -0
- package/dist/slack/monitor/slash-dispatch.runtime.js +9 -0
- package/dist/slack/monitor/slash-skill-commands.runtime.js +1 -0
- package/dist/slack/resolve-allowlist-common.js +36 -0
- package/dist/slack/runtime.js +3 -0
- package/dist/slack/sent-thread-cache.js +61 -0
- package/dist/slack/truncate.js +10 -0
- package/dist/telegram/account-inspect.js +175 -0
- package/dist/telegram/allow-from.js +10 -0
- package/dist/telegram/api-fetch.js +18 -0
- package/dist/telegram/approval-buttons.js +30 -0
- package/dist/telegram/audit-membership-runtime.js +61 -0
- package/dist/telegram/bot/delivery.replies.js +508 -0
- package/dist/telegram/bot/delivery.resolve-media.js +227 -0
- package/dist/telegram/bot/delivery.send.js +132 -0
- package/dist/telegram/bot/reply-threading.js +46 -0
- package/dist/telegram/bot-message-context.body.js +186 -0
- package/dist/telegram/bot-message-context.session.js +207 -0
- package/dist/telegram/bot-message-context.types.js +1 -0
- package/dist/telegram/bot-native-commands.test-helpers.js +117 -0
- package/dist/telegram/bot.media.e2e-harness.js +81 -0
- package/dist/telegram/bot.media.test-utils.js +81 -0
- package/dist/telegram/channel-actions.js +225 -0
- package/dist/telegram/channel.js +515 -0
- package/dist/telegram/conversation-route.js +107 -0
- package/dist/telegram/delivery.js +2 -0
- package/dist/telegram/delivery.replies.js +508 -0
- package/dist/telegram/dm-access.js +86 -0
- package/dist/telegram/draft-stream.test-helpers.js +62 -0
- package/dist/telegram/exec-approvals-handler.js +281 -0
- package/dist/telegram/exec-approvals.js +62 -0
- package/dist/telegram/forum-service-message.js +22 -0
- package/dist/telegram/group-config-helpers.js +10 -0
- package/dist/telegram/lane-delivery-state.js +19 -0
- package/dist/telegram/lane-delivery-text-deliverer.js +357 -0
- package/dist/telegram/lane-delivery.js +2 -0
- package/dist/telegram/normalize.js +37 -0
- package/dist/telegram/onboarding.js +192 -0
- package/dist/telegram/outbound-adapter.js +100 -0
- package/dist/telegram/polling-session.js +275 -0
- package/dist/telegram/runtime.js +3 -0
- package/dist/telegram/sendchataction-401-backoff.js +71 -0
- package/dist/telegram/sequential-key.js +46 -0
- package/dist/telegram/status-issues.js +105 -0
- package/dist/telegram/target-writeback.js +165 -0
- package/dist/telegram/thread-bindings.js +560 -0
- package/dist/utils.js +10 -276
- package/dist/wizard/prompts.js +5 -5
- package/extensions/feishu/src/policy.ts +1 -1
- package/extensions/firecrawl/index.test.ts +82 -0
- package/extensions/firecrawl/index.ts +20 -0
- package/extensions/firecrawl/openclaw.plugin.json +8 -0
- package/extensions/firecrawl/package.json +12 -0
- package/extensions/firecrawl/src/config.ts +159 -0
- package/extensions/firecrawl/src/firecrawl-client.ts +446 -0
- package/extensions/firecrawl/src/firecrawl-scrape-tool.ts +89 -0
- package/extensions/firecrawl/src/firecrawl-search-provider.ts +63 -0
- package/extensions/firecrawl/src/firecrawl-search-tool.ts +76 -0
- package/package.json +1 -1
- package/dist/.buildstamp +0 -1
- package/dist/acp/bindings-store.js +0 -209
- package/dist/acp/control-plane/runtime-cache.js +0 -54
- package/dist/acp/control-plane/runtime-options.js +0 -215
- package/dist/acp/control-plane/session-actor-queue.js +0 -36
- package/dist/acp/index.js +0 -2
- package/dist/acp/runtime/errors.js +0 -47
- package/dist/acp/runtime/registry.js +0 -86
- package/dist/acp/secret-file.js +0 -22
- package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +0 -23
- package/dist/agents/bash-process-registry.test-helpers.js +0 -29
- package/dist/agents/bash-tools.exec-approval-request.js +0 -20
- package/dist/agents/bash-tools.exec-host-gateway.js +0 -240
- package/dist/agents/bash-tools.exec-host-node.js +0 -235
- package/dist/agents/checkpoint-manager.js +0 -290
- package/dist/agents/claude-cli-runner.js +0 -3
- package/dist/agents/error-classifier.js +0 -251
- package/dist/agents/live-model-filter.js +0 -84
- package/dist/agents/nvidia-models.js +0 -228
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.fixture.js +0 -34
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +0 -156
- package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +0 -30
- package/dist/agents/provider/config-loader.js +0 -76
- package/dist/agents/provider/index.js +0 -15
- package/dist/agents/provider/models-dev.js +0 -129
- package/dist/agents/provider/session-binding.js +0 -376
- package/dist/agents/queued-file-writer.js +0 -22
- package/dist/agents/skills/bundled-context.js +0 -23
- package/dist/agents/skills/security.js +0 -211
- package/dist/agents/skills/tools-dir.js +0 -9
- package/dist/agents/skills-install-download.js +0 -290
- package/dist/agents/skills-install-output.js +0 -30
- package/dist/agents/skills-install.download-test-utils.js +0 -36
- package/dist/agents/skills.test-helpers.js +0 -13
- package/dist/agents/subagent-announce-reliability.js +0 -160
- package/dist/agents/subagent-registry.mocks.shared.js +0 -12
- package/dist/agents/test-helpers/assistant-message-fixtures.js +0 -29
- package/dist/agents/test-helpers/fast-coding-tools.js +0 -1
- package/dist/agents/test-helpers/fast-core-tools.js +0 -8
- package/dist/agents/test-helpers/fast-tool-stubs.js +0 -18
- package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +0 -74
- package/dist/agents/test-helpers/pi-tools-sandbox-context.js +0 -27
- package/dist/agents/tool-display-common.js +0 -915
- package/dist/agents/tool-policy-shared.js +0 -108
- package/dist/agents/tool-policy.conformance.js +0 -14
- package/dist/agents/tool-result-truncation.js +0 -299
- package/dist/agents/tools/cron-tool.test-helpers.js +0 -12
- package/dist/agents/tools/discord-actions-moderation-shared.js +0 -27
- package/dist/agents/tools/discord-actions-presence.js +0 -78
- package/dist/control-ui/assets/index-D7shnQwQ.js.map +0 -1
- package/dist/discord/discord-improvements.js +0 -167
- package/dist/discord/index.js +0 -2
- package/dist/hooks/bundled/boot-md/HOOK.md +0 -19
- package/dist/hooks/bundled/command-logger/HOOK.md +0 -122
- package/dist/hooks/bundled/session-memory/HOOK.md +0 -86
- package/dist/hooks/bundled/soul-evil/HOOK.md +0 -71
- package/dist/whatsapp/normalize.js +0 -66
- package/dist/whatsapp/resolve-outbound-target.js +0 -42
- /package/dist/{acp/runtime/types.js → auto-reply/auto-reply/reply/commands-types.js} +0 -0
- /package/dist/{agents/pi-embedded-payloads.js → slack/account-surface-fields.js} +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { readNumberParam, readStringArrayParam, readStringParam, } from "../../../../agents/tools/common.js";
|
|
2
|
+
import { handleDiscordAction } from "../../../../agents/tools/discord-actions.js";
|
|
3
|
+
export async function tryHandleDiscordMessageActionGuildAdmin(params) {
|
|
4
|
+
const { ctx, resolveChannelId, readParentIdParam } = params;
|
|
5
|
+
const { action, params: actionParams, cfg } = ctx;
|
|
6
|
+
const accountId = ctx.accountId ?? readStringParam(actionParams, "accountId");
|
|
7
|
+
if (action === "member-info") {
|
|
8
|
+
const userId = readStringParam(actionParams, "userId", { required: true });
|
|
9
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
10
|
+
required: true,
|
|
11
|
+
});
|
|
12
|
+
return await handleDiscordAction({ action: "memberInfo", accountId: accountId ?? undefined, guildId, userId }, cfg);
|
|
13
|
+
}
|
|
14
|
+
if (action === "role-info") {
|
|
15
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
16
|
+
required: true,
|
|
17
|
+
});
|
|
18
|
+
return await handleDiscordAction({ action: "roleInfo", accountId: accountId ?? undefined, guildId }, cfg);
|
|
19
|
+
}
|
|
20
|
+
if (action === "emoji-list") {
|
|
21
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
22
|
+
required: true,
|
|
23
|
+
});
|
|
24
|
+
return await handleDiscordAction({ action: "emojiList", accountId: accountId ?? undefined, guildId }, cfg);
|
|
25
|
+
}
|
|
26
|
+
if (action === "emoji-upload") {
|
|
27
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
28
|
+
required: true,
|
|
29
|
+
});
|
|
30
|
+
const name = readStringParam(actionParams, "emojiName", { required: true });
|
|
31
|
+
const mediaUrl = readStringParam(actionParams, "media", {
|
|
32
|
+
required: true,
|
|
33
|
+
trim: false,
|
|
34
|
+
});
|
|
35
|
+
const roleIds = readStringArrayParam(actionParams, "roleIds");
|
|
36
|
+
return await handleDiscordAction({
|
|
37
|
+
action: "emojiUpload",
|
|
38
|
+
accountId: accountId ?? undefined,
|
|
39
|
+
guildId,
|
|
40
|
+
name,
|
|
41
|
+
mediaUrl,
|
|
42
|
+
roleIds,
|
|
43
|
+
}, cfg);
|
|
44
|
+
}
|
|
45
|
+
if (action === "sticker-upload") {
|
|
46
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
47
|
+
required: true,
|
|
48
|
+
});
|
|
49
|
+
const name = readStringParam(actionParams, "stickerName", {
|
|
50
|
+
required: true,
|
|
51
|
+
});
|
|
52
|
+
const description = readStringParam(actionParams, "stickerDesc", {
|
|
53
|
+
required: true,
|
|
54
|
+
});
|
|
55
|
+
const tags = readStringParam(actionParams, "stickerTags", {
|
|
56
|
+
required: true,
|
|
57
|
+
});
|
|
58
|
+
const mediaUrl = readStringParam(actionParams, "media", {
|
|
59
|
+
required: true,
|
|
60
|
+
trim: false,
|
|
61
|
+
});
|
|
62
|
+
return await handleDiscordAction({
|
|
63
|
+
action: "stickerUpload",
|
|
64
|
+
accountId: accountId ?? undefined,
|
|
65
|
+
guildId,
|
|
66
|
+
name,
|
|
67
|
+
description,
|
|
68
|
+
tags,
|
|
69
|
+
mediaUrl,
|
|
70
|
+
}, cfg);
|
|
71
|
+
}
|
|
72
|
+
if (action === "role-add" || action === "role-remove") {
|
|
73
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
74
|
+
required: true,
|
|
75
|
+
});
|
|
76
|
+
const userId = readStringParam(actionParams, "userId", { required: true });
|
|
77
|
+
const roleId = readStringParam(actionParams, "roleId", { required: true });
|
|
78
|
+
return await handleDiscordAction({
|
|
79
|
+
action: action === "role-add" ? "roleAdd" : "roleRemove",
|
|
80
|
+
accountId: accountId ?? undefined,
|
|
81
|
+
guildId,
|
|
82
|
+
userId,
|
|
83
|
+
roleId,
|
|
84
|
+
}, cfg);
|
|
85
|
+
}
|
|
86
|
+
if (action === "channel-info") {
|
|
87
|
+
const channelId = readStringParam(actionParams, "channelId", {
|
|
88
|
+
required: true,
|
|
89
|
+
});
|
|
90
|
+
return await handleDiscordAction({ action: "channelInfo", accountId: accountId ?? undefined, channelId }, cfg);
|
|
91
|
+
}
|
|
92
|
+
if (action === "channel-list") {
|
|
93
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
94
|
+
required: true,
|
|
95
|
+
});
|
|
96
|
+
return await handleDiscordAction({ action: "channelList", accountId: accountId ?? undefined, guildId }, cfg);
|
|
97
|
+
}
|
|
98
|
+
if (action === "channel-create") {
|
|
99
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
100
|
+
required: true,
|
|
101
|
+
});
|
|
102
|
+
const name = readStringParam(actionParams, "name", { required: true });
|
|
103
|
+
const type = readNumberParam(actionParams, "type", { integer: true });
|
|
104
|
+
const parentId = readParentIdParam(actionParams);
|
|
105
|
+
const topic = readStringParam(actionParams, "topic");
|
|
106
|
+
const position = readNumberParam(actionParams, "position", {
|
|
107
|
+
integer: true,
|
|
108
|
+
});
|
|
109
|
+
const nsfw = typeof actionParams.nsfw === "boolean" ? actionParams.nsfw : undefined;
|
|
110
|
+
return await handleDiscordAction({
|
|
111
|
+
action: "channelCreate",
|
|
112
|
+
accountId: accountId ?? undefined,
|
|
113
|
+
guildId,
|
|
114
|
+
name,
|
|
115
|
+
type: type ?? undefined,
|
|
116
|
+
parentId: parentId ?? undefined,
|
|
117
|
+
topic: topic ?? undefined,
|
|
118
|
+
position: position ?? undefined,
|
|
119
|
+
nsfw,
|
|
120
|
+
}, cfg);
|
|
121
|
+
}
|
|
122
|
+
if (action === "channel-edit") {
|
|
123
|
+
const channelId = readStringParam(actionParams, "channelId", {
|
|
124
|
+
required: true,
|
|
125
|
+
});
|
|
126
|
+
const name = readStringParam(actionParams, "name");
|
|
127
|
+
const topic = readStringParam(actionParams, "topic");
|
|
128
|
+
const position = readNumberParam(actionParams, "position", {
|
|
129
|
+
integer: true,
|
|
130
|
+
});
|
|
131
|
+
const parentId = readParentIdParam(actionParams);
|
|
132
|
+
const nsfw = typeof actionParams.nsfw === "boolean" ? actionParams.nsfw : undefined;
|
|
133
|
+
const rateLimitPerUser = readNumberParam(actionParams, "rateLimitPerUser", {
|
|
134
|
+
integer: true,
|
|
135
|
+
});
|
|
136
|
+
return await handleDiscordAction({
|
|
137
|
+
action: "channelEdit",
|
|
138
|
+
accountId: accountId ?? undefined,
|
|
139
|
+
channelId,
|
|
140
|
+
name: name ?? undefined,
|
|
141
|
+
topic: topic ?? undefined,
|
|
142
|
+
position: position ?? undefined,
|
|
143
|
+
parentId: parentId === undefined ? undefined : parentId,
|
|
144
|
+
nsfw,
|
|
145
|
+
rateLimitPerUser: rateLimitPerUser ?? undefined,
|
|
146
|
+
}, cfg);
|
|
147
|
+
}
|
|
148
|
+
if (action === "channel-delete") {
|
|
149
|
+
const channelId = readStringParam(actionParams, "channelId", {
|
|
150
|
+
required: true,
|
|
151
|
+
});
|
|
152
|
+
return await handleDiscordAction({ action: "channelDelete", accountId: accountId ?? undefined, channelId }, cfg);
|
|
153
|
+
}
|
|
154
|
+
if (action === "channel-move") {
|
|
155
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
156
|
+
required: true,
|
|
157
|
+
});
|
|
158
|
+
const channelId = readStringParam(actionParams, "channelId", {
|
|
159
|
+
required: true,
|
|
160
|
+
});
|
|
161
|
+
const parentId = readParentIdParam(actionParams);
|
|
162
|
+
const position = readNumberParam(actionParams, "position", {
|
|
163
|
+
integer: true,
|
|
164
|
+
});
|
|
165
|
+
return await handleDiscordAction({
|
|
166
|
+
action: "channelMove",
|
|
167
|
+
accountId: accountId ?? undefined,
|
|
168
|
+
guildId,
|
|
169
|
+
channelId,
|
|
170
|
+
parentId: parentId === undefined ? undefined : parentId,
|
|
171
|
+
position: position ?? undefined,
|
|
172
|
+
}, cfg);
|
|
173
|
+
}
|
|
174
|
+
if (action === "category-create") {
|
|
175
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
176
|
+
required: true,
|
|
177
|
+
});
|
|
178
|
+
const name = readStringParam(actionParams, "name", { required: true });
|
|
179
|
+
const position = readNumberParam(actionParams, "position", {
|
|
180
|
+
integer: true,
|
|
181
|
+
});
|
|
182
|
+
return await handleDiscordAction({
|
|
183
|
+
action: "categoryCreate",
|
|
184
|
+
accountId: accountId ?? undefined,
|
|
185
|
+
guildId,
|
|
186
|
+
name,
|
|
187
|
+
position: position ?? undefined,
|
|
188
|
+
}, cfg);
|
|
189
|
+
}
|
|
190
|
+
if (action === "category-edit") {
|
|
191
|
+
const categoryId = readStringParam(actionParams, "categoryId", {
|
|
192
|
+
required: true,
|
|
193
|
+
});
|
|
194
|
+
const name = readStringParam(actionParams, "name");
|
|
195
|
+
const position = readNumberParam(actionParams, "position", {
|
|
196
|
+
integer: true,
|
|
197
|
+
});
|
|
198
|
+
return await handleDiscordAction({
|
|
199
|
+
action: "categoryEdit",
|
|
200
|
+
accountId: accountId ?? undefined,
|
|
201
|
+
categoryId,
|
|
202
|
+
name: name ?? undefined,
|
|
203
|
+
position: position ?? undefined,
|
|
204
|
+
}, cfg);
|
|
205
|
+
}
|
|
206
|
+
if (action === "category-delete") {
|
|
207
|
+
const categoryId = readStringParam(actionParams, "categoryId", {
|
|
208
|
+
required: true,
|
|
209
|
+
});
|
|
210
|
+
return await handleDiscordAction({ action: "categoryDelete", accountId: accountId ?? undefined, categoryId }, cfg);
|
|
211
|
+
}
|
|
212
|
+
if (action === "voice-status") {
|
|
213
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
214
|
+
required: true,
|
|
215
|
+
});
|
|
216
|
+
const userId = readStringParam(actionParams, "userId", { required: true });
|
|
217
|
+
return await handleDiscordAction({ action: "voiceStatus", accountId: accountId ?? undefined, guildId, userId }, cfg);
|
|
218
|
+
}
|
|
219
|
+
if (action === "event-list") {
|
|
220
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
221
|
+
required: true,
|
|
222
|
+
});
|
|
223
|
+
return await handleDiscordAction({ action: "eventList", accountId: accountId ?? undefined, guildId }, cfg);
|
|
224
|
+
}
|
|
225
|
+
if (action === "event-create") {
|
|
226
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
227
|
+
required: true,
|
|
228
|
+
});
|
|
229
|
+
const name = readStringParam(actionParams, "eventName", { required: true });
|
|
230
|
+
const startTime = readStringParam(actionParams, "startTime", {
|
|
231
|
+
required: true,
|
|
232
|
+
});
|
|
233
|
+
const endTime = readStringParam(actionParams, "endTime");
|
|
234
|
+
const description = readStringParam(actionParams, "desc");
|
|
235
|
+
const channelId = readStringParam(actionParams, "channelId");
|
|
236
|
+
const location = readStringParam(actionParams, "location");
|
|
237
|
+
const entityType = readStringParam(actionParams, "eventType");
|
|
238
|
+
return await handleDiscordAction({
|
|
239
|
+
action: "eventCreate",
|
|
240
|
+
accountId: accountId ?? undefined,
|
|
241
|
+
guildId,
|
|
242
|
+
name,
|
|
243
|
+
startTime,
|
|
244
|
+
endTime,
|
|
245
|
+
description,
|
|
246
|
+
channelId,
|
|
247
|
+
location,
|
|
248
|
+
entityType,
|
|
249
|
+
}, cfg);
|
|
250
|
+
}
|
|
251
|
+
if (action === "timeout" || action === "kick" || action === "ban") {
|
|
252
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
253
|
+
required: true,
|
|
254
|
+
});
|
|
255
|
+
const userId = readStringParam(actionParams, "userId", { required: true });
|
|
256
|
+
const durationMinutes = readNumberParam(actionParams, "durationMin", {
|
|
257
|
+
integer: true,
|
|
258
|
+
});
|
|
259
|
+
const until = readStringParam(actionParams, "until");
|
|
260
|
+
const reason = readStringParam(actionParams, "reason");
|
|
261
|
+
const deleteMessageDays = readNumberParam(actionParams, "deleteDays", {
|
|
262
|
+
integer: true,
|
|
263
|
+
});
|
|
264
|
+
const discordAction = action;
|
|
265
|
+
return await handleDiscordAction({
|
|
266
|
+
action: discordAction,
|
|
267
|
+
accountId: accountId ?? undefined,
|
|
268
|
+
guildId,
|
|
269
|
+
userId,
|
|
270
|
+
durationMinutes,
|
|
271
|
+
until,
|
|
272
|
+
reason,
|
|
273
|
+
deleteMessageDays,
|
|
274
|
+
}, cfg);
|
|
275
|
+
}
|
|
276
|
+
// Some actions are conceptually "admin", but still act on a resolved channel.
|
|
277
|
+
if (action === "thread-list") {
|
|
278
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
279
|
+
required: true,
|
|
280
|
+
});
|
|
281
|
+
const channelId = readStringParam(actionParams, "channelId");
|
|
282
|
+
const includeArchived = typeof actionParams.includeArchived === "boolean" ? actionParams.includeArchived : undefined;
|
|
283
|
+
const before = readStringParam(actionParams, "before");
|
|
284
|
+
const limit = readNumberParam(actionParams, "limit", { integer: true });
|
|
285
|
+
return await handleDiscordAction({
|
|
286
|
+
action: "threadList",
|
|
287
|
+
accountId: accountId ?? undefined,
|
|
288
|
+
guildId,
|
|
289
|
+
channelId,
|
|
290
|
+
includeArchived,
|
|
291
|
+
before,
|
|
292
|
+
limit,
|
|
293
|
+
}, cfg);
|
|
294
|
+
}
|
|
295
|
+
if (action === "thread-reply") {
|
|
296
|
+
const content = readStringParam(actionParams, "message", {
|
|
297
|
+
required: true,
|
|
298
|
+
});
|
|
299
|
+
const mediaUrl = readStringParam(actionParams, "media", { trim: false });
|
|
300
|
+
const replyTo = readStringParam(actionParams, "replyTo");
|
|
301
|
+
// `message.thread-reply` (tool) uses `threadId`, while the CLI historically used `to`/`channelId`.
|
|
302
|
+
// Prefer `threadId` when present to avoid accidentally replying in the parent channel.
|
|
303
|
+
const threadId = readStringParam(actionParams, "threadId");
|
|
304
|
+
const channelId = threadId ?? resolveChannelId();
|
|
305
|
+
return await handleDiscordAction({
|
|
306
|
+
action: "threadReply",
|
|
307
|
+
accountId: accountId ?? undefined,
|
|
308
|
+
channelId,
|
|
309
|
+
content,
|
|
310
|
+
mediaUrl: mediaUrl ?? undefined,
|
|
311
|
+
replyTo: replyTo ?? undefined,
|
|
312
|
+
}, cfg);
|
|
313
|
+
}
|
|
314
|
+
if (action === "search") {
|
|
315
|
+
const guildId = readStringParam(actionParams, "guildId", {
|
|
316
|
+
required: true,
|
|
317
|
+
});
|
|
318
|
+
const query = readStringParam(actionParams, "query", { required: true });
|
|
319
|
+
return await handleDiscordAction({
|
|
320
|
+
action: "searchMessages",
|
|
321
|
+
accountId: accountId ?? undefined,
|
|
322
|
+
guildId,
|
|
323
|
+
content: query,
|
|
324
|
+
channelId: readStringParam(actionParams, "channelId"),
|
|
325
|
+
channelIds: readStringArrayParam(actionParams, "channelIds"),
|
|
326
|
+
authorId: readStringParam(actionParams, "authorId"),
|
|
327
|
+
authorIds: readStringArrayParam(actionParams, "authorIds"),
|
|
328
|
+
limit: readNumberParam(actionParams, "limit", { integer: true }),
|
|
329
|
+
}, cfg);
|
|
330
|
+
}
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { readNumberParam, readStringArrayParam, readStringParam, } from "../../../../agents/tools/common.js";
|
|
2
|
+
import { handleDiscordAction } from "../../../../agents/tools/discord-actions.js";
|
|
3
|
+
import { tryHandleDiscordMessageActionGuildAdmin } from "./handle-action.guild-admin.js";
|
|
4
|
+
import { resolveDiscordChannelId } from "../../../../discord/targets.js";
|
|
5
|
+
const providerId = "discord";
|
|
6
|
+
function readParentIdParam(params) {
|
|
7
|
+
if (params.clearParent === true)
|
|
8
|
+
return null;
|
|
9
|
+
if (params.parentId === null)
|
|
10
|
+
return null;
|
|
11
|
+
return readStringParam(params, "parentId");
|
|
12
|
+
}
|
|
13
|
+
export async function handleDiscordMessageAction(ctx) {
|
|
14
|
+
const { action, params, cfg } = ctx;
|
|
15
|
+
const accountId = ctx.accountId ?? readStringParam(params, "accountId");
|
|
16
|
+
const resolveChannelId = () => resolveDiscordChannelId(readStringParam(params, "channelId") ?? readStringParam(params, "to", { required: true }));
|
|
17
|
+
if (action === "send") {
|
|
18
|
+
const to = readStringParam(params, "to", { required: true });
|
|
19
|
+
const content = readStringParam(params, "message", {
|
|
20
|
+
required: true,
|
|
21
|
+
allowEmpty: true,
|
|
22
|
+
});
|
|
23
|
+
const mediaUrl = readStringParam(params, "media", { trim: false });
|
|
24
|
+
const replyTo = readStringParam(params, "replyTo");
|
|
25
|
+
const embeds = Array.isArray(params.embeds) ? params.embeds : undefined;
|
|
26
|
+
return await handleDiscordAction({
|
|
27
|
+
action: "sendMessage",
|
|
28
|
+
accountId: accountId ?? undefined,
|
|
29
|
+
to,
|
|
30
|
+
content,
|
|
31
|
+
mediaUrl: mediaUrl ?? undefined,
|
|
32
|
+
replyTo: replyTo ?? undefined,
|
|
33
|
+
embeds,
|
|
34
|
+
}, cfg);
|
|
35
|
+
}
|
|
36
|
+
if (action === "poll") {
|
|
37
|
+
const to = readStringParam(params, "to", { required: true });
|
|
38
|
+
const question = readStringParam(params, "pollQuestion", {
|
|
39
|
+
required: true,
|
|
40
|
+
});
|
|
41
|
+
const answers = readStringArrayParam(params, "pollOption", { required: true }) ?? [];
|
|
42
|
+
const allowMultiselect = typeof params.pollMulti === "boolean" ? params.pollMulti : undefined;
|
|
43
|
+
const durationHours = readNumberParam(params, "pollDurationHours", {
|
|
44
|
+
integer: true,
|
|
45
|
+
});
|
|
46
|
+
return await handleDiscordAction({
|
|
47
|
+
action: "poll",
|
|
48
|
+
accountId: accountId ?? undefined,
|
|
49
|
+
to,
|
|
50
|
+
question,
|
|
51
|
+
answers,
|
|
52
|
+
allowMultiselect,
|
|
53
|
+
durationHours: durationHours ?? undefined,
|
|
54
|
+
content: readStringParam(params, "message"),
|
|
55
|
+
}, cfg);
|
|
56
|
+
}
|
|
57
|
+
if (action === "react") {
|
|
58
|
+
const messageId = readStringParam(params, "messageId", { required: true });
|
|
59
|
+
const emoji = readStringParam(params, "emoji", { allowEmpty: true });
|
|
60
|
+
const remove = typeof params.remove === "boolean" ? params.remove : undefined;
|
|
61
|
+
return await handleDiscordAction({
|
|
62
|
+
action: "react",
|
|
63
|
+
accountId: accountId ?? undefined,
|
|
64
|
+
channelId: resolveChannelId(),
|
|
65
|
+
messageId,
|
|
66
|
+
emoji,
|
|
67
|
+
remove,
|
|
68
|
+
}, cfg);
|
|
69
|
+
}
|
|
70
|
+
if (action === "reactions") {
|
|
71
|
+
const messageId = readStringParam(params, "messageId", { required: true });
|
|
72
|
+
const limit = readNumberParam(params, "limit", { integer: true });
|
|
73
|
+
return await handleDiscordAction({
|
|
74
|
+
action: "reactions",
|
|
75
|
+
accountId: accountId ?? undefined,
|
|
76
|
+
channelId: resolveChannelId(),
|
|
77
|
+
messageId,
|
|
78
|
+
limit,
|
|
79
|
+
}, cfg);
|
|
80
|
+
}
|
|
81
|
+
if (action === "read") {
|
|
82
|
+
const limit = readNumberParam(params, "limit", { integer: true });
|
|
83
|
+
return await handleDiscordAction({
|
|
84
|
+
action: "readMessages",
|
|
85
|
+
accountId: accountId ?? undefined,
|
|
86
|
+
channelId: resolveChannelId(),
|
|
87
|
+
limit,
|
|
88
|
+
before: readStringParam(params, "before"),
|
|
89
|
+
after: readStringParam(params, "after"),
|
|
90
|
+
around: readStringParam(params, "around"),
|
|
91
|
+
}, cfg);
|
|
92
|
+
}
|
|
93
|
+
if (action === "edit") {
|
|
94
|
+
const messageId = readStringParam(params, "messageId", { required: true });
|
|
95
|
+
const content = readStringParam(params, "message", { required: true });
|
|
96
|
+
return await handleDiscordAction({
|
|
97
|
+
action: "editMessage",
|
|
98
|
+
accountId: accountId ?? undefined,
|
|
99
|
+
channelId: resolveChannelId(),
|
|
100
|
+
messageId,
|
|
101
|
+
content,
|
|
102
|
+
}, cfg);
|
|
103
|
+
}
|
|
104
|
+
if (action === "delete") {
|
|
105
|
+
const messageId = readStringParam(params, "messageId", { required: true });
|
|
106
|
+
return await handleDiscordAction({
|
|
107
|
+
action: "deleteMessage",
|
|
108
|
+
accountId: accountId ?? undefined,
|
|
109
|
+
channelId: resolveChannelId(),
|
|
110
|
+
messageId,
|
|
111
|
+
}, cfg);
|
|
112
|
+
}
|
|
113
|
+
if (action === "pin" || action === "unpin" || action === "list-pins") {
|
|
114
|
+
const messageId = action === "list-pins" ? undefined : readStringParam(params, "messageId", { required: true });
|
|
115
|
+
return await handleDiscordAction({
|
|
116
|
+
action: action === "pin" ? "pinMessage" : action === "unpin" ? "unpinMessage" : "listPins",
|
|
117
|
+
accountId: accountId ?? undefined,
|
|
118
|
+
channelId: resolveChannelId(),
|
|
119
|
+
messageId,
|
|
120
|
+
}, cfg);
|
|
121
|
+
}
|
|
122
|
+
if (action === "permissions") {
|
|
123
|
+
return await handleDiscordAction({
|
|
124
|
+
action: "permissions",
|
|
125
|
+
accountId: accountId ?? undefined,
|
|
126
|
+
channelId: resolveChannelId(),
|
|
127
|
+
}, cfg);
|
|
128
|
+
}
|
|
129
|
+
if (action === "thread-create") {
|
|
130
|
+
const name = readStringParam(params, "threadName", { required: true });
|
|
131
|
+
const messageId = readStringParam(params, "messageId");
|
|
132
|
+
const autoArchiveMinutes = readNumberParam(params, "autoArchiveMin", {
|
|
133
|
+
integer: true,
|
|
134
|
+
});
|
|
135
|
+
return await handleDiscordAction({
|
|
136
|
+
action: "threadCreate",
|
|
137
|
+
accountId: accountId ?? undefined,
|
|
138
|
+
channelId: resolveChannelId(),
|
|
139
|
+
name,
|
|
140
|
+
messageId,
|
|
141
|
+
autoArchiveMinutes,
|
|
142
|
+
}, cfg);
|
|
143
|
+
}
|
|
144
|
+
if (action === "sticker") {
|
|
145
|
+
const stickerIds = readStringArrayParam(params, "stickerId", {
|
|
146
|
+
required: true,
|
|
147
|
+
label: "sticker-id",
|
|
148
|
+
}) ?? [];
|
|
149
|
+
return await handleDiscordAction({
|
|
150
|
+
action: "sticker",
|
|
151
|
+
accountId: accountId ?? undefined,
|
|
152
|
+
to: readStringParam(params, "to", { required: true }),
|
|
153
|
+
stickerIds,
|
|
154
|
+
content: readStringParam(params, "message"),
|
|
155
|
+
}, cfg);
|
|
156
|
+
}
|
|
157
|
+
const adminResult = await tryHandleDiscordMessageActionGuildAdmin({
|
|
158
|
+
ctx,
|
|
159
|
+
resolveChannelId,
|
|
160
|
+
readParentIdParam,
|
|
161
|
+
});
|
|
162
|
+
if (adminResult !== undefined)
|
|
163
|
+
return adminResult;
|
|
164
|
+
throw new Error(`Action ${String(action)} is not supported for provider ${providerId}.`);
|
|
165
|
+
}
|