@poolzin/pool-bot 2026.3.25 → 2026.3.27
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 +32 -257
- 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,13 @@
|
|
|
1
|
+
export * from "../plugin-sdk/channel-plugin-common.js";
|
|
2
|
+
export { listEnabledSignalAccounts, listSignalAccountIds, resolveDefaultSignalAccountId, resolveSignalAccount, } from "../../extensions/signal/src/accounts.js";
|
|
3
|
+
export { resolveSignalReactionLevel } from "../../extensions/signal/src/reaction-level.js";
|
|
4
|
+
export { removeReactionSignal, sendReactionSignal, } from "../../extensions/signal/src/send-reactions.js";
|
|
5
|
+
export { sendMessageSignal } from "../../extensions/signal/src/send.js";
|
|
6
|
+
export { looksLikeSignalTargetId, normalizeSignalMessagingTarget, } from "../channels/plugins/normalize/signal.js";
|
|
7
|
+
export { resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, } from "../config/runtime-group-policy.js";
|
|
8
|
+
export { signalSetupWizard } from "../../extensions/signal/src/setup-surface.js";
|
|
9
|
+
export { signalSetupAdapter } from "../../extensions/signal/src/setup-core.js";
|
|
10
|
+
export { SignalConfigSchema } from "../config/zod-schema.providers-core.js";
|
|
11
|
+
export { normalizeE164 } from "../utils.js";
|
|
12
|
+
export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js";
|
|
13
|
+
export { buildBaseAccountStatusSnapshot, buildBaseChannelStatusSummary, collectStatusIssuesFromLastError, createDefaultChannelRuntimeState, } from "../plugin-sdk/status-helpers.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "../plugin-sdk/channel-plugin-common.js";
|
|
2
|
+
export { listEnabledSlackAccounts, listSlackAccountIds, resolveDefaultSlackAccountId, resolveSlackAccount, resolveSlackReplyToMode, } from "../../extensions/slack/src/accounts.js";
|
|
3
|
+
export { isSlackInteractiveRepliesEnabled } from "../../extensions/slack/src/interactive-replies.js";
|
|
4
|
+
export { inspectSlackAccount } from "../../extensions/slack/src/account-inspect.js";
|
|
5
|
+
export { projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, resolveConfiguredFromRequiredCredentialStatuses, } from "../channels/account-snapshot-fields.js";
|
|
6
|
+
export { listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, } from "../channels/plugins/directory-config.js";
|
|
7
|
+
export { looksLikeSlackTargetId, normalizeSlackMessagingTarget, } from "../channels/plugins/normalize/slack.js";
|
|
8
|
+
export { parseSlackTarget, resolveSlackChannelId } from "../plugin-sdk/slack-targets.js";
|
|
9
|
+
export { extractSlackToolSend, listSlackMessageActions, } from "../../extensions/slack/src/message-actions.js";
|
|
10
|
+
export { buildSlackThreadingToolContext } from "../../extensions/slack/src/threading-tool-context.js";
|
|
11
|
+
export { parseSlackBlocksInput } from "../../extensions/slack/src/blocks-input.js";
|
|
12
|
+
export { handleSlackHttpRequest } from "../../extensions/slack/src/http/index.js";
|
|
13
|
+
export { sendMessageSlack } from "../../extensions/slack/src/send.js";
|
|
14
|
+
export { deleteSlackMessage, downloadSlackFile, editSlackMessage, getSlackMemberInfo, listSlackEmojis, listSlackPins, listSlackReactions, pinSlackMessage, reactSlackMessage, readSlackMessages, removeOwnSlackReactions, removeSlackReaction, sendSlackMessage, unpinSlackMessage, } from "../../extensions/slack/src/actions.js";
|
|
15
|
+
export { recordSlackThreadParticipation } from "../../extensions/slack/src/sent-thread-cache.js";
|
|
16
|
+
export { buildComputedAccountStatusSnapshot } from "../plugin-sdk/status-helpers.js";
|
|
17
|
+
export { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, } from "../config/runtime-group-policy.js";
|
|
18
|
+
export { resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy, } from "../channels/plugins/group-mentions.js";
|
|
19
|
+
export { slackSetupAdapter } from "../../extensions/slack/src/setup-core.js";
|
|
20
|
+
export { slackSetupWizard } from "../../extensions/slack/src/setup-surface.js";
|
|
21
|
+
export { SlackConfigSchema } from "../config/zod-schema.providers-core.js";
|
|
22
|
+
export { handleSlackMessageAction } from "../plugin-sdk/slack-message-actions.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
|
2
|
+
export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
|
|
3
|
+
export { applyAccountNameToChannelSection, migrateBaseNameToDefaultAccount, } from "../channels/plugins/setup-helpers.js";
|
|
4
|
+
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
|
5
|
+
export { deleteAccountFromConfigSection, clearAccountEntryFields, setAccountEnabledInConfigSection, } from "../channels/plugins/config-helpers.js";
|
|
6
|
+
export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
|
|
7
|
+
export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js";
|
|
8
|
+
export { getChatChannelMeta } from "../channels/registry.js";
|
|
9
|
+
export { createTelegramActionGate, listTelegramAccountIds, resolveDefaultTelegramAccountId, resolveTelegramPollActionGateState, resolveTelegramAccount, } from "../../extensions/telegram/src/accounts.js";
|
|
10
|
+
export { inspectTelegramAccount } from "../../extensions/telegram/src/account-inspect.js";
|
|
11
|
+
export { projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, } from "../channels/account-snapshot-fields.js";
|
|
12
|
+
export { listTelegramDirectoryGroupsFromConfig, listTelegramDirectoryPeersFromConfig, } from "../channels/plugins/directory-config.js";
|
|
13
|
+
export { looksLikeTelegramTargetId, normalizeTelegramMessagingTarget, } from "../../extensions/telegram/src/normalize.js";
|
|
14
|
+
export { parseTelegramReplyToMessageId, parseTelegramThreadId, } from "../../extensions/telegram/src/outbound-params.js";
|
|
15
|
+
export { isNumericTelegramUserId, normalizeTelegramAllowFromEntry, } from "../../extensions/telegram/src/allow-from.js";
|
|
16
|
+
export { fetchTelegramChatId } from "../../extensions/telegram/src/api-fetch.js";
|
|
17
|
+
export { resolveTelegramInlineButtonsScope, resolveTelegramTargetChatType, } from "../../extensions/telegram/src/inline-buttons.js";
|
|
18
|
+
export { resolveTelegramReactionLevel } from "../../extensions/telegram/src/reaction-level.js";
|
|
19
|
+
export { createForumTopicTelegram, deleteMessageTelegram, editForumTopicTelegram, editMessageTelegram, reactMessageTelegram, sendMessageTelegram, sendPollTelegram, sendStickerTelegram, } from "../../extensions/telegram/src/send.js";
|
|
20
|
+
export { getCacheStats, searchStickers } from "../../extensions/telegram/src/sticker-cache.js";
|
|
21
|
+
export { resolveTelegramToken } from "../../extensions/telegram/src/token.js";
|
|
22
|
+
export { telegramMessageActions } from "../../extensions/telegram/src/channel-actions.js";
|
|
23
|
+
export { collectTelegramStatusIssues } from "../../extensions/telegram/src/status-issues.js";
|
|
24
|
+
export { sendTelegramPayloadMessages } from "../../extensions/telegram/src/outbound-adapter.js";
|
|
25
|
+
export { buildBrowseProvidersButton, buildModelsKeyboard, buildProviderKeyboard, calculateTotalPages, getModelsPageSize, } from "../../extensions/telegram/src/model-buttons.js";
|
|
26
|
+
export { isTelegramExecApprovalApprover, isTelegramExecApprovalClientEnabled, } from "../../extensions/telegram/src/exec-approvals.js";
|
|
27
|
+
export { resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, } from "../config/runtime-group-policy.js";
|
|
28
|
+
export { resolveTelegramGroupRequireMention, resolveTelegramGroupToolPolicy, } from "../channels/plugins/group-mentions.js";
|
|
29
|
+
export { telegramSetupWizard } from "../../extensions/telegram/src/setup-surface.js";
|
|
30
|
+
export { telegramSetupAdapter } from "../../extensions/telegram/src/setup-core.js";
|
|
31
|
+
export { TelegramConfigSchema } from "../config/zod-schema.providers-core.js";
|
|
32
|
+
export { buildTokenChannelStatusSummary } from "../plugin-sdk/status-helpers.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
|
2
|
+
export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
|
|
3
|
+
export { applyAccountNameToChannelSection, migrateBaseNameToDefaultAccount, } from "../channels/plugins/setup-helpers.js";
|
|
4
|
+
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
|
5
|
+
export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
|
|
6
|
+
export { getChatChannelMeta } from "../channels/registry.js";
|
|
7
|
+
export { formatWhatsAppConfigAllowFromEntries, resolveWhatsAppConfigAllowFrom, resolveWhatsAppConfigDefaultTo, } from "../plugin-sdk/channel-config-helpers.js";
|
|
8
|
+
export { listWhatsAppDirectoryGroupsFromConfig, listWhatsAppDirectoryPeersFromConfig, } from "../channels/plugins/directory-config.js";
|
|
9
|
+
export { hasAnyWhatsAppAuth, listEnabledWhatsAppAccounts, resolveWhatsAppAccount, } from "../whatsapp/accounts.js";
|
|
10
|
+
export { WA_WEB_AUTH_DIR, logWebSelfId, logoutWeb, pickWebChannel, webAuthExists, } from "../whatsapp/auth-store.js";
|
|
11
|
+
export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, monitorWebChannel, resolveHeartbeatRecipients, runWebHeartbeatOnce, } from "../whatsapp/auto-reply.js";
|
|
12
|
+
export { extractMediaPlaceholder, extractText, monitorWebInbox } from "../whatsapp/inbound.js";
|
|
13
|
+
export { loginWeb } from "../whatsapp/login.js";
|
|
14
|
+
export { getDefaultLocalRoots, loadWebMedia, loadWebMediaRaw, optimizeImageToJpeg, } from "../whatsapp/media.js";
|
|
15
|
+
export { sendMessageWhatsApp, sendPollWhatsApp, sendReactionWhatsApp } from "../whatsapp/send.js";
|
|
16
|
+
export { createWaSocket, formatError, getStatusCode, waitForWaConnection, } from "../whatsapp/session.js";
|
|
17
|
+
export { createWhatsAppLoginTool } from "../whatsapp/agent-tools-login.js";
|
|
18
|
+
export { normalizeWhatsAppAllowFromEntries } from "../channels/plugins/normalize/whatsapp.js";
|
|
19
|
+
export { collectAllowlistProviderGroupPolicyWarnings, collectOpenGroupPolicyRouteAllowlistWarnings, } from "../channels/plugins/group-policy-warnings.js";
|
|
20
|
+
export { buildAccountScopedDmSecurityPolicy } from "../channels/plugins/helpers.js";
|
|
21
|
+
export { resolveWhatsAppOutboundTarget } from "../whatsapp/resolve-outbound-target.js";
|
|
22
|
+
export { resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, } from "../config/runtime-group-policy.js";
|
|
23
|
+
export { resolveWhatsAppGroupRequireMention, resolveWhatsAppGroupToolPolicy, } from "../channels/plugins/group-mentions.js";
|
|
24
|
+
export { createWhatsAppOutboundBase, resolveWhatsAppGroupIntroHint, resolveWhatsAppMentionStripRegexes, } from "../channels/plugins/whatsapp-shared.js";
|
|
25
|
+
export { resolveWhatsAppHeartbeatRecipients } from "../channels/plugins/whatsapp-heartbeat.js";
|
|
26
|
+
export { WhatsAppConfigSchema } from "../config/zod-schema.providers-whatsapp.js";
|
|
27
|
+
export { createActionGate, readStringParam } from "../agents/tools/common.js";
|
|
28
|
+
export { createPluginRuntimeStore } from "../plugin-sdk/runtime-store.js";
|
|
29
|
+
export { normalizeE164 } from "../utils.js";
|
|
@@ -1,186 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
export const DEFAULT_AGENT_ID = "main";
|
|
6
|
-
export const DEFAULT_MAIN_KEY = "main";
|
|
7
|
-
// Pre-compiled regex
|
|
8
|
-
const VALID_ID_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
|
|
9
|
-
const INVALID_CHARS_RE = /[^a-z0-9_-]+/g;
|
|
10
|
-
const LEADING_DASH_RE = /^-+/;
|
|
11
|
-
const TRAILING_DASH_RE = /-+$/;
|
|
12
|
-
function normalizeToken(value) {
|
|
13
|
-
return (value ?? "").trim().toLowerCase();
|
|
14
|
-
}
|
|
15
|
-
export function normalizeMainKey(value) {
|
|
16
|
-
const trimmed = (value ?? "").trim();
|
|
17
|
-
return trimmed ? trimmed.toLowerCase() : DEFAULT_MAIN_KEY;
|
|
18
|
-
}
|
|
19
|
-
export function toAgentRequestSessionKey(storeKey) {
|
|
20
|
-
const raw = (storeKey ?? "").trim();
|
|
21
|
-
if (!raw) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return parseAgentSessionKey(raw)?.rest ?? raw;
|
|
25
|
-
}
|
|
26
|
-
export function toAgentStoreSessionKey(params) {
|
|
27
|
-
const raw = (params.requestKey ?? "").trim();
|
|
28
|
-
if (!raw || raw === DEFAULT_MAIN_KEY) {
|
|
29
|
-
return buildAgentMainSessionKey({ agentId: params.agentId, mainKey: params.mainKey });
|
|
30
|
-
}
|
|
31
|
-
const lowered = raw.toLowerCase();
|
|
32
|
-
if (lowered.startsWith("agent:")) {
|
|
33
|
-
return lowered;
|
|
34
|
-
}
|
|
35
|
-
if (lowered.startsWith("subagent:")) {
|
|
36
|
-
return `agent:${normalizeAgentId(params.agentId)}:${lowered}`;
|
|
37
|
-
}
|
|
38
|
-
return `agent:${normalizeAgentId(params.agentId)}:${lowered}`;
|
|
39
|
-
}
|
|
40
|
-
export function resolveAgentIdFromSessionKey(sessionKey) {
|
|
41
|
-
const parsed = parseAgentSessionKey(sessionKey);
|
|
42
|
-
return normalizeAgentId(parsed?.agentId ?? DEFAULT_AGENT_ID);
|
|
43
|
-
}
|
|
44
|
-
export function classifySessionKeyShape(sessionKey) {
|
|
45
|
-
const raw = (sessionKey ?? "").trim();
|
|
46
|
-
if (!raw) {
|
|
47
|
-
return "missing";
|
|
48
|
-
}
|
|
49
|
-
if (parseAgentSessionKey(raw)) {
|
|
50
|
-
return "agent";
|
|
51
|
-
}
|
|
52
|
-
return raw.toLowerCase().startsWith("agent:") ? "malformed_agent" : "legacy_or_alias";
|
|
53
|
-
}
|
|
54
|
-
export function normalizeAgentId(value) {
|
|
55
|
-
const trimmed = (value ?? "").trim();
|
|
56
|
-
if (!trimmed) {
|
|
57
|
-
return DEFAULT_AGENT_ID;
|
|
58
|
-
}
|
|
59
|
-
// Keep it path-safe + shell-friendly.
|
|
60
|
-
if (VALID_ID_RE.test(trimmed)) {
|
|
61
|
-
return trimmed.toLowerCase();
|
|
62
|
-
}
|
|
63
|
-
// Best-effort fallback: collapse invalid characters to "-"
|
|
64
|
-
return (trimmed
|
|
65
|
-
.toLowerCase()
|
|
66
|
-
.replace(INVALID_CHARS_RE, "-")
|
|
67
|
-
.replace(LEADING_DASH_RE, "")
|
|
68
|
-
.replace(TRAILING_DASH_RE, "")
|
|
69
|
-
.slice(0, 64) || DEFAULT_AGENT_ID);
|
|
70
|
-
}
|
|
71
|
-
export function sanitizeAgentId(value) {
|
|
72
|
-
const trimmed = (value ?? "").trim();
|
|
73
|
-
if (!trimmed) {
|
|
74
|
-
return DEFAULT_AGENT_ID;
|
|
75
|
-
}
|
|
76
|
-
if (VALID_ID_RE.test(trimmed)) {
|
|
77
|
-
return trimmed.toLowerCase();
|
|
78
|
-
}
|
|
79
|
-
return (trimmed
|
|
80
|
-
.toLowerCase()
|
|
81
|
-
.replace(INVALID_CHARS_RE, "-")
|
|
82
|
-
.replace(LEADING_DASH_RE, "")
|
|
83
|
-
.replace(TRAILING_DASH_RE, "")
|
|
84
|
-
.slice(0, 64) || DEFAULT_AGENT_ID);
|
|
85
|
-
}
|
|
86
|
-
export function buildAgentMainSessionKey(params) {
|
|
87
|
-
const agentId = normalizeAgentId(params.agentId);
|
|
88
|
-
const mainKey = normalizeMainKey(params.mainKey);
|
|
89
|
-
return `agent:${agentId}:${mainKey}`;
|
|
90
|
-
}
|
|
91
|
-
export function buildAgentPeerSessionKey(params) {
|
|
92
|
-
const peerKind = params.peerKind ?? "direct";
|
|
93
|
-
if (peerKind === "direct") {
|
|
94
|
-
const dmScope = params.dmScope ?? "main";
|
|
95
|
-
let peerId = (params.peerId ?? "").trim();
|
|
96
|
-
const linkedPeerId = dmScope === "main"
|
|
97
|
-
? null
|
|
98
|
-
: resolveLinkedPeerId({
|
|
99
|
-
identityLinks: params.identityLinks,
|
|
100
|
-
channel: params.channel,
|
|
101
|
-
peerId,
|
|
102
|
-
});
|
|
103
|
-
if (linkedPeerId) {
|
|
104
|
-
peerId = linkedPeerId;
|
|
105
|
-
}
|
|
106
|
-
peerId = peerId.toLowerCase();
|
|
107
|
-
if (dmScope === "per-account-channel-peer" && peerId) {
|
|
108
|
-
const channel = (params.channel ?? "").trim().toLowerCase() || "unknown";
|
|
109
|
-
const accountId = normalizeAccountId(params.accountId);
|
|
110
|
-
return `agent:${normalizeAgentId(params.agentId)}:${channel}:${accountId}:direct:${peerId}`;
|
|
111
|
-
}
|
|
112
|
-
if (dmScope === "per-channel-peer" && peerId) {
|
|
113
|
-
const channel = (params.channel ?? "").trim().toLowerCase() || "unknown";
|
|
114
|
-
return `agent:${normalizeAgentId(params.agentId)}:${channel}:direct:${peerId}`;
|
|
115
|
-
}
|
|
116
|
-
if (dmScope === "per-peer" && peerId) {
|
|
117
|
-
return `agent:${normalizeAgentId(params.agentId)}:direct:${peerId}`;
|
|
118
|
-
}
|
|
119
|
-
return buildAgentMainSessionKey({
|
|
120
|
-
agentId: params.agentId,
|
|
121
|
-
mainKey: params.mainKey,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const channel = (params.channel ?? "").trim().toLowerCase() || "unknown";
|
|
125
|
-
const peerId = ((params.peerId ?? "").trim() || "unknown").toLowerCase();
|
|
126
|
-
return `agent:${normalizeAgentId(params.agentId)}:${channel}:${peerKind}:${peerId}`;
|
|
127
|
-
}
|
|
128
|
-
function resolveLinkedPeerId(params) {
|
|
129
|
-
const identityLinks = params.identityLinks;
|
|
130
|
-
if (!identityLinks) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
const peerId = params.peerId.trim();
|
|
134
|
-
if (!peerId) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
const candidates = new Set();
|
|
138
|
-
const rawCandidate = normalizeToken(peerId);
|
|
139
|
-
if (rawCandidate) {
|
|
140
|
-
candidates.add(rawCandidate);
|
|
141
|
-
}
|
|
142
|
-
const channel = normalizeToken(params.channel);
|
|
143
|
-
if (channel) {
|
|
144
|
-
const scopedCandidate = normalizeToken(`${channel}:${peerId}`);
|
|
145
|
-
if (scopedCandidate) {
|
|
146
|
-
candidates.add(scopedCandidate);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (candidates.size === 0) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
for (const [canonical, ids] of Object.entries(identityLinks)) {
|
|
153
|
-
const canonicalName = canonical.trim();
|
|
154
|
-
if (!canonicalName) {
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (!Array.isArray(ids)) {
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
for (const id of ids) {
|
|
161
|
-
const normalized = normalizeToken(id);
|
|
162
|
-
if (normalized && candidates.has(normalized)) {
|
|
163
|
-
return canonicalName;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
export function buildGroupHistoryKey(params) {
|
|
170
|
-
const channel = normalizeToken(params.channel) || "unknown";
|
|
171
|
-
const accountId = normalizeAccountId(params.accountId);
|
|
172
|
-
const peerId = params.peerId.trim().toLowerCase() || "unknown";
|
|
173
|
-
return `${channel}:${accountId}:${params.peerKind}:${peerId}`;
|
|
174
|
-
}
|
|
175
|
-
export function resolveThreadSessionKeys(params) {
|
|
176
|
-
const threadId = (params.threadId ?? "").trim();
|
|
177
|
-
if (!threadId) {
|
|
178
|
-
return { sessionKey: params.baseSessionKey, parentSessionKey: undefined };
|
|
179
|
-
}
|
|
180
|
-
const normalizedThreadId = threadId.toLowerCase();
|
|
181
|
-
const useSuffix = params.useSuffix ?? true;
|
|
182
|
-
const sessionKey = useSuffix
|
|
183
|
-
? `${params.baseSessionKey}:thread:${normalizedThreadId}`
|
|
184
|
-
: params.baseSessionKey;
|
|
185
|
-
return { sessionKey, parentSessionKey: params.parentSessionKey };
|
|
1
|
+
// Stub for routing/session-key.js
|
|
2
|
+
export const DEFAULT_ACCOUNT_ID = "default";
|
|
3
|
+
export function normalizeAccountId(accountId) {
|
|
4
|
+
return accountId?.trim() || DEFAULT_ACCOUNT_ID;
|
|
186
5
|
}
|
package/dist/shared/pid-alive.js
CHANGED
|
@@ -1,69 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
function isValidPid(pid) {
|
|
3
|
-
return Number.isInteger(pid) && pid > 0;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Check if a process is a zombie on Linux by reading /proc/<pid>/status.
|
|
7
|
-
* Returns false on non-Linux platforms or if the proc file can't be read.
|
|
8
|
-
*/
|
|
9
|
-
function isZombieProcess(pid) {
|
|
10
|
-
if (process.platform !== "linux") {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const status = fsSync.readFileSync(`/proc/${pid}/status`, "utf8");
|
|
15
|
-
const stateMatch = status.match(/^State:\s+(\S)/m);
|
|
16
|
-
return stateMatch?.[1] === "Z";
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
// Stub for shared/pid-alive.js
|
|
22
2
|
export function isPidAlive(pid) {
|
|
23
|
-
if (!isValidPid(pid)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
3
|
try {
|
|
27
4
|
process.kill(pid, 0);
|
|
5
|
+
return true;
|
|
28
6
|
}
|
|
29
7
|
catch {
|
|
30
8
|
return false;
|
|
31
9
|
}
|
|
32
|
-
if (isZombieProcess(pid)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Read the process start time (field 22 "starttime") from /proc/<pid>/stat.
|
|
39
|
-
* Returns the value in clock ticks since system boot, or null on non-Linux
|
|
40
|
-
* platforms or if the proc file can't be read.
|
|
41
|
-
*
|
|
42
|
-
* This is used to detect PID recycling: if two readings for the same PID
|
|
43
|
-
* return different starttimes, the PID has been reused by a different process.
|
|
44
|
-
*/
|
|
45
|
-
export function getProcessStartTime(pid) {
|
|
46
|
-
if (process.platform !== "linux") {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
if (!isValidPid(pid)) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
const stat = fsSync.readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
54
|
-
const commEndIndex = stat.lastIndexOf(")");
|
|
55
|
-
if (commEndIndex < 0) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
// The comm field (field 2) is wrapped in parens and can contain spaces,
|
|
59
|
-
// so split after the last ")" to get fields 3..N reliably.
|
|
60
|
-
const afterComm = stat.slice(commEndIndex + 1).trimStart();
|
|
61
|
-
const fields = afterComm.split(/\s+/);
|
|
62
|
-
// field 22 (starttime) = index 19 after the comm-split (field 3 is index 0).
|
|
63
|
-
const starttime = Number(fields[19]);
|
|
64
|
-
return Number.isInteger(starttime) && starttime >= 0 ? starttime : null;
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
10
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
// Stub for shared/process-scoped-map.js
|
|
2
|
+
const processScopedMaps = new Map();
|
|
1
3
|
export function resolveProcessScopedMap(key) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (existing) {
|
|
5
|
-
return existing;
|
|
4
|
+
if (!processScopedMaps.has(key)) {
|
|
5
|
+
processScopedMaps.set(key, new Map());
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
proc[key] = created;
|
|
9
|
-
return created;
|
|
7
|
+
return processScopedMaps.get(key);
|
|
10
8
|
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { buildAccountScopedDmSecurityPolicy, createScopedAccountConfigAccessors, collectAllowlistProviderRestrictSendersWarnings, } from "openclaw/plugin-sdk/compat";
|
|
2
|
+
import { applyAccountNameToChannelSection, buildBaseAccountStatusSnapshot, buildBaseChannelStatusSummary, buildChannelConfigSchema, collectStatusIssuesFromLastError, createDefaultChannelRuntimeState, DEFAULT_ACCOUNT_ID, deleteAccountFromConfigSection, getChatChannelMeta, listSignalAccountIds, looksLikeSignalTargetId, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeE164, normalizeSignalMessagingTarget, PAIRING_APPROVED_MESSAGE, resolveChannelMediaMaxBytes, resolveDefaultSignalAccountId, resolveSignalAccount, setAccountEnabledInConfigSection, signalOnboardingAdapter, SignalConfigSchema, } from "openclaw/plugin-sdk/signal";
|
|
3
|
+
import { resolveOutboundSendDep } from "../../../src/infra/outbound/send-deps.js";
|
|
4
|
+
import { getSignalRuntime } from "./runtime.js";
|
|
5
|
+
const signalMessageActions = {
|
|
6
|
+
listActions: (ctx) => getSignalRuntime().channel.signal.messageActions?.listActions?.(ctx) ?? [],
|
|
7
|
+
supportsAction: (ctx) => getSignalRuntime().channel.signal.messageActions?.supportsAction?.(ctx) ?? false,
|
|
8
|
+
handleAction: async (ctx) => {
|
|
9
|
+
const ma = getSignalRuntime().channel.signal.messageActions;
|
|
10
|
+
if (!ma?.handleAction) {
|
|
11
|
+
throw new Error("Signal message actions not available");
|
|
12
|
+
}
|
|
13
|
+
return ma.handleAction(ctx);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const meta = getChatChannelMeta("signal");
|
|
17
|
+
const signalConfigAccessors = createScopedAccountConfigAccessors({
|
|
18
|
+
resolveAccount: ({ cfg, accountId }) => resolveSignalAccount({ cfg, accountId }),
|
|
19
|
+
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
20
|
+
formatAllowFrom: (allowFrom) => allowFrom
|
|
21
|
+
.map((entry) => String(entry).trim())
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.map((entry) => (entry === "*" ? "*" : normalizeE164(entry.replace(/^signal:/i, ""))))
|
|
24
|
+
.filter(Boolean),
|
|
25
|
+
resolveDefaultTo: (account) => account.config.defaultTo,
|
|
26
|
+
});
|
|
27
|
+
function buildSignalSetupPatch(input) {
|
|
28
|
+
return {
|
|
29
|
+
...(input.signalNumber ? { account: input.signalNumber } : {}),
|
|
30
|
+
...(input.cliPath ? { cliPath: input.cliPath } : {}),
|
|
31
|
+
...(input.httpUrl ? { httpUrl: input.httpUrl } : {}),
|
|
32
|
+
...(input.httpHost ? { httpHost: input.httpHost } : {}),
|
|
33
|
+
...(input.httpPort ? { httpPort: Number(input.httpPort) } : {}),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function sendSignalOutbound(params) {
|
|
37
|
+
const send = resolveOutboundSendDep(params.deps, "signal") ??
|
|
38
|
+
getSignalRuntime().channel.signal.sendMessageSignal;
|
|
39
|
+
const maxBytes = resolveChannelMediaMaxBytes({
|
|
40
|
+
cfg: params.cfg,
|
|
41
|
+
resolveChannelLimitMb: ({ cfg, accountId }) => cfg.channels?.signal?.accounts?.[accountId]?.mediaMaxMb ?? cfg.channels?.signal?.mediaMaxMb,
|
|
42
|
+
accountId: params.accountId,
|
|
43
|
+
});
|
|
44
|
+
return await send(params.to, params.text, {
|
|
45
|
+
cfg: params.cfg,
|
|
46
|
+
...(params.mediaUrl ? { mediaUrl: params.mediaUrl } : {}),
|
|
47
|
+
...(params.mediaLocalRoots?.length ? { mediaLocalRoots: params.mediaLocalRoots } : {}),
|
|
48
|
+
maxBytes,
|
|
49
|
+
accountId: params.accountId ?? undefined,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export const signalPlugin = {
|
|
53
|
+
id: "signal",
|
|
54
|
+
meta: {
|
|
55
|
+
...meta,
|
|
56
|
+
},
|
|
57
|
+
onboarding: signalOnboardingAdapter,
|
|
58
|
+
pairing: {
|
|
59
|
+
idLabel: "signalNumber",
|
|
60
|
+
normalizeAllowEntry: (entry) => entry.replace(/^signal:/i, ""),
|
|
61
|
+
notifyApproval: async ({ id }) => {
|
|
62
|
+
await getSignalRuntime().channel.signal.sendMessageSignal(id, PAIRING_APPROVED_MESSAGE);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
capabilities: {
|
|
66
|
+
chatTypes: ["direct", "group"],
|
|
67
|
+
media: true,
|
|
68
|
+
reactions: true,
|
|
69
|
+
},
|
|
70
|
+
actions: signalMessageActions,
|
|
71
|
+
streaming: {
|
|
72
|
+
blockStreamingCoalesceDefaults: { minChars: 1500, idleMs: 1000 },
|
|
73
|
+
},
|
|
74
|
+
reload: { configPrefixes: ["channels.signal"] },
|
|
75
|
+
configSchema: buildChannelConfigSchema(SignalConfigSchema),
|
|
76
|
+
config: {
|
|
77
|
+
listAccountIds: (cfg) => listSignalAccountIds(cfg),
|
|
78
|
+
resolveAccount: (cfg, accountId) => resolveSignalAccount({ cfg, accountId }),
|
|
79
|
+
defaultAccountId: (cfg) => resolveDefaultSignalAccountId(cfg),
|
|
80
|
+
setAccountEnabled: ({ cfg, accountId, enabled }) => setAccountEnabledInConfigSection({
|
|
81
|
+
cfg,
|
|
82
|
+
sectionKey: "signal",
|
|
83
|
+
accountId,
|
|
84
|
+
enabled,
|
|
85
|
+
allowTopLevel: true,
|
|
86
|
+
}),
|
|
87
|
+
deleteAccount: ({ cfg, accountId }) => deleteAccountFromConfigSection({
|
|
88
|
+
cfg,
|
|
89
|
+
sectionKey: "signal",
|
|
90
|
+
accountId,
|
|
91
|
+
clearBaseFields: ["account", "httpUrl", "httpHost", "httpPort", "cliPath", "name"],
|
|
92
|
+
}),
|
|
93
|
+
isConfigured: (account) => account.configured,
|
|
94
|
+
describeAccount: (account) => ({
|
|
95
|
+
accountId: account.accountId,
|
|
96
|
+
name: account.name,
|
|
97
|
+
enabled: account.enabled,
|
|
98
|
+
configured: account.configured,
|
|
99
|
+
baseUrl: account.baseUrl,
|
|
100
|
+
}),
|
|
101
|
+
...signalConfigAccessors,
|
|
102
|
+
},
|
|
103
|
+
security: {
|
|
104
|
+
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
105
|
+
return buildAccountScopedDmSecurityPolicy({
|
|
106
|
+
cfg,
|
|
107
|
+
channelKey: "signal",
|
|
108
|
+
accountId,
|
|
109
|
+
fallbackAccountId: account.accountId ?? DEFAULT_ACCOUNT_ID,
|
|
110
|
+
policy: account.config.dmPolicy,
|
|
111
|
+
allowFrom: account.config.allowFrom ?? [],
|
|
112
|
+
policyPathSuffix: "dmPolicy",
|
|
113
|
+
normalizeEntry: (raw) => normalizeE164(raw.replace(/^signal:/i, "").trim()),
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
collectWarnings: ({ account, cfg }) => {
|
|
117
|
+
return collectAllowlistProviderRestrictSendersWarnings({
|
|
118
|
+
cfg,
|
|
119
|
+
providerConfigPresent: cfg.channels?.signal !== undefined,
|
|
120
|
+
configuredGroupPolicy: account.config.groupPolicy,
|
|
121
|
+
surface: "Signal groups",
|
|
122
|
+
openScope: "any member",
|
|
123
|
+
groupPolicyPath: "channels.signal.groupPolicy",
|
|
124
|
+
groupAllowFromPath: "channels.signal.groupAllowFrom",
|
|
125
|
+
mentionGated: false,
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
messaging: {
|
|
130
|
+
normalizeTarget: normalizeSignalMessagingTarget,
|
|
131
|
+
targetResolver: {
|
|
132
|
+
looksLikeId: looksLikeSignalTargetId,
|
|
133
|
+
hint: "<E.164|uuid:ID|group:ID|signal:group:ID|signal:+E.164>",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
setup: {
|
|
137
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
138
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
139
|
+
cfg,
|
|
140
|
+
channelKey: "signal",
|
|
141
|
+
accountId,
|
|
142
|
+
name,
|
|
143
|
+
}),
|
|
144
|
+
validateInput: ({ input }) => {
|
|
145
|
+
if (!input.signalNumber &&
|
|
146
|
+
!input.httpUrl &&
|
|
147
|
+
!input.httpHost &&
|
|
148
|
+
!input.httpPort &&
|
|
149
|
+
!input.cliPath) {
|
|
150
|
+
return "Signal requires --signal-number or --http-url/--http-host/--http-port/--cli-path.";
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
},
|
|
154
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
155
|
+
const namedConfig = applyAccountNameToChannelSection({
|
|
156
|
+
cfg,
|
|
157
|
+
channelKey: "signal",
|
|
158
|
+
accountId,
|
|
159
|
+
name: input.name,
|
|
160
|
+
});
|
|
161
|
+
const next = accountId !== DEFAULT_ACCOUNT_ID
|
|
162
|
+
? migrateBaseNameToDefaultAccount({
|
|
163
|
+
cfg: namedConfig,
|
|
164
|
+
channelKey: "signal",
|
|
165
|
+
})
|
|
166
|
+
: namedConfig;
|
|
167
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
168
|
+
return {
|
|
169
|
+
...next,
|
|
170
|
+
channels: {
|
|
171
|
+
...next.channels,
|
|
172
|
+
signal: {
|
|
173
|
+
...next.channels?.signal,
|
|
174
|
+
enabled: true,
|
|
175
|
+
...buildSignalSetupPatch(input),
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
...next,
|
|
182
|
+
channels: {
|
|
183
|
+
...next.channels,
|
|
184
|
+
signal: {
|
|
185
|
+
...next.channels?.signal,
|
|
186
|
+
enabled: true,
|
|
187
|
+
accounts: {
|
|
188
|
+
...next.channels?.signal?.accounts,
|
|
189
|
+
[accountId]: {
|
|
190
|
+
...next.channels?.signal?.accounts?.[accountId],
|
|
191
|
+
enabled: true,
|
|
192
|
+
...buildSignalSetupPatch(input),
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
outbound: {
|
|
201
|
+
deliveryMode: "direct",
|
|
202
|
+
chunker: (text, limit) => getSignalRuntime().channel.text.chunkText(text, limit),
|
|
203
|
+
chunkerMode: "text",
|
|
204
|
+
textChunkLimit: 4000,
|
|
205
|
+
sendText: async ({ cfg, to, text, accountId, deps }) => {
|
|
206
|
+
const result = await sendSignalOutbound({
|
|
207
|
+
cfg,
|
|
208
|
+
to,
|
|
209
|
+
text,
|
|
210
|
+
accountId: accountId ?? undefined,
|
|
211
|
+
deps,
|
|
212
|
+
});
|
|
213
|
+
return { channel: "signal", ...result };
|
|
214
|
+
},
|
|
215
|
+
sendMedia: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, accountId, deps }) => {
|
|
216
|
+
const result = await sendSignalOutbound({
|
|
217
|
+
cfg,
|
|
218
|
+
to,
|
|
219
|
+
text,
|
|
220
|
+
mediaUrl,
|
|
221
|
+
mediaLocalRoots,
|
|
222
|
+
accountId: accountId ?? undefined,
|
|
223
|
+
deps,
|
|
224
|
+
});
|
|
225
|
+
return { channel: "signal", ...result };
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
status: {
|
|
229
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID),
|
|
230
|
+
collectStatusIssues: (accounts) => collectStatusIssuesFromLastError("signal", accounts),
|
|
231
|
+
buildChannelSummary: ({ snapshot }) => ({
|
|
232
|
+
...buildBaseChannelStatusSummary(snapshot),
|
|
233
|
+
baseUrl: snapshot.baseUrl ?? null,
|
|
234
|
+
probe: snapshot.probe,
|
|
235
|
+
lastProbeAt: snapshot.lastProbeAt ?? null,
|
|
236
|
+
}),
|
|
237
|
+
probeAccount: async ({ account, timeoutMs }) => {
|
|
238
|
+
const baseUrl = account.baseUrl;
|
|
239
|
+
return await getSignalRuntime().channel.signal.probeSignal(baseUrl, timeoutMs);
|
|
240
|
+
},
|
|
241
|
+
buildAccountSnapshot: ({ account, runtime, probe }) => ({
|
|
242
|
+
...buildBaseAccountStatusSnapshot({ account, runtime, probe }),
|
|
243
|
+
baseUrl: account.baseUrl,
|
|
244
|
+
}),
|
|
245
|
+
},
|
|
246
|
+
gateway: {
|
|
247
|
+
startAccount: async (ctx) => {
|
|
248
|
+
const account = ctx.account;
|
|
249
|
+
ctx.setStatus({
|
|
250
|
+
accountId: account.accountId,
|
|
251
|
+
baseUrl: account.baseUrl,
|
|
252
|
+
});
|
|
253
|
+
ctx.log?.info(`[${account.accountId}] starting provider (${account.baseUrl})`);
|
|
254
|
+
// Lazy import: the monitor pulls the reply pipeline; avoid ESM init cycles.
|
|
255
|
+
return getSignalRuntime().channel.signal.monitorSignalProvider({
|
|
256
|
+
accountId: account.accountId,
|
|
257
|
+
config: ctx.cfg,
|
|
258
|
+
runtime: ctx.runtime,
|
|
259
|
+
abortSignal: ctx.abortSignal,
|
|
260
|
+
mediaMaxMb: account.config.mediaMaxMb,
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
};
|