@poolzin/pool-bot 2026.2.17 → 2026.2.18
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/CHANGELOG.md +17 -0
- package/dist/agents/agent-scope.js +4 -0
- package/dist/agents/announce-idempotency.js +14 -0
- package/dist/agents/auth-profiles.resolve-auth-profile-order.fixtures.js +23 -0
- package/dist/agents/bash-tools.exec-runtime.js +438 -0
- package/dist/agents/bash-tools.shared.js +6 -0
- package/dist/agents/cli-runner/reliability.js +61 -0
- package/dist/agents/cli-watchdog-defaults.js +11 -0
- package/dist/agents/command-poll-backoff.js +63 -0
- package/dist/agents/current-time.js +16 -0
- package/dist/agents/model-alias-lines.js +18 -0
- package/dist/agents/model-auth-label.js +61 -0
- package/dist/agents/models-config.e2e-harness.js +115 -0
- package/dist/agents/ollama-stream.js +11 -3
- package/dist/agents/openclaw-tools.js +135 -0
- package/dist/agents/pi-auth-json.js +118 -0
- package/dist/agents/pi-embedded-runner/run.overflow-compaction.mocks.shared.js +147 -0
- package/dist/agents/pi-embedded-subscribe.e2e-harness.js +90 -0
- package/dist/agents/pi-embedded-subscribe.handlers.compaction.js +63 -0
- package/dist/agents/pi-embedded-subscribe.handlers.tools.media.test-helpers.js +30 -0
- package/dist/agents/pi-extensions/session-manager-runtime-registry.js +23 -0
- package/dist/agents/pi-tools.js +2 -0
- package/dist/agents/queued-file-writer.js +22 -0
- package/dist/agents/sandbox/docker.js +133 -40
- package/dist/agents/sandbox/fs-bridge.js +146 -0
- package/dist/agents/sandbox/fs-paths.js +205 -0
- package/dist/agents/sandbox/hash.js +4 -0
- package/dist/agents/sandbox-paths.js +3 -0
- package/dist/agents/session-dirs.js +20 -0
- package/dist/agents/skills/filter.js +24 -0
- package/dist/agents/skills/tools-dir.js +9 -0
- package/dist/agents/skills-install-download.js +290 -0
- package/dist/agents/skills-install-output.js +30 -0
- package/dist/agents/skills-install.download-test-utils.js +36 -0
- package/dist/agents/skills.e2e-test-helpers.js +13 -0
- package/dist/agents/subagent-announce-queue.js +59 -15
- package/dist/agents/subagent-depth.js +137 -0
- package/dist/agents/subagent-registry.js +448 -96
- package/dist/agents/subagent-spawn.js +262 -0
- package/dist/agents/test-helpers/fast-tool-stubs.js +18 -0
- package/dist/agents/test-helpers/host-sandbox-fs-bridge.js +74 -0
- package/dist/agents/tool-display-common.js +782 -0
- package/dist/agents/tools/image-tool.js +1 -1
- package/dist/agents/tools/sessions-access.js +178 -0
- package/dist/agents/tools/sessions-resolution.js +206 -0
- package/dist/agents/tools/subagents-tool.js +616 -0
- package/dist/agents/workspace-dir.js +18 -0
- package/dist/agents/workspace-dirs.js +14 -0
- package/dist/agents/workspace.js +70 -0
- package/dist/auto-reply/heartbeat-reply-payload.js +18 -0
- package/dist/auto-reply/reply/commands-export-session.js +163 -0
- package/dist/auto-reply/reply/commands-mesh.js +245 -0
- package/dist/auto-reply/reply/commands-setunset.js +28 -0
- package/dist/auto-reply/reply/commands-slash-parse.js +31 -0
- package/dist/auto-reply/reply/commands-system-prompt.js +117 -0
- package/dist/auto-reply/reply/directive-handling.levels.js +17 -0
- package/dist/auto-reply/reply/directive-handling.params.js +1 -0
- package/dist/auto-reply/reply/directive-parsing.js +36 -0
- package/dist/auto-reply/reply/dispatcher-registry.js +43 -0
- package/dist/auto-reply/reply/elevated-unavailable.js +20 -0
- package/dist/auto-reply/reply/reply-delivery.js +92 -0
- package/dist/auto-reply/reply/session-reset-prompt.js +1 -0
- package/dist/auto-reply/reply/session-run-accounting.js +33 -0
- package/dist/auto-reply/reply.directive.directive-behavior.e2e-harness.js +115 -0
- package/dist/auto-reply/reply.directive.directive-behavior.e2e-mocks.js +12 -0
- package/dist/browser/bridge-auth-registry.js +26 -0
- package/dist/browser/client-actions-url.js +10 -0
- package/dist/browser/control-auth.js +73 -0
- package/dist/browser/csrf.js +64 -0
- package/dist/browser/http-auth.js +52 -0
- package/dist/browser/paths.js +37 -0
- package/dist/browser/proxy-files.js +32 -0
- package/dist/browser/pw-ai-state.js +7 -0
- package/dist/browser/resolved-config-refresh.js +42 -0
- package/dist/browser/routes/path-output.js +1 -0
- package/dist/browser/server-context.chrome-test-harness.js +20 -0
- package/dist/browser/server-middleware.js +31 -0
- package/dist/browser/test-port.js +16 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/file-resolver.js +43 -0
- package/dist/channels/account-summary.js +19 -0
- package/dist/channels/draft-stream-loop.js +77 -0
- package/dist/channels/plugins/account-helpers.js +26 -0
- package/dist/channels/telegram/allow-from.js +10 -0
- package/dist/cli/browser-cli-resize.js +22 -0
- package/dist/cli/browser-cli-shared.js +8 -0
- package/dist/cli/clawbot-cli.js +5 -0
- package/dist/cli/completion-cli.js +566 -0
- package/dist/cli/config-cli.js +63 -5
- package/dist/cli/daemon-cli/lifecycle-core.js +256 -0
- package/dist/cli/daemon-cli/register-service-commands.js +60 -0
- package/dist/cli/daemon-cli-compat.js +80 -0
- package/dist/cli/nodes-cli/pairing-render.js +26 -0
- package/dist/cli/program/action-reparse.js +17 -0
- package/dist/cli/program/command-registry.js +17 -0
- package/dist/cli/program/program-context.js +8 -0
- package/dist/cli/program/register.subclis.js +7 -0
- package/dist/cli/program/routes.js +233 -0
- package/dist/cli/qr-cli.js +132 -0
- package/dist/cli/requirements-test-fixtures.js +17 -0
- package/dist/cli/respawn-policy.js +4 -0
- package/dist/cli/shared/parse-port.js +18 -0
- package/dist/cli/skills-cli.format.js +241 -0
- package/dist/cli/update-cli/progress.js +121 -0
- package/dist/cli/update-cli/restart-helper.js +108 -0
- package/dist/cli/update-cli/shared.js +196 -0
- package/dist/cli/update-cli/status.js +97 -0
- package/dist/cli/update-cli/suppress-deprecations.js +17 -0
- package/dist/cli/update-cli/update-command.js +506 -0
- package/dist/cli/update-cli/wizard.js +130 -0
- package/dist/cli/update-cli.js +3 -9
- package/dist/cli/windows-argv.js +69 -0
- package/dist/commands/auth-choice-legacy.js +20 -0
- package/dist/commands/auth-choice.apply-helpers.js +8 -0
- package/dist/commands/channel-test-helpers.js +19 -0
- package/dist/commands/cleanup-plan.js +10 -0
- package/dist/commands/cleanup-utils.js +7 -0
- package/dist/commands/config-validation.js +15 -0
- package/dist/commands/doctor-completion.js +112 -0
- package/dist/commands/doctor-memory-search.js +119 -0
- package/dist/commands/doctor-session-locks.js +73 -0
- package/dist/commands/doctor.e2e-harness.js +364 -0
- package/dist/commands/gateway-presence.js +19 -0
- package/dist/commands/model-default.js +35 -0
- package/dist/commands/models/fallbacks-shared.js +102 -0
- package/dist/commands/models/shared.js +24 -0
- package/dist/commands/onboard-auth.config-gateways.js +64 -0
- package/dist/commands/onboard-auth.config-litellm.js +45 -0
- package/dist/commands/onboard-auth.config-shared.js +116 -0
- package/dist/commands/onboard-config.js +16 -0
- package/dist/commands/onboard-non-interactive.test-helpers.js +31 -0
- package/dist/commands/onboard-provider-auth-flags.js +136 -0
- package/dist/commands/openai-codex-oauth.js +40 -0
- package/dist/commands/test-runtime-config-helpers.js +21 -0
- package/dist/commands/test-wizard-helpers.js +68 -0
- package/dist/commands/vllm-setup.js +66 -0
- package/dist/compat/legacy-names.js +2 -0
- package/dist/config/backup-rotation.js +19 -0
- package/dist/config/env-preserve.js +122 -0
- package/dist/config/includes-scan.js +78 -0
- package/dist/config/plugins-allowlist.js +13 -0
- package/dist/config/schema.help.js +256 -0
- package/dist/config/schema.hints.js +189 -0
- package/dist/config/schema.irc.js +20 -0
- package/dist/config/schema.labels.js +317 -0
- package/dist/config/sessions/delivery-info.js +40 -0
- package/dist/config/types.irc.js +1 -0
- package/dist/config/zod-schema.agent-model.js +10 -0
- package/dist/config/zod-schema.allowdeny.js +35 -0
- package/dist/config/zod-schema.sensitive.js +4 -0
- package/dist/control-ui/assets/index-HRr1grwl.js.map +1 -1
- package/dist/cron/isolated-agent/skills-snapshot.js +26 -0
- package/dist/cron/isolated-agent/subagent-followup.js +127 -0
- package/dist/cron/isolated-agent.mocks.js +12 -0
- package/dist/cron/isolated-agent.test-setup.js +22 -0
- package/dist/cron/legacy-delivery.js +43 -0
- package/dist/cron/webhook-url.js +22 -0
- package/dist/daemon/arg-split.js +40 -0
- package/dist/daemon/exec-file.js +23 -0
- package/dist/daemon/output.js +6 -0
- package/dist/daemon/runtime-format.js +31 -0
- package/dist/daemon/schtasks-exec.js +4 -0
- package/dist/daemon/service-audit.js +22 -0
- package/dist/discord/client.js +41 -0
- package/dist/discord/components-registry.js +57 -0
- package/dist/discord/components.js +816 -0
- package/dist/discord/guilds.js +12 -0
- package/dist/discord/monitor/gateway-plugin.js +48 -0
- package/dist/discord/monitor/presence.js +30 -0
- package/dist/discord/send.components.js +115 -0
- package/dist/discord/send.shared.js +4 -0
- package/dist/discord/ui.js +26 -0
- package/dist/discord/voice-message.js +254 -0
- package/dist/gateway/agent-event-assistant-text.js +5 -0
- package/dist/gateway/agent-prompt.js +33 -0
- package/dist/gateway/auth-rate-limit.js +136 -0
- package/dist/gateway/channel-health-monitor.js +114 -0
- package/dist/gateway/control-ui-contract.js +1 -0
- package/dist/gateway/control-ui-csp.js +15 -0
- package/dist/gateway/gateway-config-prompts.shared.js +25 -0
- package/dist/gateway/http-auth-helpers.js +18 -0
- package/dist/gateway/http-common.js +18 -0
- package/dist/gateway/http-endpoint-helpers.js +27 -0
- package/dist/gateway/node-invoke-sanitize.js +11 -0
- package/dist/gateway/node-invoke-system-run-approval.js +205 -0
- package/dist/gateway/probe-auth.js +21 -0
- package/dist/gateway/protocol/index.js +7 -2
- package/dist/gateway/protocol/schema/mesh.js +54 -0
- package/dist/gateway/protocol/schema/protocol-schemas.js +7 -0
- package/dist/gateway/protocol/schema.js +1 -0
- package/dist/gateway/server/ws-connection/auth-messages.js +54 -0
- package/dist/gateway/server-channels.js +11 -0
- package/dist/gateway/server-methods/attachment-normalize.js +16 -0
- package/dist/gateway/server-methods/base-hash.js +8 -0
- package/dist/gateway/server-methods/mesh.js +700 -0
- package/dist/gateway/server-methods/nodes.handlers.invoke-result.js +55 -0
- package/dist/gateway/server-methods/restart-request.js +13 -0
- package/dist/gateway/server-methods/validation.js +8 -0
- package/dist/gateway/server.agent.gateway-server-agent.mocks.js +35 -0
- package/dist/gateway/server.e2e-registry-helpers.js +1 -0
- package/dist/gateway/server.e2e-ws-harness.js +20 -0
- package/dist/gateway/test-helpers.js +2 -0
- package/dist/gateway/test-helpers.server.js +3 -1
- package/dist/gateway/test-http-response.js +12 -0
- package/dist/gateway/test-openai-responses-model.js +20 -0
- package/dist/gateway/test-temp-config.js +30 -0
- package/dist/gateway/test-with-server.js +32 -0
- package/dist/hooks/bundled/bootstrap-extra-files/handler.js +46 -0
- package/dist/imessage/monitor/abort-handler.js +23 -0
- package/dist/imessage/monitor/inbound-processing.js +346 -0
- package/dist/imessage/monitor/parse-notification.js +64 -0
- package/dist/imessage/target-parsing-helpers.js +92 -0
- package/dist/infra/archive.js +244 -20
- package/dist/infra/detect-package-manager.js +26 -0
- package/dist/infra/exec-approvals-allowlist.js +257 -0
- package/dist/infra/exec-approvals-analysis.js +770 -0
- package/dist/infra/exec-approvals.js +13 -0
- package/dist/infra/file-lock.js +1 -0
- package/dist/infra/gemini-auth.js +39 -0
- package/dist/infra/heartbeat-active-hours.js +85 -0
- package/dist/infra/heartbeat-events-filter.js +50 -0
- package/dist/infra/heartbeat-runner.test-utils.js +39 -0
- package/dist/infra/http-body.js +265 -0
- package/dist/infra/install-package-dir.js +50 -0
- package/dist/infra/install-safe-path.js +49 -0
- package/dist/infra/json-files.js +49 -0
- package/dist/infra/jsonl-socket.js +52 -0
- package/dist/infra/map-size.js +14 -0
- package/dist/infra/net/hostname.js +7 -0
- package/dist/infra/npm-registry-spec.js +39 -0
- package/dist/infra/openclaw-root.js +109 -0
- package/dist/infra/outbound/delivery-queue.js +214 -0
- package/dist/infra/outbound/identity.js +23 -0
- package/dist/infra/outbound/message-action-params.js +307 -0
- package/dist/infra/outbound/tool-payload.js +21 -0
- package/dist/infra/package-json.js +23 -0
- package/dist/infra/pairing-files.js +19 -0
- package/dist/infra/pairing-token.js +9 -0
- package/dist/infra/path-prepend.js +51 -0
- package/dist/infra/process-respawn.js +49 -0
- package/dist/infra/runtime-status.js +16 -0
- package/dist/infra/session-cost-usage.types.js +1 -0
- package/dist/infra/session-maintenance-warning.js +89 -0
- package/dist/infra/system-run-command.js +78 -0
- package/dist/infra/tmp-openclaw-dir.js +81 -0
- package/dist/infra/tmp-poolbot-dir.js +2 -0
- package/dist/infra/update-channels.js +19 -0
- package/dist/line/actions.js +45 -0
- package/dist/line/channel-access-token.js +9 -0
- package/dist/line/flex-templates/basic-cards.js +332 -0
- package/dist/line/flex-templates/common.js +18 -0
- package/dist/line/flex-templates/media-control-cards.js +453 -0
- package/dist/line/flex-templates/message.js +10 -0
- package/dist/line/flex-templates/schedule-cards.js +399 -0
- package/dist/line/flex-templates/types.js +1 -0
- package/dist/line/webhook-node.js +100 -0
- package/dist/line/webhook-utils.js +11 -0
- package/dist/logging/timestamps.js +14 -0
- package/dist/markdown/whatsapp.js +62 -0
- package/dist/media/base64.js +34 -0
- package/dist/media/local-roots.js +32 -0
- package/dist/media/outbound-attachment.js +10 -0
- package/dist/media/read-response-with-limit.js +41 -0
- package/dist/media/sniff-mime-from-base64.js +19 -0
- package/dist/media-understanding/audio-preflight.js +67 -0
- package/dist/media-understanding/fs.js +13 -0
- package/dist/media-understanding/output-extract.js +26 -0
- package/dist/media-understanding/providers/audio.test-helpers.js +34 -0
- package/dist/media-understanding/providers/google/inline-data.js +64 -0
- package/dist/media-understanding/providers/shared.js +7 -0
- package/dist/media-understanding/runner.entries.js +459 -0
- package/dist/memory/batch-error-utils.js +11 -0
- package/dist/memory/batch-http.js +27 -0
- package/dist/memory/batch-output.js +29 -0
- package/dist/memory/batch-runner.js +22 -0
- package/dist/memory/batch-upload.js +23 -0
- package/dist/memory/batch-utils.js +26 -0
- package/dist/memory/embeddings-debug.js +11 -0
- package/dist/memory/embeddings-remote-client.js +22 -0
- package/dist/memory/embeddings-remote-fetch.js +14 -0
- package/dist/memory/manager-embedding-ops.js +616 -0
- package/dist/memory/manager-sync-ops.js +953 -0
- package/dist/memory/qmd-manager.js +1061 -0
- package/dist/memory/qmd-query-parser.js +107 -0
- package/dist/memory/qmd-scope.js +93 -0
- package/dist/memory/search-manager.js +0 -1
- package/dist/memory/sync-index.js +21 -0
- package/dist/memory/sync-progress.js +22 -0
- package/dist/memory/sync-stale.js +30 -0
- package/dist/memory/test-embeddings-mock.js +16 -0
- package/dist/memory/test-manager-helpers.js +14 -0
- package/dist/memory/test-runtime-mocks.js +11 -0
- package/dist/node-host/invoke-browser.js +177 -0
- package/dist/node-host/invoke.js +685 -0
- package/dist/pairing/setup-code.js +285 -0
- package/dist/plugin-sdk/account-id.js +1 -0
- package/dist/plugin-sdk/agent-media-payload.js +13 -0
- package/dist/plugin-sdk/allow-from.js +47 -0
- package/dist/plugin-sdk/command-auth.js +23 -0
- package/dist/plugin-sdk/config-paths.js +9 -0
- package/dist/plugin-sdk/file-lock.js +116 -0
- package/dist/plugin-sdk/json-store.js +31 -0
- package/dist/plugin-sdk/onboarding.js +28 -0
- package/dist/plugin-sdk/provider-auth-result.js +29 -0
- package/dist/plugin-sdk/slack-message-actions.js +133 -0
- package/dist/plugin-sdk/status-helpers.js +35 -0
- package/dist/plugin-sdk/text-chunking.js +31 -0
- package/dist/plugin-sdk/tool-send.js +12 -0
- package/dist/plugin-sdk/webhook-path.js +27 -0
- package/dist/plugin-sdk/webhook-targets.js +34 -0
- package/dist/plugins/hooks.test-helpers.js +21 -0
- package/dist/plugins/uninstall.js +171 -0
- package/dist/process/supervisor/adapters/child.js +143 -0
- package/dist/process/supervisor/adapters/env.js +13 -0
- package/dist/process/supervisor/adapters/pty.js +148 -0
- package/dist/process/supervisor/index.js +10 -0
- package/dist/process/supervisor/registry.js +117 -0
- package/dist/process/supervisor/supervisor.js +244 -0
- package/dist/process/supervisor/types.js +1 -0
- package/dist/providers/google-shared.test-helpers.js +75 -0
- package/dist/security/audit-channel.js +419 -0
- package/dist/security/audit-tool-policy.js +1 -0
- package/dist/security/scan-paths.js +12 -0
- package/dist/sessions/input-provenance.js +55 -0
- package/dist/sessions/session-key-utils.js +7 -0
- package/dist/shared/chat-content.js +31 -0
- package/dist/shared/chat-envelope.js +45 -0
- package/dist/shared/config-eval.js +117 -0
- package/dist/shared/device-auth.js +16 -0
- package/dist/shared/entry-metadata.js +9 -0
- package/dist/shared/entry-status.js +25 -0
- package/dist/shared/frontmatter.js +98 -0
- package/dist/shared/model-param-b.js +19 -0
- package/dist/shared/net/ipv4.js +17 -0
- package/dist/shared/node-match.js +53 -0
- package/dist/shared/requirements.js +128 -0
- package/dist/shared/subagents-format.js +84 -0
- package/dist/shared/usage-aggregates.js +28 -0
- package/dist/signal/monitor/mentions.js +45 -0
- package/dist/signal/rpc-context.js +19 -0
- package/dist/slack/blocks-fallback.js +76 -0
- package/dist/slack/blocks-input.js +40 -0
- package/dist/slack/draft-stream.js +106 -0
- package/dist/slack/message-actions.js +51 -0
- package/dist/slack/modal-metadata.js +32 -0
- package/dist/slack/monitor/events/interactions.js +462 -0
- package/dist/slack/monitor/room-context.js +17 -0
- package/dist/slack/stream-mode.js +41 -0
- package/dist/telegram/bot-native-command-menu.js +64 -0
- package/dist/telegram/bot.media.e2e-harness.js +81 -0
- package/dist/telegram/button-types.js +1 -0
- package/dist/telegram/group-access.js +65 -0
- package/dist/telegram/outbound-params.js +21 -0
- package/dist/telegram/poll-vote-cache.js +21 -0
- package/dist/terminal/health-style.js +36 -0
- package/dist/test-utils/chunk-test-helpers.js +21 -0
- package/dist/test-utils/env.js +72 -0
- package/dist/test-utils/exec-assertions.js +12 -0
- package/dist/test-utils/imessage-test-plugin.js +54 -0
- package/dist/test-utils/mock-http-response.js +17 -0
- package/dist/test-utils/vitest-mock-fn.js +1 -0
- package/dist/tts/tts-core.js +550 -0
- package/dist/utils/chunk-items.js +10 -0
- package/dist/utils/reaction-level.js +52 -0
- package/dist/utils/safe-json.js +22 -0
- package/dist/utils/with-timeout.js +14 -0
- package/dist/web/media.js +17 -5
- package/dist/whatsapp/resolve-outbound-target.js +42 -0
- package/dist/wizard/onboarding.completion.js +74 -0
- package/extensions/bluebubbles/src/account-resolve.ts +29 -0
- package/extensions/bluebubbles/src/monitor-normalize.ts +796 -0
- package/extensions/bluebubbles/src/monitor-processing.ts +1007 -0
- package/extensions/bluebubbles/src/monitor-reply-cache.ts +185 -0
- package/extensions/bluebubbles/src/monitor-shared.ts +51 -0
- package/extensions/bluebubbles/src/multipart.ts +32 -0
- package/extensions/bluebubbles/src/send-helpers.ts +53 -0
- package/extensions/bluebubbles/src/test-harness.ts +50 -0
- package/extensions/bluebubbles/src/test-mocks.ts +11 -0
- package/extensions/device-pair/index.ts +554 -0
- package/extensions/discord/src/channel.js +366 -0
- package/extensions/discord/src/runtime.js +10 -0
- package/extensions/feishu/index.ts +63 -0
- package/extensions/feishu/src/accounts.ts +114 -0
- package/extensions/feishu/src/bitable.ts +739 -0
- package/extensions/feishu/src/bot.ts +965 -0
- package/extensions/feishu/src/channel.ts +351 -0
- package/extensions/feishu/src/client.ts +118 -0
- package/extensions/feishu/src/config-schema.ts +206 -0
- package/extensions/feishu/src/dedup.ts +33 -0
- package/extensions/feishu/src/directory.ts +177 -0
- package/extensions/feishu/src/doc-schema.ts +47 -0
- package/extensions/feishu/src/docx.ts +536 -0
- package/extensions/feishu/src/drive-schema.ts +46 -0
- package/extensions/feishu/src/drive.ts +227 -0
- package/extensions/feishu/src/dynamic-agent.ts +131 -0
- package/extensions/feishu/src/media.ts +449 -0
- package/extensions/feishu/src/mention.ts +126 -0
- package/extensions/feishu/src/monitor.ts +330 -0
- package/extensions/feishu/src/onboarding.ts +359 -0
- package/extensions/feishu/src/outbound.ts +55 -0
- package/extensions/feishu/src/perm-schema.ts +52 -0
- package/extensions/feishu/src/perm.ts +173 -0
- package/extensions/feishu/src/policy.ts +84 -0
- package/extensions/feishu/src/probe.ts +44 -0
- package/extensions/feishu/src/reactions.ts +160 -0
- package/extensions/feishu/src/reply-dispatcher.ts +239 -0
- package/extensions/feishu/src/runtime.ts +14 -0
- package/extensions/feishu/src/send-result.ts +29 -0
- package/extensions/feishu/src/send.ts +335 -0
- package/extensions/feishu/src/streaming-card.ts +223 -0
- package/extensions/feishu/src/targets.ts +78 -0
- package/extensions/feishu/src/tools-config.ts +21 -0
- package/extensions/feishu/src/types.ts +81 -0
- package/extensions/feishu/src/typing.ts +80 -0
- package/extensions/feishu/src/wiki-schema.ts +55 -0
- package/extensions/feishu/src/wiki.ts +232 -0
- package/extensions/imessage/src/channel.js +253 -0
- package/extensions/imessage/src/runtime.js +10 -0
- package/extensions/irc/index.ts +17 -0
- package/extensions/irc/src/accounts.ts +268 -0
- package/extensions/irc/src/channel.ts +367 -0
- package/extensions/irc/src/client.ts +439 -0
- package/extensions/irc/src/config-schema.ts +97 -0
- package/extensions/irc/src/connect-options.ts +30 -0
- package/extensions/irc/src/control-chars.ts +22 -0
- package/extensions/irc/src/inbound.ts +334 -0
- package/extensions/irc/src/monitor.ts +147 -0
- package/extensions/irc/src/normalize.ts +117 -0
- package/extensions/irc/src/onboarding.ts +479 -0
- package/extensions/irc/src/policy.ts +157 -0
- package/extensions/irc/src/probe.ts +53 -0
- package/extensions/irc/src/protocol.ts +169 -0
- package/extensions/irc/src/runtime.ts +14 -0
- package/extensions/irc/src/send.ts +88 -0
- package/extensions/irc/src/types.ts +93 -0
- package/extensions/matrix/src/matrix/client-bootstrap.ts +39 -0
- package/extensions/mattermost/src/mattermost/monitor-onchar.ts +25 -0
- package/extensions/mattermost/src/mattermost/monitor-websocket.ts +221 -0
- package/extensions/mattermost/src/mattermost/reactions.ts +130 -0
- package/extensions/mattermost/src/mattermost/reconnect.ts +103 -0
- package/extensions/minimax-portal-auth/index.ts +161 -0
- package/extensions/minimax-portal-auth/oauth.ts +247 -0
- package/extensions/msteams/src/file-lock.ts +1 -0
- package/extensions/msteams/src/graph.ts +92 -0
- package/extensions/msteams/src/mentions.ts +114 -0
- package/extensions/msteams/src/test-runtime.ts +16 -0
- package/extensions/openai-codex-auth/index.ts +177 -0
- package/extensions/phone-control/index.ts +421 -0
- package/extensions/shared/resolve-target-test-helpers.ts +66 -0
- package/extensions/signal/src/channel.js +273 -0
- package/extensions/signal/src/runtime.js +10 -0
- package/extensions/slack/src/channel.js +489 -0
- package/extensions/slack/src/runtime.js +10 -0
- package/extensions/talk-voice/index.ts +150 -0
- package/extensions/telegram/src/channel.js +424 -0
- package/extensions/telegram/src/runtime.js +10 -0
- package/extensions/thread-ownership/index.ts +133 -0
- package/extensions/tlon/src/account-fields.ts +25 -0
- package/extensions/tlon/src/urbit/base-url.ts +57 -0
- package/extensions/tlon/src/urbit/channel-client.ts +157 -0
- package/extensions/tlon/src/urbit/channel-ops.ts +164 -0
- package/extensions/tlon/src/urbit/context.ts +47 -0
- package/extensions/tlon/src/urbit/errors.ts +51 -0
- package/extensions/tlon/src/urbit/fetch.ts +39 -0
- package/extensions/twitch/src/test-fixtures.ts +30 -0
- package/extensions/voice-call/src/allowlist.ts +19 -0
- package/extensions/whatsapp/src/channel.js +429 -0
- package/extensions/whatsapp/src/runtime.js +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { applyAccountNameToChannelSection, buildChannelConfigSchema, collectDiscordAuditChannelIds, collectDiscordStatusIssues, DEFAULT_ACCOUNT_ID, deleteAccountFromConfigSection, discordOnboardingAdapter, DiscordConfigSchema, formatPairingApproveHint, getChatChannelMeta, listDiscordAccountIds, listDiscordDirectoryGroupsFromConfig, listDiscordDirectoryPeersFromConfig, looksLikeDiscordTargetId, migrateBaseNameToDefaultAccount, normalizeAccountId, normalizeDiscordMessagingTarget, PAIRING_APPROVED_MESSAGE, resolveDiscordAccount, resolveDefaultDiscordAccountId, resolveDiscordGroupRequireMention, resolveDiscordGroupToolPolicy, setAccountEnabledInConfigSection, } from "poolbot/plugin-sdk";
|
|
2
|
+
import { getDiscordRuntime } from "./runtime.js";
|
|
3
|
+
const meta = getChatChannelMeta("discord");
|
|
4
|
+
const discordMessageActions = {
|
|
5
|
+
listActions: (ctx) => getDiscordRuntime().channel.discord.messageActions.listActions(ctx),
|
|
6
|
+
extractToolSend: (ctx) => getDiscordRuntime().channel.discord.messageActions.extractToolSend(ctx),
|
|
7
|
+
handleAction: async (ctx) => await getDiscordRuntime().channel.discord.messageActions.handleAction(ctx),
|
|
8
|
+
};
|
|
9
|
+
export const discordPlugin = {
|
|
10
|
+
id: "discord",
|
|
11
|
+
meta: {
|
|
12
|
+
...meta,
|
|
13
|
+
},
|
|
14
|
+
onboarding: discordOnboardingAdapter,
|
|
15
|
+
pairing: {
|
|
16
|
+
idLabel: "discordUserId",
|
|
17
|
+
normalizeAllowEntry: (entry) => entry.replace(/^(discord|user):/i, ""),
|
|
18
|
+
notifyApproval: async ({ id }) => {
|
|
19
|
+
await getDiscordRuntime().channel.discord.sendMessageDiscord(`user:${id}`, PAIRING_APPROVED_MESSAGE);
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
capabilities: {
|
|
23
|
+
chatTypes: ["direct", "channel", "thread"],
|
|
24
|
+
polls: true,
|
|
25
|
+
reactions: true,
|
|
26
|
+
threads: true,
|
|
27
|
+
media: true,
|
|
28
|
+
nativeCommands: true,
|
|
29
|
+
},
|
|
30
|
+
streaming: {
|
|
31
|
+
blockStreamingCoalesceDefaults: { minChars: 1500, idleMs: 1000 },
|
|
32
|
+
},
|
|
33
|
+
reload: { configPrefixes: ["channels.discord"] },
|
|
34
|
+
configSchema: buildChannelConfigSchema(DiscordConfigSchema),
|
|
35
|
+
config: {
|
|
36
|
+
listAccountIds: (cfg) => listDiscordAccountIds(cfg),
|
|
37
|
+
resolveAccount: (cfg, accountId) => resolveDiscordAccount({ cfg, accountId }),
|
|
38
|
+
defaultAccountId: (cfg) => resolveDefaultDiscordAccountId(cfg),
|
|
39
|
+
setAccountEnabled: ({ cfg, accountId, enabled }) => setAccountEnabledInConfigSection({
|
|
40
|
+
cfg,
|
|
41
|
+
sectionKey: "discord",
|
|
42
|
+
accountId,
|
|
43
|
+
enabled,
|
|
44
|
+
allowTopLevel: true,
|
|
45
|
+
}),
|
|
46
|
+
deleteAccount: ({ cfg, accountId }) => deleteAccountFromConfigSection({
|
|
47
|
+
cfg,
|
|
48
|
+
sectionKey: "discord",
|
|
49
|
+
accountId,
|
|
50
|
+
clearBaseFields: ["token", "name"],
|
|
51
|
+
}),
|
|
52
|
+
isConfigured: (account) => Boolean(account.token?.trim()),
|
|
53
|
+
describeAccount: (account) => ({
|
|
54
|
+
accountId: account.accountId,
|
|
55
|
+
name: account.name,
|
|
56
|
+
enabled: account.enabled,
|
|
57
|
+
configured: Boolean(account.token?.trim()),
|
|
58
|
+
tokenSource: account.tokenSource,
|
|
59
|
+
}),
|
|
60
|
+
resolveAllowFrom: ({ cfg, accountId }) => (resolveDiscordAccount({ cfg, accountId }).config.dm?.allowFrom ?? []).map((entry) => String(entry)),
|
|
61
|
+
formatAllowFrom: ({ allowFrom }) => allowFrom
|
|
62
|
+
.map((entry) => String(entry).trim())
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.map((entry) => entry.toLowerCase()),
|
|
65
|
+
},
|
|
66
|
+
security: {
|
|
67
|
+
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
68
|
+
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
69
|
+
const useAccountPath = Boolean(cfg.channels?.discord?.accounts?.[resolvedAccountId]);
|
|
70
|
+
const allowFromPath = useAccountPath
|
|
71
|
+
? `channels.discord.accounts.${resolvedAccountId}.dm.`
|
|
72
|
+
: "channels.discord.dm.";
|
|
73
|
+
return {
|
|
74
|
+
policy: account.config.dm?.policy ?? "pairing",
|
|
75
|
+
allowFrom: account.config.dm?.allowFrom ?? [],
|
|
76
|
+
allowFromPath,
|
|
77
|
+
approveHint: formatPairingApproveHint("discord"),
|
|
78
|
+
normalizeEntry: (raw) => raw.replace(/^(discord|user):/i, "").replace(/^<@!?(\d+)>$/, "$1"),
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
collectWarnings: ({ account, cfg }) => {
|
|
82
|
+
const warnings = [];
|
|
83
|
+
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
84
|
+
const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "open";
|
|
85
|
+
const guildEntries = account.config.guilds ?? {};
|
|
86
|
+
const guildsConfigured = Object.keys(guildEntries).length > 0;
|
|
87
|
+
const channelAllowlistConfigured = guildsConfigured;
|
|
88
|
+
if (groupPolicy === "open") {
|
|
89
|
+
if (channelAllowlistConfigured) {
|
|
90
|
+
warnings.push(`- Discord guilds: groupPolicy="open" allows any channel not explicitly denied to trigger (mention-gated). Set channels.discord.groupPolicy="allowlist" and configure channels.discord.guilds.<id>.channels.`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
warnings.push(`- Discord guilds: groupPolicy="open" with no guild/channel allowlist; any channel can trigger (mention-gated). Set channels.discord.groupPolicy="allowlist" and configure channels.discord.guilds.<id>.channels.`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return warnings;
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
groups: {
|
|
100
|
+
resolveRequireMention: resolveDiscordGroupRequireMention,
|
|
101
|
+
resolveToolPolicy: resolveDiscordGroupToolPolicy,
|
|
102
|
+
},
|
|
103
|
+
mentions: {
|
|
104
|
+
stripPatterns: () => ["<@!?\\d+>"],
|
|
105
|
+
},
|
|
106
|
+
threading: {
|
|
107
|
+
resolveReplyToMode: ({ cfg }) => cfg.channels?.discord?.replyToMode ?? "off",
|
|
108
|
+
},
|
|
109
|
+
messaging: {
|
|
110
|
+
normalizeTarget: normalizeDiscordMessagingTarget,
|
|
111
|
+
targetResolver: {
|
|
112
|
+
looksLikeId: looksLikeDiscordTargetId,
|
|
113
|
+
hint: "<channelId|user:ID|channel:ID>",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
directory: {
|
|
117
|
+
self: async () => null,
|
|
118
|
+
listPeers: async (params) => listDiscordDirectoryPeersFromConfig(params),
|
|
119
|
+
listGroups: async (params) => listDiscordDirectoryGroupsFromConfig(params),
|
|
120
|
+
listPeersLive: async (params) => getDiscordRuntime().channel.discord.listDirectoryPeersLive(params),
|
|
121
|
+
listGroupsLive: async (params) => getDiscordRuntime().channel.discord.listDirectoryGroupsLive(params),
|
|
122
|
+
},
|
|
123
|
+
resolver: {
|
|
124
|
+
resolveTargets: async ({ cfg, accountId, inputs, kind }) => {
|
|
125
|
+
const account = resolveDiscordAccount({ cfg, accountId });
|
|
126
|
+
const token = account.token?.trim();
|
|
127
|
+
if (!token) {
|
|
128
|
+
return inputs.map((input) => ({
|
|
129
|
+
input,
|
|
130
|
+
resolved: false,
|
|
131
|
+
note: "missing Discord token",
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
if (kind === "group") {
|
|
135
|
+
const resolved = await getDiscordRuntime().channel.discord.resolveChannelAllowlist({
|
|
136
|
+
token,
|
|
137
|
+
entries: inputs,
|
|
138
|
+
});
|
|
139
|
+
return resolved.map((entry) => ({
|
|
140
|
+
input: entry.input,
|
|
141
|
+
resolved: entry.resolved,
|
|
142
|
+
id: entry.channelId ?? entry.guildId,
|
|
143
|
+
name: entry.channelName ??
|
|
144
|
+
entry.guildName ??
|
|
145
|
+
(entry.guildId && !entry.channelId ? entry.guildId : undefined),
|
|
146
|
+
note: entry.note,
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
const resolved = await getDiscordRuntime().channel.discord.resolveUserAllowlist({
|
|
150
|
+
token,
|
|
151
|
+
entries: inputs,
|
|
152
|
+
});
|
|
153
|
+
return resolved.map((entry) => ({
|
|
154
|
+
input: entry.input,
|
|
155
|
+
resolved: entry.resolved,
|
|
156
|
+
id: entry.id,
|
|
157
|
+
name: entry.name,
|
|
158
|
+
note: entry.note,
|
|
159
|
+
}));
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
actions: discordMessageActions,
|
|
163
|
+
setup: {
|
|
164
|
+
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
165
|
+
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
166
|
+
cfg,
|
|
167
|
+
channelKey: "discord",
|
|
168
|
+
accountId,
|
|
169
|
+
name,
|
|
170
|
+
}),
|
|
171
|
+
validateInput: ({ accountId, input }) => {
|
|
172
|
+
if (input.useEnv && accountId !== DEFAULT_ACCOUNT_ID) {
|
|
173
|
+
return "DISCORD_BOT_TOKEN can only be used for the default account.";
|
|
174
|
+
}
|
|
175
|
+
if (!input.useEnv && !input.token) {
|
|
176
|
+
return "Discord requires token (or --use-env).";
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
},
|
|
180
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
181
|
+
const namedConfig = applyAccountNameToChannelSection({
|
|
182
|
+
cfg,
|
|
183
|
+
channelKey: "discord",
|
|
184
|
+
accountId,
|
|
185
|
+
name: input.name,
|
|
186
|
+
});
|
|
187
|
+
const next = accountId !== DEFAULT_ACCOUNT_ID
|
|
188
|
+
? migrateBaseNameToDefaultAccount({
|
|
189
|
+
cfg: namedConfig,
|
|
190
|
+
channelKey: "discord",
|
|
191
|
+
})
|
|
192
|
+
: namedConfig;
|
|
193
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
194
|
+
return {
|
|
195
|
+
...next,
|
|
196
|
+
channels: {
|
|
197
|
+
...next.channels,
|
|
198
|
+
discord: {
|
|
199
|
+
...next.channels?.discord,
|
|
200
|
+
enabled: true,
|
|
201
|
+
...(input.useEnv ? {} : input.token ? { token: input.token } : {}),
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
...next,
|
|
208
|
+
channels: {
|
|
209
|
+
...next.channels,
|
|
210
|
+
discord: {
|
|
211
|
+
...next.channels?.discord,
|
|
212
|
+
enabled: true,
|
|
213
|
+
accounts: {
|
|
214
|
+
...next.channels?.discord?.accounts,
|
|
215
|
+
[accountId]: {
|
|
216
|
+
...next.channels?.discord?.accounts?.[accountId],
|
|
217
|
+
enabled: true,
|
|
218
|
+
...(input.token ? { token: input.token } : {}),
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
outbound: {
|
|
227
|
+
deliveryMode: "direct",
|
|
228
|
+
chunker: null,
|
|
229
|
+
textChunkLimit: 2000,
|
|
230
|
+
pollMaxOptions: 10,
|
|
231
|
+
sendText: async ({ to, text, accountId, deps, replyToId }) => {
|
|
232
|
+
const send = deps?.sendDiscord ?? getDiscordRuntime().channel.discord.sendMessageDiscord;
|
|
233
|
+
const result = await send(to, text, {
|
|
234
|
+
verbose: false,
|
|
235
|
+
replyTo: replyToId ?? undefined,
|
|
236
|
+
accountId: accountId ?? undefined,
|
|
237
|
+
});
|
|
238
|
+
return { channel: "discord", ...result };
|
|
239
|
+
},
|
|
240
|
+
sendMedia: async ({ to, text, mediaUrl, accountId, deps, replyToId }) => {
|
|
241
|
+
const send = deps?.sendDiscord ?? getDiscordRuntime().channel.discord.sendMessageDiscord;
|
|
242
|
+
const result = await send(to, text, {
|
|
243
|
+
verbose: false,
|
|
244
|
+
mediaUrl,
|
|
245
|
+
replyTo: replyToId ?? undefined,
|
|
246
|
+
accountId: accountId ?? undefined,
|
|
247
|
+
});
|
|
248
|
+
return { channel: "discord", ...result };
|
|
249
|
+
},
|
|
250
|
+
sendPoll: async ({ to, poll, accountId }) => await getDiscordRuntime().channel.discord.sendPollDiscord(to, poll, {
|
|
251
|
+
accountId: accountId ?? undefined,
|
|
252
|
+
}),
|
|
253
|
+
},
|
|
254
|
+
status: {
|
|
255
|
+
defaultRuntime: {
|
|
256
|
+
accountId: DEFAULT_ACCOUNT_ID,
|
|
257
|
+
running: false,
|
|
258
|
+
lastStartAt: null,
|
|
259
|
+
lastStopAt: null,
|
|
260
|
+
lastError: null,
|
|
261
|
+
},
|
|
262
|
+
collectStatusIssues: collectDiscordStatusIssues,
|
|
263
|
+
buildChannelSummary: ({ snapshot }) => ({
|
|
264
|
+
configured: snapshot.configured ?? false,
|
|
265
|
+
tokenSource: snapshot.tokenSource ?? "none",
|
|
266
|
+
running: snapshot.running ?? false,
|
|
267
|
+
lastStartAt: snapshot.lastStartAt ?? null,
|
|
268
|
+
lastStopAt: snapshot.lastStopAt ?? null,
|
|
269
|
+
lastError: snapshot.lastError ?? null,
|
|
270
|
+
probe: snapshot.probe,
|
|
271
|
+
lastProbeAt: snapshot.lastProbeAt ?? null,
|
|
272
|
+
}),
|
|
273
|
+
probeAccount: async ({ account, timeoutMs }) => getDiscordRuntime().channel.discord.probeDiscord(account.token, timeoutMs, {
|
|
274
|
+
includeApplication: true,
|
|
275
|
+
}),
|
|
276
|
+
auditAccount: async ({ account, timeoutMs, cfg }) => {
|
|
277
|
+
const { channelIds, unresolvedChannels } = collectDiscordAuditChannelIds({
|
|
278
|
+
cfg,
|
|
279
|
+
accountId: account.accountId,
|
|
280
|
+
});
|
|
281
|
+
if (!channelIds.length && unresolvedChannels === 0)
|
|
282
|
+
return undefined;
|
|
283
|
+
const botToken = account.token?.trim();
|
|
284
|
+
if (!botToken) {
|
|
285
|
+
return {
|
|
286
|
+
ok: unresolvedChannels === 0,
|
|
287
|
+
checkedChannels: 0,
|
|
288
|
+
unresolvedChannels,
|
|
289
|
+
channels: [],
|
|
290
|
+
elapsedMs: 0,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
const audit = await getDiscordRuntime().channel.discord.auditChannelPermissions({
|
|
294
|
+
token: botToken,
|
|
295
|
+
accountId: account.accountId,
|
|
296
|
+
channelIds,
|
|
297
|
+
timeoutMs,
|
|
298
|
+
});
|
|
299
|
+
return { ...audit, unresolvedChannels };
|
|
300
|
+
},
|
|
301
|
+
buildAccountSnapshot: ({ account, runtime, probe, audit }) => {
|
|
302
|
+
const configured = Boolean(account.token?.trim());
|
|
303
|
+
const app = runtime?.application ?? probe?.application;
|
|
304
|
+
const bot = runtime?.bot ?? probe?.bot;
|
|
305
|
+
return {
|
|
306
|
+
accountId: account.accountId,
|
|
307
|
+
name: account.name,
|
|
308
|
+
enabled: account.enabled,
|
|
309
|
+
configured,
|
|
310
|
+
tokenSource: account.tokenSource,
|
|
311
|
+
running: runtime?.running ?? false,
|
|
312
|
+
lastStartAt: runtime?.lastStartAt ?? null,
|
|
313
|
+
lastStopAt: runtime?.lastStopAt ?? null,
|
|
314
|
+
lastError: runtime?.lastError ?? null,
|
|
315
|
+
application: app ?? undefined,
|
|
316
|
+
bot: bot ?? undefined,
|
|
317
|
+
probe,
|
|
318
|
+
audit,
|
|
319
|
+
lastInboundAt: runtime?.lastInboundAt ?? null,
|
|
320
|
+
lastOutboundAt: runtime?.lastOutboundAt ?? null,
|
|
321
|
+
};
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
gateway: {
|
|
325
|
+
startAccount: async (ctx) => {
|
|
326
|
+
const account = ctx.account;
|
|
327
|
+
const token = account.token.trim();
|
|
328
|
+
let discordBotLabel = "";
|
|
329
|
+
try {
|
|
330
|
+
const probe = await getDiscordRuntime().channel.discord.probeDiscord(token, 2500, {
|
|
331
|
+
includeApplication: true,
|
|
332
|
+
});
|
|
333
|
+
const username = probe.ok ? probe.bot?.username?.trim() : null;
|
|
334
|
+
if (username)
|
|
335
|
+
discordBotLabel = ` (@${username})`;
|
|
336
|
+
ctx.setStatus({
|
|
337
|
+
accountId: account.accountId,
|
|
338
|
+
bot: probe.bot,
|
|
339
|
+
application: probe.application,
|
|
340
|
+
});
|
|
341
|
+
const messageContent = probe.application?.intents?.messageContent;
|
|
342
|
+
if (messageContent === "disabled") {
|
|
343
|
+
ctx.log?.warn(`[${account.accountId}] Discord Message Content Intent is disabled; bot may not respond to channel messages. Enable it in Discord Dev Portal (Bot → Privileged Gateway Intents) or require mentions.`);
|
|
344
|
+
}
|
|
345
|
+
else if (messageContent === "limited") {
|
|
346
|
+
ctx.log?.info(`[${account.accountId}] Discord Message Content Intent is limited; bots under 100 servers can use it without verification.`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
catch (err) {
|
|
350
|
+
if (getDiscordRuntime().logging.shouldLogVerbose()) {
|
|
351
|
+
ctx.log?.debug?.(`[${account.accountId}] bot probe failed: ${String(err)}`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
ctx.log?.info(`[${account.accountId}] starting provider${discordBotLabel}`);
|
|
355
|
+
return getDiscordRuntime().channel.discord.monitorDiscordProvider({
|
|
356
|
+
token,
|
|
357
|
+
accountId: account.accountId,
|
|
358
|
+
config: ctx.cfg,
|
|
359
|
+
runtime: ctx.runtime,
|
|
360
|
+
abortSignal: ctx.abortSignal,
|
|
361
|
+
mediaMaxMb: account.config.mediaMaxMb,
|
|
362
|
+
historyLimit: account.config.historyLimit,
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PoolBotPluginApi } from "poolbot/plugin-sdk";
|
|
2
|
+
import { emptyPluginConfigSchema } from "poolbot/plugin-sdk";
|
|
3
|
+
import { registerFeishuBitableTools } from "./src/bitable.js";
|
|
4
|
+
import { feishuPlugin } from "./src/channel.js";
|
|
5
|
+
import { registerFeishuDocTools } from "./src/docx.js";
|
|
6
|
+
import { registerFeishuDriveTools } from "./src/drive.js";
|
|
7
|
+
import { registerFeishuPermTools } from "./src/perm.js";
|
|
8
|
+
import { setFeishuRuntime } from "./src/runtime.js";
|
|
9
|
+
import { registerFeishuWikiTools } from "./src/wiki.js";
|
|
10
|
+
|
|
11
|
+
export { monitorFeishuProvider } from "./src/monitor.js";
|
|
12
|
+
export {
|
|
13
|
+
sendMessageFeishu,
|
|
14
|
+
sendCardFeishu,
|
|
15
|
+
updateCardFeishu,
|
|
16
|
+
editMessageFeishu,
|
|
17
|
+
getMessageFeishu,
|
|
18
|
+
} from "./src/send.js";
|
|
19
|
+
export {
|
|
20
|
+
uploadImageFeishu,
|
|
21
|
+
uploadFileFeishu,
|
|
22
|
+
sendImageFeishu,
|
|
23
|
+
sendFileFeishu,
|
|
24
|
+
sendMediaFeishu,
|
|
25
|
+
} from "./src/media.js";
|
|
26
|
+
export { probeFeishu } from "./src/probe.js";
|
|
27
|
+
export {
|
|
28
|
+
addReactionFeishu,
|
|
29
|
+
removeReactionFeishu,
|
|
30
|
+
listReactionsFeishu,
|
|
31
|
+
FeishuEmoji,
|
|
32
|
+
} from "./src/reactions.js";
|
|
33
|
+
export {
|
|
34
|
+
extractMentionTargets,
|
|
35
|
+
extractMessageBody,
|
|
36
|
+
isMentionForwardRequest,
|
|
37
|
+
formatMentionForText,
|
|
38
|
+
formatMentionForCard,
|
|
39
|
+
formatMentionAllForText,
|
|
40
|
+
formatMentionAllForCard,
|
|
41
|
+
buildMentionedMessage,
|
|
42
|
+
buildMentionedCardContent,
|
|
43
|
+
type MentionTarget,
|
|
44
|
+
} from "./src/mention.js";
|
|
45
|
+
export { feishuPlugin } from "./src/channel.js";
|
|
46
|
+
|
|
47
|
+
const plugin = {
|
|
48
|
+
id: "feishu",
|
|
49
|
+
name: "Feishu",
|
|
50
|
+
description: "Feishu/Lark channel plugin",
|
|
51
|
+
configSchema: emptyPluginConfigSchema(),
|
|
52
|
+
register(api: PoolBotPluginApi) {
|
|
53
|
+
setFeishuRuntime(api.runtime);
|
|
54
|
+
api.registerChannel({ plugin: feishuPlugin });
|
|
55
|
+
registerFeishuDocTools(api);
|
|
56
|
+
registerFeishuWikiTools(api);
|
|
57
|
+
registerFeishuDriveTools(api);
|
|
58
|
+
registerFeishuPermTools(api);
|
|
59
|
+
registerFeishuBitableTools(api);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default plugin;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ClawdbotConfig } from "poolbot/plugin-sdk";
|
|
2
|
+
import { createAccountListHelpers } from "poolbot/plugin-sdk";
|
|
3
|
+
import { normalizeAccountId } from "poolbot/plugin-sdk/account-id";
|
|
4
|
+
import type {
|
|
5
|
+
FeishuConfig,
|
|
6
|
+
FeishuAccountConfig,
|
|
7
|
+
FeishuDomain,
|
|
8
|
+
ResolvedFeishuAccount,
|
|
9
|
+
} from "./types.js";
|
|
10
|
+
|
|
11
|
+
const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("feishu");
|
|
12
|
+
export const listFeishuAccountIds = listAccountIds;
|
|
13
|
+
export const resolveDefaultFeishuAccountId = resolveDefaultAccountId;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get the raw account-specific config.
|
|
17
|
+
*/
|
|
18
|
+
function resolveAccountConfig(
|
|
19
|
+
cfg: ClawdbotConfig,
|
|
20
|
+
accountId: string,
|
|
21
|
+
): FeishuAccountConfig | undefined {
|
|
22
|
+
const accounts = (cfg.channels?.feishu as FeishuConfig)?.accounts;
|
|
23
|
+
if (!accounts || typeof accounts !== "object") {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return accounts[accountId];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Merge top-level config with account-specific config.
|
|
31
|
+
* Account-specific fields override top-level fields.
|
|
32
|
+
*/
|
|
33
|
+
function mergeFeishuAccountConfig(cfg: ClawdbotConfig, accountId: string): FeishuConfig {
|
|
34
|
+
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
|
|
35
|
+
|
|
36
|
+
// Extract base config (exclude accounts field to avoid recursion)
|
|
37
|
+
const { accounts: _ignored, ...base } = feishuCfg ?? {};
|
|
38
|
+
|
|
39
|
+
// Get account-specific overrides
|
|
40
|
+
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
41
|
+
|
|
42
|
+
// Merge: account config overrides base config
|
|
43
|
+
return { ...base, ...account } as FeishuConfig;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Resolve Feishu credentials from a config.
|
|
48
|
+
*/
|
|
49
|
+
export function resolveFeishuCredentials(cfg?: FeishuConfig): {
|
|
50
|
+
appId: string;
|
|
51
|
+
appSecret: string;
|
|
52
|
+
encryptKey?: string;
|
|
53
|
+
verificationToken?: string;
|
|
54
|
+
domain: FeishuDomain;
|
|
55
|
+
} | null {
|
|
56
|
+
const appId = cfg?.appId?.trim();
|
|
57
|
+
const appSecret = cfg?.appSecret?.trim();
|
|
58
|
+
if (!appId || !appSecret) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
appId,
|
|
63
|
+
appSecret,
|
|
64
|
+
encryptKey: cfg?.encryptKey?.trim() || undefined,
|
|
65
|
+
verificationToken: cfg?.verificationToken?.trim() || undefined,
|
|
66
|
+
domain: cfg?.domain ?? "feishu",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolve a complete Feishu account with merged config.
|
|
72
|
+
*/
|
|
73
|
+
export function resolveFeishuAccount(params: {
|
|
74
|
+
cfg: ClawdbotConfig;
|
|
75
|
+
accountId?: string | null;
|
|
76
|
+
}): ResolvedFeishuAccount {
|
|
77
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
78
|
+
const feishuCfg = params.cfg.channels?.feishu as FeishuConfig | undefined;
|
|
79
|
+
|
|
80
|
+
// Base enabled state (top-level)
|
|
81
|
+
const baseEnabled = feishuCfg?.enabled !== false;
|
|
82
|
+
|
|
83
|
+
// Merge configs
|
|
84
|
+
const merged = mergeFeishuAccountConfig(params.cfg, accountId);
|
|
85
|
+
|
|
86
|
+
// Account-level enabled state
|
|
87
|
+
const accountEnabled = merged.enabled !== false;
|
|
88
|
+
const enabled = baseEnabled && accountEnabled;
|
|
89
|
+
|
|
90
|
+
// Resolve credentials from merged config
|
|
91
|
+
const creds = resolveFeishuCredentials(merged);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
accountId,
|
|
95
|
+
enabled,
|
|
96
|
+
configured: Boolean(creds),
|
|
97
|
+
name: (merged as FeishuAccountConfig).name?.trim() || undefined,
|
|
98
|
+
appId: creds?.appId,
|
|
99
|
+
appSecret: creds?.appSecret,
|
|
100
|
+
encryptKey: creds?.encryptKey,
|
|
101
|
+
verificationToken: creds?.verificationToken,
|
|
102
|
+
domain: creds?.domain ?? "feishu",
|
|
103
|
+
config: merged,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* List all enabled and configured accounts.
|
|
109
|
+
*/
|
|
110
|
+
export function listEnabledFeishuAccounts(cfg: ClawdbotConfig): ResolvedFeishuAccount[] {
|
|
111
|
+
return listFeishuAccountIds(cfg)
|
|
112
|
+
.map((accountId) => resolveFeishuAccount({ cfg, accountId }))
|
|
113
|
+
.filter((account) => account.enabled && account.configured);
|
|
114
|
+
}
|