@poolzin/pool-bot 2026.2.17 → 2026.2.19
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 +25 -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/device-pair/poolbot.plugin.json +20 -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/package.json +37 -0
- package/extensions/feishu/poolbot.plugin.json +10 -0
- package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
- package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
- package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
- package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
- package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -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/package.json +14 -0
- package/extensions/irc/poolbot.plugin.json +9 -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/README.md +33 -0
- package/extensions/minimax-portal-auth/index.ts +161 -0
- package/extensions/minimax-portal-auth/oauth.ts +247 -0
- package/extensions/minimax-portal-auth/package.json +15 -0
- package/extensions/minimax-portal-auth/poolbot.plugin.json +9 -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/README.md +82 -0
- package/extensions/openai-codex-auth/index.ts +177 -0
- package/extensions/openai-codex-auth/package.json +15 -0
- package/extensions/openai-codex-auth/poolbot.plugin.json +9 -0
- package/extensions/phone-control/index.ts +421 -0
- package/extensions/phone-control/poolbot.plugin.json +10 -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/talk-voice/poolbot.plugin.json +10 -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/thread-ownership/poolbot.plugin.json +28 -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,268 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "poolbot/plugin-sdk/account-id";
|
|
3
|
+
import type { CoreConfig, IrcAccountConfig, IrcNickServConfig } from "./types.js";
|
|
4
|
+
|
|
5
|
+
const TRUTHY_ENV = new Set(["true", "1", "yes", "on"]);
|
|
6
|
+
|
|
7
|
+
export type ResolvedIrcAccount = {
|
|
8
|
+
accountId: string;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
configured: boolean;
|
|
12
|
+
host: string;
|
|
13
|
+
port: number;
|
|
14
|
+
tls: boolean;
|
|
15
|
+
nick: string;
|
|
16
|
+
username: string;
|
|
17
|
+
realname: string;
|
|
18
|
+
password: string;
|
|
19
|
+
passwordSource: "env" | "passwordFile" | "config" | "none";
|
|
20
|
+
config: IrcAccountConfig;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function parseTruthy(value?: string): boolean {
|
|
24
|
+
if (!value) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return TRUTHY_ENV.has(value.trim().toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseIntEnv(value?: string): number | undefined {
|
|
31
|
+
if (!value?.trim()) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const parsed = Number.parseInt(value.trim(), 10);
|
|
35
|
+
if (!Number.isFinite(parsed) || parsed <= 0 || parsed > 65535) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseListEnv(value?: string): string[] | undefined {
|
|
42
|
+
if (!value?.trim()) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const parsed = value
|
|
46
|
+
.split(/[\n,;]+/g)
|
|
47
|
+
.map((entry) => entry.trim())
|
|
48
|
+
.filter(Boolean);
|
|
49
|
+
return parsed.length > 0 ? parsed : undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function listConfiguredAccountIds(cfg: CoreConfig): string[] {
|
|
53
|
+
const accounts = cfg.channels?.irc?.accounts;
|
|
54
|
+
if (!accounts || typeof accounts !== "object") {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const ids = new Set<string>();
|
|
58
|
+
for (const key of Object.keys(accounts)) {
|
|
59
|
+
if (key.trim()) {
|
|
60
|
+
ids.add(normalizeAccountId(key));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return [...ids];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function resolveAccountConfig(cfg: CoreConfig, accountId: string): IrcAccountConfig | undefined {
|
|
67
|
+
const accounts = cfg.channels?.irc?.accounts;
|
|
68
|
+
if (!accounts || typeof accounts !== "object") {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const direct = accounts[accountId] as IrcAccountConfig | undefined;
|
|
72
|
+
if (direct) {
|
|
73
|
+
return direct;
|
|
74
|
+
}
|
|
75
|
+
const normalized = normalizeAccountId(accountId);
|
|
76
|
+
const matchKey = Object.keys(accounts).find((key) => normalizeAccountId(key) === normalized);
|
|
77
|
+
return matchKey ? (accounts[matchKey] as IrcAccountConfig | undefined) : undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function mergeIrcAccountConfig(cfg: CoreConfig, accountId: string): IrcAccountConfig {
|
|
81
|
+
const { accounts: _ignored, ...base } = (cfg.channels?.irc ?? {}) as IrcAccountConfig & {
|
|
82
|
+
accounts?: unknown;
|
|
83
|
+
};
|
|
84
|
+
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
85
|
+
const merged: IrcAccountConfig = { ...base, ...account };
|
|
86
|
+
if (base.nickserv || account.nickserv) {
|
|
87
|
+
merged.nickserv = {
|
|
88
|
+
...base.nickserv,
|
|
89
|
+
...account.nickserv,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return merged;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function resolvePassword(accountId: string, merged: IrcAccountConfig) {
|
|
96
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
97
|
+
const envPassword = process.env.IRC_PASSWORD?.trim();
|
|
98
|
+
if (envPassword) {
|
|
99
|
+
return { password: envPassword, source: "env" as const };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (merged.passwordFile?.trim()) {
|
|
104
|
+
try {
|
|
105
|
+
const filePassword = readFileSync(merged.passwordFile.trim(), "utf-8").trim();
|
|
106
|
+
if (filePassword) {
|
|
107
|
+
return { password: filePassword, source: "passwordFile" as const };
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
// Ignore unreadable files here; status will still surface missing configuration.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const configPassword = merged.password?.trim();
|
|
115
|
+
if (configPassword) {
|
|
116
|
+
return { password: configPassword, source: "config" as const };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return { password: "", source: "none" as const };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function resolveNickServConfig(accountId: string, nickserv?: IrcNickServConfig): IrcNickServConfig {
|
|
123
|
+
const base = nickserv ?? {};
|
|
124
|
+
const envPassword =
|
|
125
|
+
accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_NICKSERV_PASSWORD?.trim() : undefined;
|
|
126
|
+
const envRegisterEmail =
|
|
127
|
+
accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_NICKSERV_REGISTER_EMAIL?.trim() : undefined;
|
|
128
|
+
|
|
129
|
+
const passwordFile = base.passwordFile?.trim();
|
|
130
|
+
let resolvedPassword = base.password?.trim() || envPassword || "";
|
|
131
|
+
if (!resolvedPassword && passwordFile) {
|
|
132
|
+
try {
|
|
133
|
+
resolvedPassword = readFileSync(passwordFile, "utf-8").trim();
|
|
134
|
+
} catch {
|
|
135
|
+
// Ignore unreadable files; monitor/probe status will surface failures.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const merged: IrcNickServConfig = {
|
|
140
|
+
...base,
|
|
141
|
+
service: base.service?.trim() || undefined,
|
|
142
|
+
passwordFile: passwordFile || undefined,
|
|
143
|
+
password: resolvedPassword || undefined,
|
|
144
|
+
registerEmail: base.registerEmail?.trim() || envRegisterEmail || undefined,
|
|
145
|
+
};
|
|
146
|
+
return merged;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function listIrcAccountIds(cfg: CoreConfig): string[] {
|
|
150
|
+
const ids = listConfiguredAccountIds(cfg);
|
|
151
|
+
if (ids.length === 0) {
|
|
152
|
+
return [DEFAULT_ACCOUNT_ID];
|
|
153
|
+
}
|
|
154
|
+
return ids.toSorted((a, b) => a.localeCompare(b));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function resolveDefaultIrcAccountId(cfg: CoreConfig): string {
|
|
158
|
+
const ids = listIrcAccountIds(cfg);
|
|
159
|
+
if (ids.includes(DEFAULT_ACCOUNT_ID)) {
|
|
160
|
+
return DEFAULT_ACCOUNT_ID;
|
|
161
|
+
}
|
|
162
|
+
return ids[0] ?? DEFAULT_ACCOUNT_ID;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function resolveIrcAccount(params: {
|
|
166
|
+
cfg: CoreConfig;
|
|
167
|
+
accountId?: string | null;
|
|
168
|
+
}): ResolvedIrcAccount {
|
|
169
|
+
const hasExplicitAccountId = Boolean(params.accountId?.trim());
|
|
170
|
+
const baseEnabled = params.cfg.channels?.irc?.enabled !== false;
|
|
171
|
+
|
|
172
|
+
const resolve = (accountId: string) => {
|
|
173
|
+
const merged = mergeIrcAccountConfig(params.cfg, accountId);
|
|
174
|
+
const accountEnabled = merged.enabled !== false;
|
|
175
|
+
const enabled = baseEnabled && accountEnabled;
|
|
176
|
+
|
|
177
|
+
const tls =
|
|
178
|
+
typeof merged.tls === "boolean"
|
|
179
|
+
? merged.tls
|
|
180
|
+
: accountId === DEFAULT_ACCOUNT_ID && process.env.IRC_TLS
|
|
181
|
+
? parseTruthy(process.env.IRC_TLS)
|
|
182
|
+
: true;
|
|
183
|
+
|
|
184
|
+
const envPort =
|
|
185
|
+
accountId === DEFAULT_ACCOUNT_ID ? parseIntEnv(process.env.IRC_PORT) : undefined;
|
|
186
|
+
const port = merged.port ?? envPort ?? (tls ? 6697 : 6667);
|
|
187
|
+
const envChannels =
|
|
188
|
+
accountId === DEFAULT_ACCOUNT_ID ? parseListEnv(process.env.IRC_CHANNELS) : undefined;
|
|
189
|
+
|
|
190
|
+
const host = (
|
|
191
|
+
merged.host?.trim() ||
|
|
192
|
+
(accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_HOST?.trim() : "") ||
|
|
193
|
+
""
|
|
194
|
+
).trim();
|
|
195
|
+
const nick = (
|
|
196
|
+
merged.nick?.trim() ||
|
|
197
|
+
(accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_NICK?.trim() : "") ||
|
|
198
|
+
""
|
|
199
|
+
).trim();
|
|
200
|
+
const username = (
|
|
201
|
+
merged.username?.trim() ||
|
|
202
|
+
(accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_USERNAME?.trim() : "") ||
|
|
203
|
+
nick ||
|
|
204
|
+
"poolbot"
|
|
205
|
+
).trim();
|
|
206
|
+
const realname = (
|
|
207
|
+
merged.realname?.trim() ||
|
|
208
|
+
(accountId === DEFAULT_ACCOUNT_ID ? process.env.IRC_REALNAME?.trim() : "") ||
|
|
209
|
+
"OpenClaw"
|
|
210
|
+
).trim();
|
|
211
|
+
|
|
212
|
+
const passwordResolution = resolvePassword(accountId, merged);
|
|
213
|
+
const nickserv = resolveNickServConfig(accountId, merged.nickserv);
|
|
214
|
+
|
|
215
|
+
const config: IrcAccountConfig = {
|
|
216
|
+
...merged,
|
|
217
|
+
channels: merged.channels ?? envChannels,
|
|
218
|
+
tls,
|
|
219
|
+
port,
|
|
220
|
+
host,
|
|
221
|
+
nick,
|
|
222
|
+
username,
|
|
223
|
+
realname,
|
|
224
|
+
nickserv,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
accountId,
|
|
229
|
+
enabled,
|
|
230
|
+
name: merged.name?.trim() || undefined,
|
|
231
|
+
configured: Boolean(host && nick),
|
|
232
|
+
host,
|
|
233
|
+
port,
|
|
234
|
+
tls,
|
|
235
|
+
nick,
|
|
236
|
+
username,
|
|
237
|
+
realname,
|
|
238
|
+
password: passwordResolution.password,
|
|
239
|
+
passwordSource: passwordResolution.source,
|
|
240
|
+
config,
|
|
241
|
+
} satisfies ResolvedIrcAccount;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const normalized = normalizeAccountId(params.accountId);
|
|
245
|
+
const primary = resolve(normalized);
|
|
246
|
+
if (hasExplicitAccountId) {
|
|
247
|
+
return primary;
|
|
248
|
+
}
|
|
249
|
+
if (primary.configured) {
|
|
250
|
+
return primary;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const fallbackId = resolveDefaultIrcAccountId(params.cfg);
|
|
254
|
+
if (fallbackId === primary.accountId) {
|
|
255
|
+
return primary;
|
|
256
|
+
}
|
|
257
|
+
const fallback = resolve(fallbackId);
|
|
258
|
+
if (!fallback.configured) {
|
|
259
|
+
return primary;
|
|
260
|
+
}
|
|
261
|
+
return fallback;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function listEnabledIrcAccounts(cfg: CoreConfig): ResolvedIrcAccount[] {
|
|
265
|
+
return listIrcAccountIds(cfg)
|
|
266
|
+
.map((accountId) => resolveIrcAccount({ cfg, accountId }))
|
|
267
|
+
.filter((account) => account.enabled);
|
|
268
|
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildChannelConfigSchema,
|
|
3
|
+
DEFAULT_ACCOUNT_ID,
|
|
4
|
+
formatPairingApproveHint,
|
|
5
|
+
getChatChannelMeta,
|
|
6
|
+
PAIRING_APPROVED_MESSAGE,
|
|
7
|
+
setAccountEnabledInConfigSection,
|
|
8
|
+
deleteAccountFromConfigSection,
|
|
9
|
+
type ChannelPlugin,
|
|
10
|
+
} from "poolbot/plugin-sdk";
|
|
11
|
+
import {
|
|
12
|
+
listIrcAccountIds,
|
|
13
|
+
resolveDefaultIrcAccountId,
|
|
14
|
+
resolveIrcAccount,
|
|
15
|
+
type ResolvedIrcAccount,
|
|
16
|
+
} from "./accounts.js";
|
|
17
|
+
import { IrcConfigSchema } from "./config-schema.js";
|
|
18
|
+
import { monitorIrcProvider } from "./monitor.js";
|
|
19
|
+
import {
|
|
20
|
+
normalizeIrcMessagingTarget,
|
|
21
|
+
looksLikeIrcTargetId,
|
|
22
|
+
isChannelTarget,
|
|
23
|
+
normalizeIrcAllowEntry,
|
|
24
|
+
} from "./normalize.js";
|
|
25
|
+
import { ircOnboardingAdapter } from "./onboarding.js";
|
|
26
|
+
import { resolveIrcGroupMatch, resolveIrcRequireMention } from "./policy.js";
|
|
27
|
+
import { probeIrc } from "./probe.js";
|
|
28
|
+
import { getIrcRuntime } from "./runtime.js";
|
|
29
|
+
import { sendMessageIrc } from "./send.js";
|
|
30
|
+
import type { CoreConfig, IrcProbe } from "./types.js";
|
|
31
|
+
|
|
32
|
+
const meta = getChatChannelMeta("irc");
|
|
33
|
+
|
|
34
|
+
function normalizePairingTarget(raw: string): string {
|
|
35
|
+
const normalized = normalizeIrcAllowEntry(raw);
|
|
36
|
+
if (!normalized) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
return normalized.split(/[!@]/, 1)[0]?.trim() ?? "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const ircPlugin: ChannelPlugin<ResolvedIrcAccount, IrcProbe> = {
|
|
43
|
+
id: "irc",
|
|
44
|
+
meta: {
|
|
45
|
+
...meta,
|
|
46
|
+
quickstartAllowFrom: true,
|
|
47
|
+
},
|
|
48
|
+
onboarding: ircOnboardingAdapter,
|
|
49
|
+
pairing: {
|
|
50
|
+
idLabel: "ircUser",
|
|
51
|
+
normalizeAllowEntry: (entry) => normalizeIrcAllowEntry(entry),
|
|
52
|
+
notifyApproval: async ({ id }) => {
|
|
53
|
+
const target = normalizePairingTarget(id);
|
|
54
|
+
if (!target) {
|
|
55
|
+
throw new Error(`invalid IRC pairing id: ${id}`);
|
|
56
|
+
}
|
|
57
|
+
await sendMessageIrc(target, PAIRING_APPROVED_MESSAGE);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
capabilities: {
|
|
61
|
+
chatTypes: ["direct", "group"],
|
|
62
|
+
media: true,
|
|
63
|
+
blockStreaming: true,
|
|
64
|
+
},
|
|
65
|
+
reload: { configPrefixes: ["channels.irc"] },
|
|
66
|
+
configSchema: buildChannelConfigSchema(IrcConfigSchema),
|
|
67
|
+
config: {
|
|
68
|
+
listAccountIds: (cfg) => listIrcAccountIds(cfg as CoreConfig),
|
|
69
|
+
resolveAccount: (cfg, accountId) => resolveIrcAccount({ cfg: cfg as CoreConfig, accountId }),
|
|
70
|
+
defaultAccountId: (cfg) => resolveDefaultIrcAccountId(cfg as CoreConfig),
|
|
71
|
+
setAccountEnabled: ({ cfg, accountId, enabled }) =>
|
|
72
|
+
setAccountEnabledInConfigSection({
|
|
73
|
+
cfg: cfg as CoreConfig,
|
|
74
|
+
sectionKey: "irc",
|
|
75
|
+
accountId,
|
|
76
|
+
enabled,
|
|
77
|
+
allowTopLevel: true,
|
|
78
|
+
}),
|
|
79
|
+
deleteAccount: ({ cfg, accountId }) =>
|
|
80
|
+
deleteAccountFromConfigSection({
|
|
81
|
+
cfg: cfg as CoreConfig,
|
|
82
|
+
sectionKey: "irc",
|
|
83
|
+
accountId,
|
|
84
|
+
clearBaseFields: [
|
|
85
|
+
"name",
|
|
86
|
+
"host",
|
|
87
|
+
"port",
|
|
88
|
+
"tls",
|
|
89
|
+
"nick",
|
|
90
|
+
"username",
|
|
91
|
+
"realname",
|
|
92
|
+
"password",
|
|
93
|
+
"passwordFile",
|
|
94
|
+
"channels",
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
isConfigured: (account) => account.configured,
|
|
98
|
+
describeAccount: (account) => ({
|
|
99
|
+
accountId: account.accountId,
|
|
100
|
+
name: account.name,
|
|
101
|
+
enabled: account.enabled,
|
|
102
|
+
configured: account.configured,
|
|
103
|
+
host: account.host,
|
|
104
|
+
port: account.port,
|
|
105
|
+
tls: account.tls,
|
|
106
|
+
nick: account.nick,
|
|
107
|
+
passwordSource: account.passwordSource,
|
|
108
|
+
}),
|
|
109
|
+
resolveAllowFrom: ({ cfg, accountId }) =>
|
|
110
|
+
(resolveIrcAccount({ cfg: cfg as CoreConfig, accountId }).config.allowFrom ?? []).map(
|
|
111
|
+
(entry) => String(entry),
|
|
112
|
+
),
|
|
113
|
+
formatAllowFrom: ({ allowFrom }) =>
|
|
114
|
+
allowFrom.map((entry) => normalizeIrcAllowEntry(String(entry))).filter(Boolean),
|
|
115
|
+
},
|
|
116
|
+
security: {
|
|
117
|
+
resolveDmPolicy: ({ cfg, accountId, account }) => {
|
|
118
|
+
const resolvedAccountId = accountId ?? account.accountId ?? DEFAULT_ACCOUNT_ID;
|
|
119
|
+
const useAccountPath = Boolean(cfg.channels?.irc?.accounts?.[resolvedAccountId]);
|
|
120
|
+
const basePath = useAccountPath
|
|
121
|
+
? `channels.irc.accounts.${resolvedAccountId}.`
|
|
122
|
+
: "channels.irc.";
|
|
123
|
+
return {
|
|
124
|
+
policy: account.config.dmPolicy ?? "pairing",
|
|
125
|
+
allowFrom: account.config.allowFrom ?? [],
|
|
126
|
+
policyPath: `${basePath}dmPolicy`,
|
|
127
|
+
allowFromPath: `${basePath}allowFrom`,
|
|
128
|
+
approveHint: formatPairingApproveHint("irc"),
|
|
129
|
+
normalizeEntry: (raw) => normalizeIrcAllowEntry(raw),
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
collectWarnings: ({ account, cfg }) => {
|
|
133
|
+
const warnings: string[] = [];
|
|
134
|
+
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
135
|
+
const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
|
|
136
|
+
if (groupPolicy === "open") {
|
|
137
|
+
warnings.push(
|
|
138
|
+
'- IRC channels: groupPolicy="open" allows all channels and senders (mention-gated). Prefer channels.irc.groupPolicy="allowlist" with channels.irc.groups.',
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
if (!account.config.tls) {
|
|
142
|
+
warnings.push(
|
|
143
|
+
"- IRC TLS is disabled (channels.irc.tls=false); traffic and credentials are plaintext.",
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (account.config.nickserv?.register) {
|
|
147
|
+
warnings.push(
|
|
148
|
+
'- IRC NickServ registration is enabled (channels.irc.nickserv.register=true); this sends "REGISTER" on every connect. Disable after first successful registration.',
|
|
149
|
+
);
|
|
150
|
+
if (!account.config.nickserv.password?.trim()) {
|
|
151
|
+
warnings.push(
|
|
152
|
+
"- IRC NickServ registration is enabled but no NickServ password is resolved; set channels.irc.nickserv.password, channels.irc.nickserv.passwordFile, or IRC_NICKSERV_PASSWORD.",
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return warnings;
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
groups: {
|
|
160
|
+
resolveRequireMention: ({ cfg, accountId, groupId }) => {
|
|
161
|
+
const account = resolveIrcAccount({ cfg: cfg as CoreConfig, accountId });
|
|
162
|
+
if (!groupId) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
const match = resolveIrcGroupMatch({ groups: account.config.groups, target: groupId });
|
|
166
|
+
return resolveIrcRequireMention({
|
|
167
|
+
groupConfig: match.groupConfig,
|
|
168
|
+
wildcardConfig: match.wildcardConfig,
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
resolveToolPolicy: ({ cfg, accountId, groupId }) => {
|
|
172
|
+
const account = resolveIrcAccount({ cfg: cfg as CoreConfig, accountId });
|
|
173
|
+
if (!groupId) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
const match = resolveIrcGroupMatch({ groups: account.config.groups, target: groupId });
|
|
177
|
+
return match.groupConfig?.tools ?? match.wildcardConfig?.tools;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
messaging: {
|
|
181
|
+
normalizeTarget: normalizeIrcMessagingTarget,
|
|
182
|
+
targetResolver: {
|
|
183
|
+
looksLikeId: looksLikeIrcTargetId,
|
|
184
|
+
hint: "<#channel|nick>",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
resolver: {
|
|
188
|
+
resolveTargets: async ({ inputs, kind }) => {
|
|
189
|
+
return inputs.map((input) => {
|
|
190
|
+
const normalized = normalizeIrcMessagingTarget(input);
|
|
191
|
+
if (!normalized) {
|
|
192
|
+
return {
|
|
193
|
+
input,
|
|
194
|
+
resolved: false,
|
|
195
|
+
note: "invalid IRC target",
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (kind === "group") {
|
|
199
|
+
const groupId = isChannelTarget(normalized) ? normalized : `#${normalized}`;
|
|
200
|
+
return {
|
|
201
|
+
input,
|
|
202
|
+
resolved: true,
|
|
203
|
+
id: groupId,
|
|
204
|
+
name: groupId,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (isChannelTarget(normalized)) {
|
|
208
|
+
return {
|
|
209
|
+
input,
|
|
210
|
+
resolved: false,
|
|
211
|
+
note: "expected user target",
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
input,
|
|
216
|
+
resolved: true,
|
|
217
|
+
id: normalized,
|
|
218
|
+
name: normalized,
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
directory: {
|
|
224
|
+
self: async () => null,
|
|
225
|
+
listPeers: async ({ cfg, accountId, query, limit }) => {
|
|
226
|
+
const account = resolveIrcAccount({ cfg: cfg as CoreConfig, accountId });
|
|
227
|
+
const q = query?.trim().toLowerCase() ?? "";
|
|
228
|
+
const ids = new Set<string>();
|
|
229
|
+
|
|
230
|
+
for (const entry of account.config.allowFrom ?? []) {
|
|
231
|
+
const normalized = normalizePairingTarget(String(entry));
|
|
232
|
+
if (normalized && normalized !== "*") {
|
|
233
|
+
ids.add(normalized);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
for (const entry of account.config.groupAllowFrom ?? []) {
|
|
237
|
+
const normalized = normalizePairingTarget(String(entry));
|
|
238
|
+
if (normalized && normalized !== "*") {
|
|
239
|
+
ids.add(normalized);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
for (const group of Object.values(account.config.groups ?? {})) {
|
|
243
|
+
for (const entry of group.allowFrom ?? []) {
|
|
244
|
+
const normalized = normalizePairingTarget(String(entry));
|
|
245
|
+
if (normalized && normalized !== "*") {
|
|
246
|
+
ids.add(normalized);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return Array.from(ids)
|
|
252
|
+
.filter((id) => (q ? id.includes(q) : true))
|
|
253
|
+
.slice(0, limit && limit > 0 ? limit : undefined)
|
|
254
|
+
.map((id) => ({ kind: "user", id }));
|
|
255
|
+
},
|
|
256
|
+
listGroups: async ({ cfg, accountId, query, limit }) => {
|
|
257
|
+
const account = resolveIrcAccount({ cfg: cfg as CoreConfig, accountId });
|
|
258
|
+
const q = query?.trim().toLowerCase() ?? "";
|
|
259
|
+
const groupIds = new Set<string>();
|
|
260
|
+
|
|
261
|
+
for (const channel of account.config.channels ?? []) {
|
|
262
|
+
const normalized = normalizeIrcMessagingTarget(channel);
|
|
263
|
+
if (normalized && isChannelTarget(normalized)) {
|
|
264
|
+
groupIds.add(normalized);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
for (const group of Object.keys(account.config.groups ?? {})) {
|
|
268
|
+
if (group === "*") {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const normalized = normalizeIrcMessagingTarget(group);
|
|
272
|
+
if (normalized && isChannelTarget(normalized)) {
|
|
273
|
+
groupIds.add(normalized);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return Array.from(groupIds)
|
|
278
|
+
.filter((id) => (q ? id.toLowerCase().includes(q) : true))
|
|
279
|
+
.slice(0, limit && limit > 0 ? limit : undefined)
|
|
280
|
+
.map((id) => ({ kind: "group", id, name: id }));
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
outbound: {
|
|
284
|
+
deliveryMode: "direct",
|
|
285
|
+
chunker: (text, limit) => getIrcRuntime().channel.text.chunkMarkdownText(text, limit),
|
|
286
|
+
chunkerMode: "markdown",
|
|
287
|
+
textChunkLimit: 350,
|
|
288
|
+
sendText: async ({ to, text, accountId, replyToId }) => {
|
|
289
|
+
const result = await sendMessageIrc(to, text, {
|
|
290
|
+
accountId: accountId ?? undefined,
|
|
291
|
+
replyTo: replyToId ?? undefined,
|
|
292
|
+
});
|
|
293
|
+
return { channel: "irc", ...result };
|
|
294
|
+
},
|
|
295
|
+
sendMedia: async ({ to, text, mediaUrl, accountId, replyToId }) => {
|
|
296
|
+
const combined = mediaUrl ? `${text}\n\nAttachment: ${mediaUrl}` : text;
|
|
297
|
+
const result = await sendMessageIrc(to, combined, {
|
|
298
|
+
accountId: accountId ?? undefined,
|
|
299
|
+
replyTo: replyToId ?? undefined,
|
|
300
|
+
});
|
|
301
|
+
return { channel: "irc", ...result };
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
status: {
|
|
305
|
+
defaultRuntime: {
|
|
306
|
+
accountId: DEFAULT_ACCOUNT_ID,
|
|
307
|
+
running: false,
|
|
308
|
+
lastStartAt: null,
|
|
309
|
+
lastStopAt: null,
|
|
310
|
+
lastError: null,
|
|
311
|
+
},
|
|
312
|
+
buildChannelSummary: ({ account, snapshot }) => ({
|
|
313
|
+
configured: snapshot.configured ?? false,
|
|
314
|
+
host: account.host,
|
|
315
|
+
port: snapshot.port,
|
|
316
|
+
tls: account.tls,
|
|
317
|
+
nick: account.nick,
|
|
318
|
+
running: snapshot.running ?? false,
|
|
319
|
+
lastStartAt: snapshot.lastStartAt ?? null,
|
|
320
|
+
lastStopAt: snapshot.lastStopAt ?? null,
|
|
321
|
+
lastError: snapshot.lastError ?? null,
|
|
322
|
+
probe: snapshot.probe,
|
|
323
|
+
lastProbeAt: snapshot.lastProbeAt ?? null,
|
|
324
|
+
}),
|
|
325
|
+
probeAccount: async ({ cfg, account, timeoutMs }) =>
|
|
326
|
+
probeIrc(cfg as CoreConfig, { accountId: account.accountId, timeoutMs }),
|
|
327
|
+
buildAccountSnapshot: ({ account, runtime, probe }) => ({
|
|
328
|
+
accountId: account.accountId,
|
|
329
|
+
name: account.name,
|
|
330
|
+
enabled: account.enabled,
|
|
331
|
+
configured: account.configured,
|
|
332
|
+
host: account.host,
|
|
333
|
+
port: account.port,
|
|
334
|
+
tls: account.tls,
|
|
335
|
+
nick: account.nick,
|
|
336
|
+
passwordSource: account.passwordSource,
|
|
337
|
+
running: runtime?.running ?? false,
|
|
338
|
+
lastStartAt: runtime?.lastStartAt ?? null,
|
|
339
|
+
lastStopAt: runtime?.lastStopAt ?? null,
|
|
340
|
+
lastError: runtime?.lastError ?? null,
|
|
341
|
+
probe,
|
|
342
|
+
lastInboundAt: runtime?.lastInboundAt ?? null,
|
|
343
|
+
lastOutboundAt: runtime?.lastOutboundAt ?? null,
|
|
344
|
+
}),
|
|
345
|
+
},
|
|
346
|
+
gateway: {
|
|
347
|
+
startAccount: async (ctx) => {
|
|
348
|
+
const account = ctx.account;
|
|
349
|
+
if (!account.configured) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`IRC is not configured for account "${account.accountId}" (need host and nick in channels.irc).`,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
ctx.log?.info(
|
|
355
|
+
`[${account.accountId}] starting IRC provider (${account.host}:${account.port}${account.tls ? " tls" : ""})`,
|
|
356
|
+
);
|
|
357
|
+
const { stop } = await monitorIrcProvider({
|
|
358
|
+
accountId: account.accountId,
|
|
359
|
+
config: ctx.cfg as CoreConfig,
|
|
360
|
+
runtime: ctx.runtime,
|
|
361
|
+
abortSignal: ctx.abortSignal,
|
|
362
|
+
statusSink: (patch) => ctx.setStatus({ accountId: ctx.accountId, ...patch }),
|
|
363
|
+
});
|
|
364
|
+
return { stop };
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
};
|