From 62ddc9d9e0d9a167b513dd59845cdf0be47bdf3f Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 20 Mar 2026 18:50:25 +0000 Subject: [PATCH] refactor: consolidate plugin sdk surface --- docs/plugins/architecture.md | 41 +- extensions/bluebubbles/src/actions.test.ts | 2 +- .../bluebubbles/src/attachments.test.ts | 4 +- extensions/bluebubbles/src/channel.ts | 10 +- extensions/bluebubbles/src/media-send.test.ts | 2 +- extensions/bluebubbles/src/monitor.test.ts | 2 +- .../src/monitor.webhook-auth.test.ts | 2 +- .../src/monitor.webhook-route.test.ts | 2 +- extensions/bluebubbles/src/runtime-api.ts | 2 +- extensions/bluebubbles/src/send.test.ts | 4 +- extensions/bluebubbles/src/targets.ts | 2 +- extensions/chutes/index.ts | 2 +- extensions/discord/src/account-inspect.ts | 2 +- .../src/actions/handle-action.guild-admin.ts | 2 +- .../discord/src/actions/handle-action.ts | 4 +- extensions/discord/src/channel-actions.ts | 4 +- extensions/discord/src/channel.test.ts | 8 +- extensions/discord/src/channel.ts | 29 +- extensions/discord/src/config-schema.ts | 2 +- extensions/discord/src/directory-live.ts | 6 +- extensions/discord/src/draft-stream.ts | 2 +- extensions/discord/src/group-policy.ts | 2 +- .../src/monitor/agent-components-helpers.ts | 2 +- .../discord/src/monitor/agent-components.ts | 10 +- extensions/discord/src/monitor/allow-list.ts | 4 +- .../discord/src/monitor/dm-command-auth.ts | 2 +- .../discord/src/monitor/exec-approvals.ts | 7 +- .../discord/src/monitor/inbound-worker.ts | 2 +- .../src/monitor/message-handler.preflight.ts | 19 +- .../message-handler.preflight.types.ts | 2 +- .../src/monitor/message-handler.process.ts | 27 +- .../discord/src/monitor/message-handler.ts | 2 +- .../discord/src/monitor/message-utils.ts | 2 +- .../src/monitor/model-picker.test-utils.ts | 2 +- .../discord/src/monitor/model-picker.ts | 5 +- .../discord/src/monitor/monitor.test.ts | 4 +- .../src/monitor/native-command-context.ts | 2 +- .../discord/src/monitor/native-command-ui.ts | 18 +- .../discord/src/monitor/native-command.ts | 36 +- .../discord/src/monitor/provider.allowlist.ts | 2 +- .../discord/src/monitor/provider.lifecycle.ts | 2 +- extensions/discord/src/monitor/provider.ts | 18 +- .../src/monitor/thread-bindings.config.ts | 4 +- .../src/monitor/thread-bindings.manager.ts | 2 +- .../src/monitor/thread-bindings.messages.ts | 4 +- extensions/discord/src/outbound-adapter.ts | 17 +- extensions/discord/src/probe.ts | 2 +- extensions/discord/src/runtime-api.ts | 12 +- .../discord/src/session-key-normalization.ts | 2 +- extensions/discord/src/setup-account-state.ts | 4 +- extensions/discord/src/status-issues.ts | 10 +- extensions/discord/src/subagent-hooks.test.ts | 2 +- extensions/discord/src/targets.ts | 4 +- extensions/discord/src/token.ts | 4 +- extensions/discord/src/voice/command.ts | 2 +- extensions/feishu/runtime-api.ts | 2 +- extensions/feishu/src/channel.ts | 20 +- extensions/feishu/src/thread-bindings.ts | 6 +- extensions/firecrawl/src/config.ts | 2 +- extensions/google/gemini-cli-provider.ts | 2 +- extensions/googlechat/runtime-api.ts | 2 +- extensions/googlechat/src/channel.ts | 8 +- extensions/imessage/runtime-api.ts | 2 +- extensions/imessage/src/channel.runtime.ts | 2 +- extensions/imessage/src/channel.ts | 9 +- extensions/imessage/src/config-schema.ts | 2 +- .../src/monitor/inbound-processing.ts | 23 +- .../imessage/src/monitor/monitor-provider.ts | 14 +- extensions/imessage/src/outbound-adapter.ts | 6 +- extensions/imessage/src/probe.ts | 2 +- extensions/irc/src/accounts.ts | 2 +- extensions/irc/src/channel.ts | 6 +- extensions/irc/src/runtime-api.ts | 2 +- extensions/irc/src/setup-core.ts | 3 +- extensions/line/runtime-api.ts | 14 +- extensions/line/src/channel.ts | 10 +- extensions/line/src/config-adapter.ts | 2 +- extensions/line/src/group-policy.ts | 5 +- extensions/line/src/setup-core.ts | 4 +- extensions/line/src/setup-surface.ts | 4 +- extensions/matrix/runtime-api.ts | 25 +- .../src/actions.account-propagation.test.ts | 2 +- extensions/matrix/src/actions.test.ts | 2 +- .../matrix/src/channel.directory.test.ts | 2 +- extensions/matrix/src/channel.setup.test.ts | 2 +- extensions/matrix/src/channel.ts | 12 +- extensions/matrix/src/cli.test.ts | 2 +- extensions/matrix/src/matrix/client.test.ts | 2 +- .../matrix/src/matrix/client/storage.test.ts | 2 +- .../src/matrix/monitor/auto-join.test.ts | 18 +- .../matrix/src/matrix/monitor/config.test.ts | 2 +- .../monitor/handler.media-failure.test.ts | 2 +- .../monitor/handler.thread-root-media.test.ts | 2 +- .../matrix/src/matrix/monitor/index.test.ts | 2 +- .../monitor/legacy-crypto-restore.test.ts | 2 +- .../matrix/src/matrix/monitor/media.test.ts | 2 +- .../matrix/src/matrix/monitor/replies.test.ts | 2 +- extensions/matrix/src/matrix/send.test.ts | 2 +- .../src/matrix/thread-bindings-shared.ts | 2 +- .../matrix/src/matrix/thread-bindings.test.ts | 9 +- .../matrix/src/onboarding.resolve.test.ts | 2 +- extensions/matrix/src/onboarding.test.ts | 2 +- extensions/matrix/src/outbound.test.ts | 2 +- extensions/matrix/src/resolve-targets.test.ts | 2 +- extensions/matrix/src/runtime-api.ts | 2 +- extensions/mattermost/runtime-api.ts | 2 +- extensions/mattermost/src/channel.ts | 20 +- extensions/mattermost/src/session-route.ts | 2 +- extensions/mattermost/src/setup-core.ts | 2 +- extensions/minimax/index.ts | 2 +- extensions/minimax/oauth.ts | 5 +- extensions/msteams/runtime-api.ts | 2 +- extensions/msteams/src/channel.ts | 22 +- extensions/msteams/src/outbound.ts | 2 +- extensions/msteams/src/resolve-allowlist.ts | 2 +- extensions/nextcloud-talk/runtime-api.ts | 2 +- extensions/nextcloud-talk/src/channel.ts | 6 +- extensions/nextcloud-talk/src/setup-core.ts | 3 +- .../nextcloud-talk/src/setup-surface.ts | 4 +- extensions/nostr/runtime-api.ts | 2 +- extensions/nostr/src/setup-surface.ts | 2 +- extensions/openai/openai-codex-provider.ts | 2 +- extensions/qwen-portal-auth/runtime-api.ts | 7 +- extensions/shared/passive-monitor.ts | 2 +- extensions/signal/src/channel.ts | 15 +- extensions/signal/src/message-actions.ts | 14 +- extensions/signal/src/monitor.ts | 2 +- .../signal/src/monitor/event-handler.ts | 38 +- .../signal/src/monitor/event-handler.types.ts | 2 +- extensions/signal/src/outbound-adapter.ts | 6 +- extensions/signal/src/probe.ts | 2 +- extensions/signal/src/runtime-api.ts | 2 +- extensions/slack/src/account-inspect.ts | 2 +- extensions/slack/src/channel-actions.ts | 2 +- extensions/slack/src/channel.test.ts | 2 +- extensions/slack/src/channel.ts | 29 +- extensions/slack/src/config-schema.ts | 2 +- extensions/slack/src/directory-live.ts | 6 +- extensions/slack/src/draft-stream.ts | 2 +- extensions/slack/src/group-policy.ts | 2 +- .../slack/src/message-action-dispatch.ts | 4 +- extensions/slack/src/message-actions.ts | 6 +- extensions/slack/src/monitor/allow-list.ts | 2 +- .../slack/src/monitor/channel-config.ts | 2 +- extensions/slack/src/monitor/context.ts | 4 +- extensions/slack/src/monitor/dm-auth.ts | 2 +- .../slack/src/monitor/events/channels.ts | 2 +- .../slack/src/monitor/message-handler.ts | 2 +- .../src/monitor/message-handler/dispatch.ts | 9 +- .../message-handler/prepare-thread-context.ts | 4 +- .../src/monitor/message-handler/prepare.ts | 29 +- extensions/slack/src/monitor/provider.ts | 6 +- .../src/monitor/slash-commands.runtime.ts | 12 +- .../src/monitor/slash-dispatch.runtime.ts | 8 +- .../monitor/slash-skill-commands.runtime.ts | 4 +- .../slack/src/monitor/slash.test-harness.ts | 8 +- extensions/slack/src/monitor/slash.ts | 8 +- extensions/slack/src/outbound-adapter.ts | 15 +- extensions/slack/src/probe.ts | 2 +- extensions/slack/src/runtime-api.ts | 4 +- extensions/slack/src/targets.ts | 2 +- .../slack/src/threading-tool-context.ts | 2 +- extensions/slack/src/token.ts | 2 +- extensions/synology-chat/src/channel.ts | 8 +- extensions/tavily/src/config.ts | 2 +- extensions/telegram/runtime-api.ts | 6 +- extensions/telegram/src/account-inspect.ts | 10 +- extensions/telegram/src/action-runtime.ts | 2 +- extensions/telegram/src/bot-access.ts | 4 +- extensions/telegram/src/bot-deps.ts | 10 +- .../telegram/src/bot-handlers.buffers.ts | 6 +- .../telegram/src/bot-handlers.runtime.ts | 22 +- .../telegram/src/bot-message-context.body.ts | 18 +- ...t-message-context.named-account-dm.test.ts | 4 +- .../src/bot-message-context.session.ts | 19 +- .../telegram/src/bot-message-context.ts | 6 +- .../telegram/src/bot-message-context.types.ts | 2 +- .../telegram/src/bot-message-dispatch.ts | 9 +- .../bot-native-commands.menu-test-support.ts | 4 +- .../bot-native-commands.session-meta.test.ts | 35 +- .../src/bot-native-commands.test-helpers.ts | 14 +- .../telegram/src/bot-native-commands.test.ts | 4 +- .../telegram/src/bot-native-commands.ts | 32 +- .../bot.create-telegram-bot.test-harness.ts | 20 +- extensions/telegram/src/bot.ts | 12 +- extensions/telegram/src/bot/helpers.ts | 2 +- extensions/telegram/src/channel-actions.ts | 14 +- extensions/telegram/src/channel.test.ts | 8 +- extensions/telegram/src/channel.ts | 25 +- extensions/telegram/src/config-schema.ts | 2 +- extensions/telegram/src/draft-stream.ts | 2 +- extensions/telegram/src/group-policy.ts | 2 +- extensions/telegram/src/outbound-adapter.ts | 12 +- extensions/telegram/src/probe.ts | 2 +- extensions/telegram/src/status-issues.ts | 10 +- .../telegram/src/status-reaction-variants.ts | 2 +- extensions/telegram/src/thread-bindings.ts | 6 +- extensions/telegram/src/token.ts | 4 +- extensions/tlon/runtime-api.ts | 2 +- extensions/tlon/src/channel.runtime.ts | 6 +- extensions/tlon/src/channel.ts | 8 +- extensions/twitch/runtime-api.ts | 2 +- extensions/voice-call/runtime-api.ts | 2 +- extensions/whatsapp/api.ts | 2 +- extensions/whatsapp/src/agent-tools-login.ts | 4 +- .../src/auto-reply/heartbeat-runner.ts | 2 +- .../whatsapp/src/auto-reply/mentions.ts | 2 +- extensions/whatsapp/src/auto-reply/monitor.ts | 6 +- .../src/auto-reply/monitor/ack-reaction.ts | 2 +- .../src/auto-reply/monitor/group-gating.ts | 6 +- .../src/auto-reply/monitor/message-line.ts | 4 +- .../src/auto-reply/monitor/process-message.ts | 18 +- .../whatsapp/src/channel.directory.test.ts | 2 +- extensions/whatsapp/src/config-schema.ts | 2 +- extensions/whatsapp/src/inbound/extract.ts | 2 +- extensions/whatsapp/src/inbound/monitor.ts | 3 +- extensions/whatsapp/src/inbound/types.ts | 2 +- extensions/whatsapp/src/normalize.ts | 2 +- extensions/whatsapp/src/outbound-adapter.ts | 10 +- .../whatsapp/src/resolve-target.test.ts | 12 +- extensions/whatsapp/src/runtime-api.ts | 11 +- extensions/whatsapp/src/shared.ts | 14 +- extensions/whatsapp/src/status-issues.ts | 12 +- extensions/zalo/runtime-api.ts | 2 +- extensions/zalo/src/channel.ts | 6 +- extensions/zalouser/runtime-api.ts | 2 +- extensions/zalouser/src/channel.ts | 10 +- package.json | 156 ++---- scripts/lib/plugin-sdk-entrypoints.json | 39 +- src/agents/pi-embedded-runner/compact.ts | 2 +- src/agents/pi-embedded-runner/run/attempt.ts | 2 +- src/agents/tools/message-tool.test.ts | 2 +- src/auto-reply/reply/commands-approve.ts | 2 +- src/auto-reply/reply/commands-models.ts | 2 +- .../reply/directive-handling.model.ts | 2 +- src/auto-reply/templating.ts | 2 +- .../plugins/outbound/direct-text-media.ts | 119 +---- ...ad-only-account-inspect.discord.runtime.ts | 6 +- ...read-only-account-inspect.slack.runtime.ts | 6 +- ...d-only-account-inspect.telegram.runtime.ts | 7 +- src/cli/send-runtime/discord.ts | 4 +- src/cli/send-runtime/slack.ts | 4 +- src/cli/send-runtime/telegram.ts | 4 +- src/commands/doctor-config-flow.ts | 2 +- src/config/plugin-auto-enable.ts | 2 +- src/config/schema.help.ts | 2 +- src/cron/isolated-agent/delivery-target.ts | 2 +- src/gateway/server-http.ts | 2 +- src/infra/state-migrations.ts | 2 +- src/plugin-sdk/allow-from.ts | 62 +++ src/plugin-sdk/allowlist-resolution.test.ts | 2 +- src/plugin-sdk/allowlist-resolution.ts | 32 -- ...sage-tool-schema.ts => channel-actions.ts} | 5 + src/plugin-sdk/channel-config-helpers.ts | 17 + src/plugin-sdk/channel-contract.ts | 16 + src/plugin-sdk/channel-feedback.ts | 21 + src/plugin-sdk/channel-inbound.ts | 34 ++ src/plugin-sdk/channel-lifecycle.ts | 8 + src/plugin-sdk/channel-pairing.ts | 5 + src/plugin-sdk/channel-runtime.ts | 67 +-- src/plugin-sdk/channel-send-result.ts | 2 + src/plugin-sdk/channel-setup.ts | 2 + src/plugin-sdk/channel-targets.ts | 29 ++ src/plugin-sdk/command-auth.ts | 77 +++ src/plugin-sdk/compat.ts | 2 +- src/plugin-sdk/config-runtime.ts | 90 +++- src/plugin-sdk/conversation-runtime.ts | 30 ++ src/plugin-sdk/core.ts | 2 - src/plugin-sdk/directory-runtime.ts | 11 + src/plugin-sdk/extension-shared.ts | 2 +- src/plugin-sdk/infra-runtime.ts | 2 + src/plugin-sdk/line.ts | 1 - src/plugin-sdk/matrix.ts | 179 ++++++- src/plugin-sdk/media-runtime.ts | 6 + src/plugin-sdk/provider-auth.ts | 2 + src/plugin-sdk/provider-oauth.ts | 4 - src/plugin-sdk/reply-payload.ts | 110 ++++ src/plugin-sdk/reply-runtime.ts | 72 ++- src/plugin-sdk/routing.ts | 3 + src/plugin-sdk/runtime-api-guardrails.test.ts | 20 +- src/plugin-sdk/status-helpers.ts | 8 + src/plugin-sdk/subpaths.test.ts | 470 +++++++++++++++--- src/plugin-sdk/tool-send.ts | 2 + .../loader.git-path-regression.test.ts | 8 +- src/plugins/loader.test.ts | 6 +- .../runtime/runtime-discord-ops.runtime.ts | 14 +- src/plugins/runtime/runtime-discord.ts | 4 +- src/plugins/runtime/runtime-imessage.ts | 2 +- src/plugins/runtime/runtime-matrix.ts | 2 +- .../runtime/runtime-slack-ops.runtime.ts | 14 +- .../runtime/runtime-telegram-ops.runtime.ts | 10 +- src/plugins/runtime/runtime-telegram.ts | 8 +- src/security/audit-channel.runtime.ts | 2 +- .../discord-provider.test-support.ts | 14 +- 294 files changed, 2071 insertions(+), 1268 deletions(-) delete mode 100644 src/plugin-sdk/allowlist-resolution.ts rename src/plugin-sdk/{message-tool-schema.ts => channel-actions.ts} (78%) create mode 100644 src/plugin-sdk/channel-contract.ts create mode 100644 src/plugin-sdk/channel-feedback.ts create mode 100644 src/plugin-sdk/channel-inbound.ts create mode 100644 src/plugin-sdk/channel-targets.ts delete mode 100644 src/plugin-sdk/provider-oauth.ts diff --git a/docs/plugins/architecture.md b/docs/plugins/architecture.md index 90070dae177..49aa6344ca9 100644 --- a/docs/plugins/architecture.md +++ b/docs/plugins/architecture.md @@ -933,25 +933,31 @@ authoring plugins: - `openclaw/plugin-sdk/core` for the generic shared plugin-facing contract. - Stable channel primitives such as `openclaw/plugin-sdk/channel-setup`, `openclaw/plugin-sdk/channel-pairing`, + `openclaw/plugin-sdk/channel-contract`, + `openclaw/plugin-sdk/channel-feedback`, + `openclaw/plugin-sdk/channel-inbound`, + `openclaw/plugin-sdk/channel-lifecycle`, `openclaw/plugin-sdk/channel-reply-pipeline`, + `openclaw/plugin-sdk/command-auth`, `openclaw/plugin-sdk/secret-input`, and `openclaw/plugin-sdk/webhook-ingress` for shared setup/auth/reply/webhook - wiring. + wiring. `channel-inbound` is the shared home for debounce, mention matching, + envelope formatting, and inbound envelope context helpers. - Domain subpaths such as `openclaw/plugin-sdk/channel-config-helpers`, + `openclaw/plugin-sdk/allow-from`, `openclaw/plugin-sdk/channel-config-schema`, `openclaw/plugin-sdk/channel-policy`, - `openclaw/plugin-sdk/channel-runtime`, `openclaw/plugin-sdk/config-runtime`, + `openclaw/plugin-sdk/infra-runtime`, `openclaw/plugin-sdk/agent-runtime`, `openclaw/plugin-sdk/lazy-runtime`, `openclaw/plugin-sdk/reply-history`, `openclaw/plugin-sdk/routing`, + `openclaw/plugin-sdk/status-helpers`, `openclaw/plugin-sdk/runtime-store`, and `openclaw/plugin-sdk/directory-runtime` for shared runtime/config helpers. -- Narrow channel-core subpaths such as `openclaw/plugin-sdk/discord-core`, - `openclaw/plugin-sdk/telegram-core`, and `openclaw/plugin-sdk/whatsapp-core` - for channel-specific primitives that should stay smaller than the full - channel helper barrels. +- `openclaw/plugin-sdk/channel-runtime` remains only as a compatibility shim. + New code should import the narrower primitives instead. - Bundled extension internals remain private. External plugins should use only `openclaw/plugin-sdk/*` subpaths. OpenClaw core/test code may use the repo public entry points under `extensions//index.js`, `api.js`, `runtime-api.js`, @@ -962,26 +968,25 @@ authoring plugins: `extensions//runtime-api.js` is the runtime-only barrel, `extensions//index.js` is the bundled plugin entry, and `extensions//setup-entry.js` is the setup plugin entry. -- `openclaw/plugin-sdk/telegram` for Telegram channel plugin types and shared channel-facing helpers. Built-in Telegram implementation internals stay private to the bundled extension. -- `openclaw/plugin-sdk/discord` for Discord channel plugin types and shared channel-facing helpers. Built-in Discord implementation internals stay private to the bundled extension. -- `openclaw/plugin-sdk/slack` for Slack channel plugin types and shared channel-facing helpers. Built-in Slack implementation internals stay private to the bundled extension. -- `openclaw/plugin-sdk/imessage` for iMessage channel plugin types and shared channel-facing helpers. Built-in iMessage implementation internals stay private to the bundled extension. -- `openclaw/plugin-sdk/whatsapp` for WhatsApp channel plugin types and shared channel-facing helpers. Built-in WhatsApp implementation internals stay private to the bundled extension. -- `openclaw/plugin-sdk/bluebubbles` remains public because it carries a small - focused helper surface that is shared intentionally. +- No bundled channel-branded public subpaths remain. Channel-specific helper and + runtime seams live under `extensions//api.js` and `extensions//runtime-api.js`; + the public SDK contract is the generic shared primitives instead. Compatibility note: - Avoid the root `openclaw/plugin-sdk` barrel for new code. - Prefer the narrow stable primitives first. The newer setup/pairing/reply/ - secret-input/webhook subpaths are the intended contract for new bundled and - external plugin work. + feedback/contract/inbound/threading/command/secret-input/webhook/infra/ + allowlist/status/message-tool subpaths are the intended contract for new + bundled and external plugin work. + Target parsing/matching belongs on `openclaw/plugin-sdk/channel-targets`. + Message action gates and reaction message-id helpers belong on + `openclaw/plugin-sdk/channel-actions`. - Bundled extension-specific helper barrels are not stable by default. If a helper is only needed by a bundled extension, keep it behind the extension's local `api.js` or `runtime-api.js` seam instead of promoting it into `openclaw/plugin-sdk/`. -- Channel-branded bundled bars such as `feishu`, `googlechat`, `irc`, `line`, - `nostr`, `twitch`, and `zalo` stay private unless they are explicitly added +- Channel-branded bundled bars stay private unless they are explicitly added back to the public contract. - Capability-specific subpaths such as `image-generation`, `media-understanding`, and `speech` exist because bundled/native plugins use @@ -994,7 +999,7 @@ Plugins should own channel-specific `describeMessageTool(...)` schema contributions. Keep provider-specific fields in the plugin, not in shared core. For shared portable schema fragments, reuse the generic helpers exported through -`openclaw/plugin-sdk/channel-runtime`: +`openclaw/plugin-sdk/channel-actions`: - `createMessageToolButtonsSchema()` for button-grid style payloads - `createMessageToolCardSchema()` for structured card payloads diff --git a/extensions/bluebubbles/src/actions.test.ts b/extensions/bluebubbles/src/actions.test.ts index 02cda25b5bc..677e1ae9703 100644 --- a/extensions/bluebubbles/src/actions.test.ts +++ b/extensions/bluebubbles/src/actions.test.ts @@ -1,4 +1,3 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles"; import { describe, expect, it, vi, beforeEach } from "vitest"; import { bluebubblesMessageActions } from "./actions.js"; import { sendBlueBubblesAttachment } from "./attachments.js"; @@ -6,6 +5,7 @@ import { editBlueBubblesMessage, setGroupIconBlueBubbles } from "./chat.js"; import { resolveBlueBubblesMessageId } from "./monitor.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; import { sendBlueBubblesReaction } from "./reactions.js"; +import type { OpenClawConfig } from "./runtime-api.js"; import { resolveChatGuidForTarget, sendMessageBlueBubbles } from "./send.js"; vi.mock("./accounts.js", async () => { diff --git a/extensions/bluebubbles/src/attachments.test.ts b/extensions/bluebubbles/src/attachments.test.ts index cb40ca810e3..0b5ee8bbf02 100644 --- a/extensions/bluebubbles/src/attachments.test.ts +++ b/extensions/bluebubbles/src/attachments.test.ts @@ -1,8 +1,8 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/bluebubbles"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import "./test-mocks.js"; import { downloadBlueBubblesAttachment, sendBlueBubblesAttachment } from "./attachments.js"; +import "./test-mocks.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; +import type { PluginRuntime } from "./runtime-api.js"; import { setBlueBubblesRuntime } from "./runtime.js"; import { BLUE_BUBBLES_PRIVATE_API_STATUS, diff --git a/extensions/bluebubbles/src/channel.ts b/extensions/bluebubbles/src/channel.ts index 4d4b411a639..5719b12e22b 100644 --- a/extensions/bluebubbles/src/channel.ts +++ b/extensions/bluebubbles/src/channel.ts @@ -4,15 +4,15 @@ import { createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createOpenGroupPolicyRestrictSendersWarningCollector, projectWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; -import { - createAttachedChannelResultAdapter, - createPairingPrefixStripper, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; import { listBlueBubblesAccountIds, diff --git a/extensions/bluebubbles/src/media-send.test.ts b/extensions/bluebubbles/src/media-send.test.ts index 59fe82cbeae..ad1523c7863 100644 --- a/extensions/bluebubbles/src/media-send.test.ts +++ b/extensions/bluebubbles/src/media-send.test.ts @@ -2,9 +2,9 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import { pathToFileURL } from "node:url"; -import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { sendBlueBubblesMedia } from "./media-send.js"; +import type { OpenClawConfig, PluginRuntime } from "./runtime-api.js"; import { setBlueBubblesRuntime } from "./runtime.js"; const sendBlueBubblesAttachmentMock = vi.hoisted(() => vi.fn()); diff --git a/extensions/bluebubbles/src/monitor.test.ts b/extensions/bluebubbles/src/monitor.test.ts index 17467465d82..5ff26e2dc96 100644 --- a/extensions/bluebubbles/src/monitor.test.ts +++ b/extensions/bluebubbles/src/monitor.test.ts @@ -1,6 +1,5 @@ import { EventEmitter } from "node:events"; import type { IncomingMessage, ServerResponse } from "node:http"; -import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createPluginRuntimeMock } from "../../../test/helpers/extensions/plugin-runtime-mock.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js"; @@ -12,6 +11,7 @@ import { resolveBlueBubblesMessageId, _resetBlueBubblesShortIdState, } from "./monitor.js"; +import type { OpenClawConfig, PluginRuntime } from "./runtime-api.js"; import { setBlueBubblesRuntime } from "./runtime.js"; // Mock dependencies diff --git a/extensions/bluebubbles/src/monitor.webhook-auth.test.ts b/extensions/bluebubbles/src/monitor.webhook-auth.test.ts index 8d98b0c45eb..aacbb437841 100644 --- a/extensions/bluebubbles/src/monitor.webhook-auth.test.ts +++ b/extensions/bluebubbles/src/monitor.webhook-auth.test.ts @@ -1,6 +1,5 @@ import { EventEmitter } from "node:events"; import type { IncomingMessage, ServerResponse } from "node:http"; -import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { createPluginRuntimeMock } from "../../../test/helpers/extensions/plugin-runtime-mock.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js"; @@ -11,6 +10,7 @@ import { resolveBlueBubblesMessageId, _resetBlueBubblesShortIdState, } from "./monitor.js"; +import type { OpenClawConfig, PluginRuntime } from "./runtime-api.js"; import { setBlueBubblesRuntime } from "./runtime.js"; // Mock dependencies diff --git a/extensions/bluebubbles/src/monitor.webhook-route.test.ts b/extensions/bluebubbles/src/monitor.webhook-route.test.ts index fc48606b8ed..cb30d9edb01 100644 --- a/extensions/bluebubbles/src/monitor.webhook-route.test.ts +++ b/extensions/bluebubbles/src/monitor.webhook-route.test.ts @@ -1,9 +1,9 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles"; import { afterEach, describe, expect, it } from "vitest"; import { createEmptyPluginRegistry } from "../../../src/plugins/registry.js"; import { setActivePluginRegistry } from "../../../src/plugins/runtime.js"; import type { WebhookTarget } from "./monitor-shared.js"; import { registerBlueBubblesWebhookTarget } from "./monitor.js"; +import type { OpenClawConfig } from "./runtime-api.js"; function createTarget(): WebhookTarget { return { diff --git a/extensions/bluebubbles/src/runtime-api.ts b/extensions/bluebubbles/src/runtime-api.ts index 23c09660d96..4faebbed877 100644 --- a/extensions/bluebubbles/src/runtime-api.ts +++ b/extensions/bluebubbles/src/runtime-api.ts @@ -1 +1 @@ -export * from "openclaw/plugin-sdk/bluebubbles"; +export * from "../../../src/plugin-sdk/bluebubbles.js"; diff --git a/extensions/bluebubbles/src/send.test.ts b/extensions/bluebubbles/src/send.test.ts index ecb8b1f68e0..7d79f475a56 100644 --- a/extensions/bluebubbles/src/send.test.ts +++ b/extensions/bluebubbles/src/send.test.ts @@ -1,7 +1,7 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/bluebubbles"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import "./test-mocks.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; +import "./test-mocks.js"; +import type { PluginRuntime } from "./runtime-api.js"; import { clearBlueBubblesRuntime, setBlueBubblesRuntime } from "./runtime.js"; import { sendMessageBlueBubbles, resolveChatGuidForTarget, createChatForHandle } from "./send.js"; import { diff --git a/extensions/bluebubbles/src/targets.ts b/extensions/bluebubbles/src/targets.ts index 605c5cecc76..833ac88522e 100644 --- a/extensions/bluebubbles/src/targets.ts +++ b/extensions/bluebubbles/src/targets.ts @@ -5,7 +5,7 @@ import { type ParsedChatTarget, resolveServicePrefixedAllowTarget, resolveServicePrefixedTarget, -} from "openclaw/plugin-sdk/imessage-core"; +} from "../../imessage/api.js"; export type BlueBubblesService = "imessage" | "sms" | "auto"; diff --git a/extensions/chutes/index.ts b/extensions/chutes/index.ts index 89a2fc4a6fe..de70c603e23 100644 --- a/extensions/chutes/index.ts +++ b/extensions/chutes/index.ts @@ -5,8 +5,8 @@ import { type ProviderAuthContext, type ProviderAuthResult, } from "openclaw/plugin-sdk/provider-auth"; +import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth"; import { loginChutes } from "openclaw/plugin-sdk/provider-auth-login"; -import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-oauth"; import { CHUTES_DEFAULT_MODEL_REF, applyChutesApiKeyConfig, diff --git a/extensions/discord/src/account-inspect.ts b/extensions/discord/src/account-inspect.ts index 7e0a28ec7fd..994245461ed 100644 --- a/extensions/discord/src/account-inspect.ts +++ b/extensions/discord/src/account-inspect.ts @@ -2,7 +2,7 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/acco import { hasConfiguredSecretInput, normalizeSecretInputString, -} from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/secret-input"; import { mergeDiscordAccountConfig, resolveDefaultDiscordAccountId, diff --git a/extensions/discord/src/actions/handle-action.guild-admin.ts b/extensions/discord/src/actions/handle-action.guild-admin.ts index e63d00f23ec..fcb3cf530b6 100644 --- a/extensions/discord/src/actions/handle-action.guild-admin.ts +++ b/extensions/discord/src/actions/handle-action.guild-admin.ts @@ -5,7 +5,7 @@ import { readStringArrayParam, readStringParam, } from "openclaw/plugin-sdk/agent-runtime"; -import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-contract"; import { handleDiscordAction } from "./runtime.js"; import { isDiscordModerationAction, diff --git a/extensions/discord/src/actions/handle-action.ts b/extensions/discord/src/actions/handle-action.ts index 9726b07cdda..e0f91daa668 100644 --- a/extensions/discord/src/actions/handle-action.ts +++ b/extensions/discord/src/actions/handle-action.ts @@ -5,8 +5,8 @@ import { readStringParam, } from "openclaw/plugin-sdk/agent-runtime"; import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param"; -import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions"; +import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-contract"; import { normalizeInteractiveReply } from "openclaw/plugin-sdk/interactive-runtime"; import { buildDiscordInteractiveComponents } from "../shared-interactive.js"; import { resolveDiscordChannelId } from "../targets.js"; diff --git a/extensions/discord/src/channel-actions.ts b/extensions/discord/src/channel-actions.ts index 1c6b9b5c70f..51fb193b58e 100644 --- a/extensions/discord/src/channel-actions.ts +++ b/extensions/discord/src/channel-actions.ts @@ -1,12 +1,12 @@ import { createUnionActionGate, listTokenSourcedAccounts, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-actions"; import type { ChannelMessageActionAdapter, ChannelMessageActionName, ChannelMessageToolDiscovery, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-contract"; import type { DiscordActionConfig } from "openclaw/plugin-sdk/config-runtime"; import { createDiscordActionGate, listEnabledDiscordAccounts } from "./accounts.js"; import { handleDiscordMessageAction } from "./actions/handle-action.js"; diff --git a/extensions/discord/src/channel.test.ts b/extensions/discord/src/channel.test.ts index b5f2224b1dd..152223f12a9 100644 --- a/extensions/discord/src/channel.test.ts +++ b/extensions/discord/src/channel.test.ts @@ -1,13 +1,13 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; import type { ChannelAccountSnapshot, ChannelGatewayContext, - OpenClawConfig, - PluginRuntime, -} from "openclaw/plugin-sdk/discord"; -import { afterEach, describe, expect, it, vi } from "vitest"; +} from "../../../src/channels/plugins/types.js"; +import type { PluginRuntime } from "../../../src/plugins/runtime/types.js"; import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js"; import type { ResolvedDiscordAccount } from "./accounts.js"; import { discordPlugin } from "./channel.js"; +import type { OpenClawConfig } from "./runtime-api.js"; import { setDiscordRuntime } from "./runtime.js"; const probeDiscordMock = vi.hoisted(() => vi.fn()); diff --git a/extensions/discord/src/channel.ts b/extensions/discord/src/channel.ts index 0ddb5c9e19f..63f11ede836 100644 --- a/extensions/discord/src/channel.ts +++ b/extensions/discord/src/channel.ts @@ -5,20 +5,29 @@ import { createNestedAllowlistOverrideResolver, } from "openclaw/plugin-sdk/allowlist-config-edit"; import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; -import { createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { - createAttachedChannelResultAdapter, - createChannelDirectoryAdapter, createPairingPrefixStripper, - createTopLevelChannelReplyToModeResolver, - createRuntimeDirectoryLiveAdapter, createTextPairingAdapter, - normalizeMessageChannel, +} from "openclaw/plugin-sdk/channel-pairing"; +import { createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; +import { resolveTargetsWithOptionalToken } from "openclaw/plugin-sdk/channel-targets"; +import { createTopLevelChannelReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; +import { + createChannelDirectoryAdapter, + createRuntimeDirectoryLiveAdapter, +} from "openclaw/plugin-sdk/directory-runtime"; +import { + createRuntimeOutboundDelegates, resolveOutboundSendDep, - resolveTargetsWithOptionalToken, -} from "openclaw/plugin-sdk/channel-runtime"; -import { buildOutboundBaseSessionKey, normalizeOutboundThreadId } from "openclaw/plugin-sdk/core"; -import { resolveThreadSessionKeys, type RoutePeer } from "openclaw/plugin-sdk/routing"; +} from "openclaw/plugin-sdk/infra-runtime"; +import { + buildOutboundBaseSessionKey, + normalizeMessageChannel, + normalizeOutboundThreadId, + resolveThreadSessionKeys, + type RoutePeer, +} from "openclaw/plugin-sdk/routing"; import { listDiscordAccountIds, resolveDiscordAccount, diff --git a/extensions/discord/src/config-schema.ts b/extensions/discord/src/config-schema.ts index a6866fc092d..6498c77a9fb 100644 --- a/extensions/discord/src/config-schema.ts +++ b/extensions/discord/src/config-schema.ts @@ -1,3 +1,3 @@ -import { buildChannelConfigSchema, DiscordConfigSchema } from "openclaw/plugin-sdk/discord-core"; +import { buildChannelConfigSchema, DiscordConfigSchema } from "./runtime-api.js"; export const DiscordChannelConfigSchema = buildChannelConfigSchema(DiscordConfigSchema); diff --git a/extensions/discord/src/directory-live.ts b/extensions/discord/src/directory-live.ts index 6bd38204a0a..67a8e908f7c 100644 --- a/extensions/discord/src/directory-live.ts +++ b/extensions/discord/src/directory-live.ts @@ -1,5 +1,7 @@ -import type { DirectoryConfigParams } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/channel-runtime"; +import type { + ChannelDirectoryEntry, + DirectoryConfigParams, +} from "openclaw/plugin-sdk/directory-runtime"; import { resolveDiscordAccount } from "./accounts.js"; import { fetchDiscord } from "./api.js"; import { rememberDiscordDirectoryUser } from "./directory-cache.js"; diff --git a/extensions/discord/src/draft-stream.ts b/extensions/discord/src/draft-stream.ts index a12348334bc..ab49b13fbc3 100644 --- a/extensions/discord/src/draft-stream.ts +++ b/extensions/discord/src/draft-stream.ts @@ -1,6 +1,6 @@ import type { RequestClient } from "@buape/carbon"; import { Routes } from "discord-api-types/v10"; -import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-runtime"; +import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-lifecycle"; /** Discord messages cap at 2000 characters. */ const DISCORD_STREAM_MAX_CHARS = 2000; diff --git a/extensions/discord/src/group-policy.ts b/extensions/discord/src/group-policy.ts index a5a8ebac5eb..9394e319818 100644 --- a/extensions/discord/src/group-policy.ts +++ b/extensions/discord/src/group-policy.ts @@ -1,9 +1,9 @@ +import type { ChannelGroupContext } from "openclaw/plugin-sdk/channel-contract"; import { resolveToolsBySender, type GroupToolPolicyBySenderConfig, type GroupToolPolicyConfig, } from "openclaw/plugin-sdk/channel-policy"; -import { type ChannelGroupContext } from "openclaw/plugin-sdk/channel-runtime"; import { normalizeAtHashSlug } from "openclaw/plugin-sdk/core"; import type { DiscordConfig } from "./runtime-api.js"; diff --git a/extensions/discord/src/monitor/agent-components-helpers.ts b/extensions/discord/src/monitor/agent-components-helpers.ts index eecbe73c351..b7c247d1f07 100644 --- a/extensions/discord/src/monitor/agent-components-helpers.ts +++ b/extensions/discord/src/monitor/agent-components-helpers.ts @@ -11,7 +11,7 @@ import { import type { APIStringSelectComponent } from "discord-api-types/v10"; import { ChannelType } from "discord-api-types/v10"; import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing"; -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; diff --git a/extensions/discord/src/monitor/agent-components.ts b/extensions/discord/src/monitor/agent-components.ts index 0fa42d0e23c..429b575b140 100644 --- a/extensions/discord/src/monitor/agent-components.ts +++ b/extensions/discord/src/monitor/agent-components.ts @@ -19,8 +19,11 @@ import { import type { APIStringSelectComponent } from "discord-api-types/v10"; import { ButtonStyle, ChannelType } from "discord-api-types/v10"; import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; +import { + formatInboundEnvelope, + resolveEnvelopeFormatOptions, +} from "openclaw/plugin-sdk/channel-inbound"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; @@ -31,6 +34,7 @@ import { parsePluginBindingApprovalCustomId, resolvePluginConversationBindingApproval, } from "openclaw/plugin-sdk/conversation-runtime"; +import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime"; import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"; import { @@ -38,10 +42,6 @@ import { type PluginInteractiveDiscordHandlerContext, } from "openclaw/plugin-sdk/plugin-runtime"; import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { - formatInboundEnvelope, - resolveEnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/reply-runtime"; import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-runtime"; diff --git a/extensions/discord/src/monitor/allow-list.ts b/extensions/discord/src/monitor/allow-list.ts index 31d95f2f45b..37508b9a092 100644 --- a/extensions/discord/src/monitor/allow-list.ts +++ b/extensions/discord/src/monitor/allow-list.ts @@ -1,11 +1,11 @@ import type { Guild, User } from "@buape/carbon"; -import type { AllowlistMatch } from "openclaw/plugin-sdk/channel-runtime"; +import type { AllowlistMatch } from "openclaw/plugin-sdk/allow-from"; import { buildChannelKeyCandidates, resolveChannelEntryMatchWithFallback, resolveChannelMatchConfig, type ChannelMatchSource, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-targets"; import { evaluateGroupRouteAccessForPolicy } from "openclaw/plugin-sdk/group-access"; import { formatDiscordUserTag } from "./format.js"; diff --git a/extensions/discord/src/monitor/dm-command-auth.ts b/extensions/discord/src/monitor/dm-command-auth.ts index 1e8f1afbb4b..f668545f733 100644 --- a/extensions/discord/src/monitor/dm-command-auth.ts +++ b/extensions/discord/src/monitor/dm-command-auth.ts @@ -1,4 +1,4 @@ -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth"; import { readStoreAllowFromForDmPolicy, resolveDmGroupAccessWithLists, diff --git a/extensions/discord/src/monitor/exec-approvals.ts b/extensions/discord/src/monitor/exec-approvals.ts index 607d5088ad1..c30d0c082e9 100644 --- a/extensions/discord/src/monitor/exec-approvals.ts +++ b/extensions/discord/src/monitor/exec-approvals.ts @@ -10,7 +10,6 @@ import { type TopLevelComponents, } from "@buape/carbon"; import { ButtonStyle, Routes } from "discord-api-types/v10"; -import { normalizeMessageChannel } from "openclaw/plugin-sdk/channel-runtime"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; import type { DiscordExecApprovalConfig } from "openclaw/plugin-sdk/config-runtime"; @@ -24,7 +23,11 @@ import type { ExecApprovalRequest, ExecApprovalResolved, } from "openclaw/plugin-sdk/infra-runtime"; -import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing"; +import { + normalizeAccountId, + normalizeMessageChannel, + resolveAgentIdFromSessionKey, +} from "openclaw/plugin-sdk/routing"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import { compileSafeRegex, testRegexWithBoundedInput } from "openclaw/plugin-sdk/security-runtime"; import { logDebug, logError } from "openclaw/plugin-sdk/text-runtime"; diff --git a/extensions/discord/src/monitor/inbound-worker.ts b/extensions/discord/src/monitor/inbound-worker.ts index 33986e458a3..c00b7dc1c1d 100644 --- a/extensions/discord/src/monitor/inbound-worker.ts +++ b/extensions/discord/src/monitor/inbound-worker.ts @@ -1,4 +1,4 @@ -import { createRunStateMachine } from "openclaw/plugin-sdk/channel-runtime"; +import { createRunStateMachine } from "openclaw/plugin-sdk/channel-lifecycle"; import { formatDurationSeconds } from "openclaw/plugin-sdk/infra-runtime"; import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue"; import { danger } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/discord/src/monitor/message-handler.preflight.ts b/extensions/discord/src/monitor/message-handler.preflight.ts index 9094cabb645..55822830cd5 100644 --- a/extensions/discord/src/monitor/message-handler.preflight.ts +++ b/extensions/discord/src/monitor/message-handler.preflight.ts @@ -1,9 +1,15 @@ import { ChannelType, MessageType, type Message, type User } from "@buape/carbon"; import { Routes, type APIMessage } from "discord-api-types/v10"; -import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveControlCommandGate } from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk/channel-runtime"; +import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/allow-from"; +import { + buildMentionRegexes, + logInboundDrop, + matchesMentionWithExplicit, + resolveMentionGatingWithBypass, +} from "openclaw/plugin-sdk/channel-inbound"; +import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-auth"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import { @@ -18,13 +24,10 @@ import { buildPairingReply } from "openclaw/plugin-sdk/conversation-runtime"; import { isPluginOwnedSessionBindingRecord } from "openclaw/plugin-sdk/conversation-runtime"; import { recordChannelActivity } from "openclaw/plugin-sdk/infra-runtime"; import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { shouldHandleTextCommands } from "openclaw/plugin-sdk/reply-runtime"; import { recordPendingHistoryEntryIfEnabled, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; -import { buildMentionRegexes, matchesMentionWithExplicit } from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing"; import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; import { getChildLogger } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/discord/src/monitor/message-handler.preflight.types.ts b/extensions/discord/src/monitor/message-handler.preflight.types.ts index 368352e1551..575d8ee165b 100644 --- a/extensions/discord/src/monitor/message-handler.preflight.types.ts +++ b/extensions/discord/src/monitor/message-handler.preflight.types.ts @@ -1,7 +1,7 @@ import type { ChannelType, Client, User } from "@buape/carbon"; import type { ReplyToMode } from "openclaw/plugin-sdk/config-runtime"; import type { SessionBindingRecord } from "openclaw/plugin-sdk/conversation-runtime"; -import type { HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; +import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import type { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import type { DiscordChannelConfigResolved, DiscordGuildEntryResolved } from "./allow-list.js"; import type { DiscordChannelInfo } from "./message-utils.js"; diff --git a/extensions/discord/src/monitor/message-handler.process.ts b/extensions/discord/src/monitor/message-handler.process.ts index 42f2011d62a..b381013349e 100644 --- a/extensions/discord/src/monitor/message-handler.process.ts +++ b/extensions/discord/src/monitor/message-handler.process.ts @@ -1,31 +1,32 @@ import { ChannelType, type RequestClient } from "@buape/carbon"; import { resolveAckReaction, resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; import { EmbeddedBlockChunker } from "openclaw/plugin-sdk/agent-runtime"; -import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { shouldAckReaction as shouldAckReactionGate } from "openclaw/plugin-sdk/channel-runtime"; -import { logTypingFailure, logAckFailure } from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; import { createStatusReactionController, DEFAULT_TIMING, + logAckFailure, + logTypingFailure, + shouldAckReaction as shouldAckReactionGate, type StatusReactionAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-feedback"; +import { + formatInboundEnvelope, + resolveEnvelopeFormatOptions, +} from "openclaw/plugin-sdk/channel-inbound"; +import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import { resolveDiscordPreviewStreamMode } from "openclaw/plugin-sdk/config-runtime"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; +import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime"; import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"; -import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; -import { resolveChunkMode } from "openclaw/plugin-sdk/reply-runtime"; -import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; -import { - formatInboundEnvelope, - resolveEnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; import { buildPendingHistoryContextFromMap, clearHistoryEntriesIfEnabled, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; +import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; +import { resolveChunkMode } from "openclaw/plugin-sdk/reply-runtime"; +import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import { createReplyDispatcherWithTyping } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; diff --git a/extensions/discord/src/monitor/message-handler.ts b/extensions/discord/src/monitor/message-handler.ts index 400f35a2529..e17dcc906af 100644 --- a/extensions/discord/src/monitor/message-handler.ts +++ b/extensions/discord/src/monitor/message-handler.ts @@ -2,7 +2,7 @@ import type { Client } from "@buape/carbon"; import { createChannelInboundDebouncer, shouldDebounceTextInbound, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-inbound"; import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/config-runtime"; import { danger } from "openclaw/plugin-sdk/runtime-env"; import { buildDiscordInboundJob } from "./inbound-job.js"; diff --git a/extensions/discord/src/monitor/message-utils.ts b/extensions/discord/src/monitor/message-utils.ts index 4e84f4b3827..e0eb58c9266 100644 --- a/extensions/discord/src/monitor/message-utils.ts +++ b/extensions/discord/src/monitor/message-utils.ts @@ -1,9 +1,9 @@ import type { ChannelType, Client, Message } from "@buape/carbon"; import { StickerFormatType, type APIAttachment, type APIStickerItem } from "discord-api-types/v10"; -import { buildMediaPayload } from "openclaw/plugin-sdk/channel-runtime"; import type { SsrFPolicy } from "openclaw/plugin-sdk/infra-runtime"; import { fetchRemoteMedia, type FetchLike } from "openclaw/plugin-sdk/media-runtime"; import { saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime"; +import { buildMediaPayload } from "openclaw/plugin-sdk/reply-payload"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; const DISCORD_CDN_HOSTNAMES = [ diff --git a/extensions/discord/src/monitor/model-picker.test-utils.ts b/extensions/discord/src/monitor/model-picker.test-utils.ts index 56dcd7480c1..60b1c41e8ba 100644 --- a/extensions/discord/src/monitor/model-picker.test-utils.ts +++ b/extensions/discord/src/monitor/model-picker.test-utils.ts @@ -1,4 +1,4 @@ -import type { ModelsProviderData } from "openclaw/plugin-sdk/reply-runtime"; +import type { ModelsProviderData } from "openclaw/plugin-sdk/command-auth"; export function createModelsProviderData( entries: Record, diff --git a/extensions/discord/src/monitor/model-picker.ts b/extensions/discord/src/monitor/model-picker.ts index ec067ede2dd..47313af5801 100644 --- a/extensions/discord/src/monitor/model-picker.ts +++ b/extensions/discord/src/monitor/model-picker.ts @@ -12,11 +12,8 @@ import { import type { APISelectMenuOption } from "discord-api-types/v10"; import { ButtonStyle } from "discord-api-types/v10"; import { normalizeProviderId } from "openclaw/plugin-sdk/agent-runtime"; +import { buildModelsProviderData, type ModelsProviderData } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { - buildModelsProviderData, - type ModelsProviderData, -} from "openclaw/plugin-sdk/reply-runtime"; export const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk"; export const DISCORD_CUSTOM_ID_MAX_CHARS = 100; diff --git a/extensions/discord/src/monitor/monitor.test.ts b/extensions/discord/src/monitor/monitor.test.ts index 158336d2435..27e129b0bee 100644 --- a/extensions/discord/src/monitor/monitor.test.ts +++ b/extensions/discord/src/monitor/monitor.test.ts @@ -117,8 +117,8 @@ vi.mock("../../../../src/auto-reply/reply/provider-dispatcher.js", async (import }; }); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, recordInboundSession: (...args: unknown[]) => recordInboundSessionMock(...args), diff --git a/extensions/discord/src/monitor/native-command-context.ts b/extensions/discord/src/monitor/native-command-context.ts index 07dc0bf0a76..81b97bede15 100644 --- a/extensions/discord/src/monitor/native-command-context.ts +++ b/extensions/discord/src/monitor/native-command-context.ts @@ -1,4 +1,4 @@ -import type { CommandArgs } from "openclaw/plugin-sdk/reply-runtime"; +import type { CommandArgs } from "openclaw/plugin-sdk/command-auth"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import { type DiscordChannelConfigResolved, type DiscordGuildEntryResolved } from "./allow-list.js"; import { buildDiscordInboundAccessContext } from "./inbound-context.js"; diff --git a/extensions/discord/src/monitor/native-command-ui.ts b/extensions/discord/src/monitor/native-command-ui.ts index 5c31e81ed8f..314c31f11bf 100644 --- a/extensions/discord/src/monitor/native-command-ui.ts +++ b/extensions/discord/src/monitor/native-command-ui.ts @@ -11,22 +11,20 @@ import { type StringSelectMenuInteraction, } from "@buape/carbon"; import { ButtonStyle } from "discord-api-types/v10"; -import type { OpenClawConfig, loadConfig } from "openclaw/plugin-sdk/config-runtime"; -import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; import { buildCommandTextFromArgs, findCommandByNativeName, listChatCommands, resolveCommandArgChoices, + resolveStoredModelOverride, serializeCommandArgs, -} from "openclaw/plugin-sdk/reply-runtime"; -import { resolveStoredModelOverride } from "openclaw/plugin-sdk/reply-runtime"; -import type { - ChatCommandDefinition, - CommandArgDefinition, - CommandArgValues, - CommandArgs, -} from "openclaw/plugin-sdk/reply-runtime"; + type ChatCommandDefinition, + type CommandArgDefinition, + type CommandArgValues, + type CommandArgs, +} from "openclaw/plugin-sdk/command-auth"; +import type { OpenClawConfig, loadConfig } from "openclaw/plugin-sdk/config-runtime"; +import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { chunkItems, withTimeout } from "openclaw/plugin-sdk/text-runtime"; diff --git a/extensions/discord/src/monitor/native-command.ts b/extensions/discord/src/monitor/native-command.ts index 315e87b7e6f..d00fab280f0 100644 --- a/extensions/discord/src/monitor/native-command.ts +++ b/extensions/discord/src/monitor/native-command.ts @@ -13,8 +13,24 @@ import { import { ApplicationCommandOptionType } from "discord-api-types/v10"; import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveNativeCommandSessionTargets } from "openclaw/plugin-sdk/channel-runtime"; +import { + resolveCommandAuthorizedFromAuthorizers, + resolveNativeCommandSessionTargets, +} from "openclaw/plugin-sdk/command-auth"; +import { + buildCommandTextFromArgs, + findCommandByNativeName, + listChatCommands, + parseCommandArgs, + resolveCommandArgChoices, + resolveCommandArgMenu, + serializeCommandArgs, + type ChatCommandDefinition, + type CommandArgDefinition, + type CommandArgValues, + type CommandArgs, + type NativeCommandSpec, +} from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig, loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/config-runtime"; @@ -30,22 +46,6 @@ import { resolveTextChunksWithFallback, } from "openclaw/plugin-sdk/reply-payload"; import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import type { - ChatCommandDefinition, - CommandArgDefinition, - CommandArgValues, - CommandArgs, - NativeCommandSpec, -} from "openclaw/plugin-sdk/reply-runtime"; -import { - buildCommandTextFromArgs, - findCommandByNativeName, - listChatCommands, - parseCommandArgs, - resolveCommandArgChoices, - resolveCommandArgMenu, - serializeCommandArgs, -} from "openclaw/plugin-sdk/reply-runtime"; import { dispatchReplyWithDispatcher } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/discord/src/monitor/provider.allowlist.ts b/extensions/discord/src/monitor/provider.allowlist.ts index ac6c89dd9f8..8cd945da823 100644 --- a/extensions/discord/src/monitor/provider.allowlist.ts +++ b/extensions/discord/src/monitor/provider.allowlist.ts @@ -4,7 +4,7 @@ import { canonicalizeAllowlistWithResolvedIds, patchAllowlistUsersInConfigEntries, summarizeMapping, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/allow-from"; import type { DiscordGuildEntry } from "openclaw/plugin-sdk/config-runtime"; import { formatErrorMessage } from "openclaw/plugin-sdk/infra-runtime"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/discord/src/monitor/provider.lifecycle.ts b/extensions/discord/src/monitor/provider.lifecycle.ts index b2a9e8a6019..884a0bded57 100644 --- a/extensions/discord/src/monitor/provider.lifecycle.ts +++ b/extensions/discord/src/monitor/provider.lifecycle.ts @@ -1,6 +1,6 @@ import type { Client } from "@buape/carbon"; import type { GatewayPlugin } from "@buape/carbon/gateway"; -import { createArmableStallWatchdog } from "openclaw/plugin-sdk/channel-runtime"; +import { createArmableStallWatchdog } from "openclaw/plugin-sdk/channel-lifecycle"; import { createConnectedChannelStatusPatch } from "openclaw/plugin-sdk/gateway-runtime"; import { danger } from "openclaw/plugin-sdk/runtime-env"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/discord/src/monitor/provider.ts b/extensions/discord/src/monitor/provider.ts index 8dbb6df29f5..523f7c54c36 100644 --- a/extensions/discord/src/monitor/provider.ts +++ b/extensions/discord/src/monitor/provider.ts @@ -14,10 +14,10 @@ import { Routes } from "discord-api-types/v10"; import { getAcpSessionManager } from "openclaw/plugin-sdk/acp-runtime"; import { isAcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime"; import { - resolveThreadBindingIdleTimeoutMs, - resolveThreadBindingMaxAgeMs, - resolveThreadBindingsEnabled, -} from "openclaw/plugin-sdk/channel-runtime"; + listNativeCommandSpecsForConfig, + listSkillCommandsForAgents, + type NativeCommandSpec, +} from "openclaw/plugin-sdk/command-auth"; import { isNativeCommandsExplicitlyDisabled, resolveNativeCommandsEnabled, @@ -32,14 +32,16 @@ import { resolveDefaultGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce, } from "openclaw/plugin-sdk/config-runtime"; +import { + resolveThreadBindingIdleTimeoutMs, + resolveThreadBindingMaxAgeMs, + resolveThreadBindingsEnabled, +} from "openclaw/plugin-sdk/conversation-runtime"; import { createConnectedChannelStatusPatch } from "openclaw/plugin-sdk/gateway-runtime"; import { formatErrorMessage } from "openclaw/plugin-sdk/infra-runtime"; import { getPluginCommandSpecs } from "openclaw/plugin-sdk/plugin-runtime"; +import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import type { NativeCommandSpec } from "openclaw/plugin-sdk/reply-runtime"; -import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/reply-runtime"; -import type { HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; -import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/reply-runtime"; import { danger, isVerbose, diff --git a/extensions/discord/src/monitor/thread-bindings.config.ts b/extensions/discord/src/monitor/thread-bindings.config.ts index 701defcfbe1..a6520c5e868 100644 --- a/extensions/discord/src/monitor/thread-bindings.config.ts +++ b/extensions/discord/src/monitor/thread-bindings.config.ts @@ -1,9 +1,9 @@ +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveThreadBindingIdleTimeoutMs, resolveThreadBindingMaxAgeMs, resolveThreadBindingsEnabled, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/conversation-runtime"; import { normalizeAccountId } from "openclaw/plugin-sdk/routing"; export { diff --git a/extensions/discord/src/monitor/thread-bindings.manager.ts b/extensions/discord/src/monitor/thread-bindings.manager.ts index 5c37ac4bbf0..0fa8f09aac0 100644 --- a/extensions/discord/src/monitor/thread-bindings.manager.ts +++ b/extensions/discord/src/monitor/thread-bindings.manager.ts @@ -1,8 +1,8 @@ import { Routes } from "discord-api-types/v10"; -import { resolveThreadBindingConversationIdFromBindingId } from "openclaw/plugin-sdk/channel-runtime"; import { getRuntimeConfigSnapshot, type OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { registerSessionBindingAdapter, + resolveThreadBindingConversationIdFromBindingId, unregisterSessionBindingAdapter, type BindingTargetKind, type SessionBindingRecord, diff --git a/extensions/discord/src/monitor/thread-bindings.messages.ts b/extensions/discord/src/monitor/thread-bindings.messages.ts index 043e888b7fc..1e0a1f3cbb2 100644 --- a/extensions/discord/src/monitor/thread-bindings.messages.ts +++ b/extensions/discord/src/monitor/thread-bindings.messages.ts @@ -1,6 +1,6 @@ export { - formatThreadBindingDurationLabel, resolveThreadBindingFarewellText, resolveThreadBindingIntroText, resolveThreadBindingThreadName, -} from "openclaw/plugin-sdk/channel-runtime"; + formatThreadBindingDurationLabel, +} from "openclaw/plugin-sdk/conversation-runtime"; diff --git a/extensions/discord/src/outbound-adapter.ts b/extensions/discord/src/outbound-adapter.ts index 8b18fffec90..471cf841aa8 100644 --- a/extensions/discord/src/outbound-adapter.ts +++ b/extensions/discord/src/outbound-adapter.ts @@ -1,16 +1,15 @@ +import { + attachChannelToResult, + type ChannelOutboundAdapter, + createAttachedChannelResultAdapter, +} from "openclaw/plugin-sdk/channel-send-result"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +import { resolveOutboundSendDep, type OutboundIdentity } from "openclaw/plugin-sdk/infra-runtime"; import { resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; -import { - attachChannelToResult, - createAttachedChannelResultAdapter, -} from "openclaw/plugin-sdk/channel-send-result"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import type { OutboundIdentity } from "openclaw/plugin-sdk/infra-runtime"; +} from "openclaw/plugin-sdk/reply-payload"; import type { DiscordComponentMessageSpec } from "./components.js"; import { getThreadBindingManager, type ThreadBindingRecord } from "./monitor/thread-bindings.js"; import { normalizeDiscordOutboundTarget } from "./normalize.js"; diff --git a/extensions/discord/src/probe.ts b/extensions/discord/src/probe.ts index f84b4aad10a..cdd662718eb 100644 --- a/extensions/discord/src/probe.ts +++ b/extensions/discord/src/probe.ts @@ -1,4 +1,4 @@ -import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import { resolveFetch } from "openclaw/plugin-sdk/infra-runtime"; import { fetchWithTimeout } from "openclaw/plugin-sdk/text-runtime"; import { normalizeDiscordToken } from "./token.js"; diff --git a/extensions/discord/src/runtime-api.ts b/extensions/discord/src/runtime-api.ts index 0d355ab506f..7d9bc355184 100644 --- a/extensions/discord/src/runtime-api.ts +++ b/extensions/discord/src/runtime-api.ts @@ -4,7 +4,7 @@ export { PAIRING_APPROVED_MESSAGE, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "../../../src/plugin-sdk/discord.js"; export { buildChannelConfigSchema, getChatChannelMeta, @@ -19,15 +19,15 @@ export { type DiscordActionConfig, type DiscordConfig, type OpenClawConfig, -} from "openclaw/plugin-sdk/discord-core"; -export { DiscordConfigSchema } from "openclaw/plugin-sdk/discord-core"; +} from "../../../src/plugin-sdk/discord-core.js"; +export { DiscordConfigSchema } from "../../../src/plugin-sdk/discord-core.js"; export { readBooleanParam } from "openclaw/plugin-sdk/boolean-param"; export { assertMediaNotDataUrl, parseAvailableTags, readReactionParams, withNormalizedTimestamp, -} from "openclaw/plugin-sdk/discord-core"; +} from "../../../src/plugin-sdk/discord-core.js"; export { createHybridChannelConfigAdapter, createScopedChannelConfigAdapter, @@ -44,9 +44,9 @@ export { resolveAccountEntry } from "openclaw/plugin-sdk/routing"; export type { ChannelMessageActionAdapter, ChannelMessageActionName, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-contract"; export { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString, -} from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/secret-input"; diff --git a/extensions/discord/src/session-key-normalization.ts b/extensions/discord/src/session-key-normalization.ts index 06164d6aba5..f63524428c0 100644 --- a/extensions/discord/src/session-key-normalization.ts +++ b/extensions/discord/src/session-key-normalization.ts @@ -1,4 +1,4 @@ -import { normalizeChatType } from "openclaw/plugin-sdk/channel-runtime"; +import { normalizeChatType } from "openclaw/plugin-sdk/account-resolution"; import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime"; export function normalizeExplicitDiscordSessionKey( diff --git a/extensions/discord/src/setup-account-state.ts b/extensions/discord/src/setup-account-state.ts index 725e6e4037e..2adbcacb424 100644 --- a/extensions/discord/src/setup-account-state.ts +++ b/extensions/discord/src/setup-account-state.ts @@ -1,9 +1,9 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { hasConfiguredSecretInput, normalizeSecretInputString, - type OpenClawConfig, -} from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/secret-input"; import type { DiscordAccountConfig } from "./runtime-api.js"; import { resolveDiscordToken } from "./token.js"; diff --git a/extensions/discord/src/status-issues.ts b/extensions/discord/src/status-issues.ts index 4fa26fd011b..f095221483e 100644 --- a/extensions/discord/src/status-issues.ts +++ b/extensions/discord/src/status-issues.ts @@ -1,13 +1,13 @@ +import type { + ChannelAccountSnapshot, + ChannelStatusIssue, +} from "openclaw/plugin-sdk/channel-contract"; import { appendMatchMetadata, asString, isRecord, resolveEnabledConfiguredAccountId, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { - ChannelAccountSnapshot, - ChannelStatusIssue, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/status-helpers"; type DiscordIntentSummary = { messageContent?: "enabled" | "limited" | "disabled"; diff --git a/extensions/discord/src/subagent-hooks.test.ts b/extensions/discord/src/subagent-hooks.test.ts index a05db63043a..578d4574cbc 100644 --- a/extensions/discord/src/subagent-hooks.test.ts +++ b/extensions/discord/src/subagent-hooks.test.ts @@ -1,5 +1,5 @@ -import type { OpenClawPluginApi } from "openclaw/plugin-sdk/discord"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { OpenClawPluginApi } from "../../../src/plugins/types.js"; import { getRequiredHookHandler, registerHookHandlersForTest, diff --git a/extensions/discord/src/targets.ts b/extensions/discord/src/targets.ts index 3660f75921e..cb04a96d914 100644 --- a/extensions/discord/src/targets.ts +++ b/extensions/discord/src/targets.ts @@ -1,4 +1,3 @@ -import type { DirectoryConfigParams } from "openclaw/plugin-sdk/channel-runtime"; import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, @@ -6,7 +5,8 @@ import { type MessagingTarget, type MessagingTargetKind, type MessagingTargetParseOptions, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-targets"; +import type { DirectoryConfigParams } from "openclaw/plugin-sdk/directory-runtime"; import { rememberDiscordDirectoryUser } from "./directory-cache.js"; import { listDiscordDirectoryPeersLive } from "./directory-live.js"; diff --git a/extensions/discord/src/token.ts b/extensions/discord/src/token.ts index 2a979ca4b3b..b9614e59794 100644 --- a/extensions/discord/src/token.ts +++ b/extensions/discord/src/token.ts @@ -1,7 +1,7 @@ -import type { BaseTokenResolution } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseTokenResolution } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; export type DiscordTokenSource = "env" | "config" | "none"; diff --git a/extensions/discord/src/voice/command.ts b/extensions/discord/src/voice/command.ts index 3ed7aa2ccdb..0d9bf5124d6 100644 --- a/extensions/discord/src/voice/command.ts +++ b/extensions/discord/src/voice/command.ts @@ -10,7 +10,7 @@ import { ChannelType as DiscordChannelType, type APIApplicationCommandChannelOption, } from "discord-api-types/v10"; -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime"; diff --git a/extensions/feishu/runtime-api.ts b/extensions/feishu/runtime-api.ts index ece8df41cca..cde6bbf5569 100644 --- a/extensions/feishu/runtime-api.ts +++ b/extensions/feishu/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Feishu extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/feishu"; +export * from "../../src/plugin-sdk/feishu.js"; diff --git a/extensions/feishu/src/channel.ts b/extensions/feishu/src/channel.ts index 97fd5dd068d..4eac10cc0cd 100644 --- a/extensions/feishu/src/channel.ts +++ b/extensions/feishu/src/channel.ts @@ -1,21 +1,23 @@ import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from"; +import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-actions"; import { createHybridChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers"; +import type { + ChannelMessageActionAdapter, + ChannelMessageToolDiscovery, +} from "openclaw/plugin-sdk/channel-contract"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderGroupPolicyWarningCollector, projectWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; import { createChannelDirectoryAdapter, - createMessageToolCardSchema, - createPairingPrefixStripper, createRuntimeDirectoryLiveAdapter, - createRuntimeOutboundDelegates, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { - ChannelMessageActionAdapter, - ChannelMessageToolDiscovery, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/directory-runtime"; +import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/infra-runtime"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; import type { ChannelMeta, ChannelPlugin, ClawdbotConfig } from "../runtime-api.js"; import { diff --git a/extensions/feishu/src/thread-bindings.ts b/extensions/feishu/src/thread-bindings.ts index cfae8fb2058..842374155b3 100644 --- a/extensions/feishu/src/thread-bindings.ts +++ b/extensions/feishu/src/thread-bindings.ts @@ -1,11 +1,9 @@ -import { resolveThreadBindingConversationIdFromBindingId } from "openclaw/plugin-sdk/channel-runtime"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveThreadBindingIdleTimeoutMsForChannel, resolveThreadBindingMaxAgeMsForChannel, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { registerSessionBindingAdapter, + resolveThreadBindingConversationIdFromBindingId, unregisterSessionBindingAdapter, type BindingTargetKind, type SessionBindingRecord, diff --git a/extensions/firecrawl/src/config.ts b/extensions/firecrawl/src/config.ts index 3f2d6a82f8a..3c2c2f3c25d 100644 --- a/extensions/firecrawl/src/config.ts +++ b/extensions/firecrawl/src/config.ts @@ -1,6 +1,6 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { normalizeSecretInput } from "openclaw/plugin-sdk/provider-auth"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; export const DEFAULT_FIRECRAWL_BASE_URL = "https://api.firecrawl.dev"; export const DEFAULT_FIRECRAWL_SEARCH_TIMEOUT_SECONDS = 30; diff --git a/extensions/google/gemini-cli-provider.ts b/extensions/google/gemini-cli-provider.ts index 77fa7077b5d..412d02dd85f 100644 --- a/extensions/google/gemini-cli-provider.ts +++ b/extensions/google/gemini-cli-provider.ts @@ -3,7 +3,7 @@ import type { ProviderAuthContext, ProviderFetchUsageSnapshotContext, } from "openclaw/plugin-sdk/plugin-entry"; -import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-oauth"; +import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth"; import { fetchGeminiUsage } from "openclaw/plugin-sdk/provider-usage"; import { isModernGoogleModel, resolveGoogle31ForwardCompatModel } from "./provider-models.js"; diff --git a/extensions/googlechat/runtime-api.ts b/extensions/googlechat/runtime-api.ts index df946f8ec4a..cd47c0e56c7 100644 --- a/extensions/googlechat/runtime-api.ts +++ b/extensions/googlechat/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Google Chat extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/googlechat"; +export * from "../../src/plugin-sdk/googlechat.js"; diff --git a/extensions/googlechat/src/channel.ts b/extensions/googlechat/src/channel.ts index fc4cf489928..e8917d13c04 100644 --- a/extensions/googlechat/src/channel.ts +++ b/extensions/googlechat/src/channel.ts @@ -3,19 +3,17 @@ import { createScopedChannelConfigAdapter, createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; +import { createTextPairingAdapter } from "openclaw/plugin-sdk/channel-pairing"; import { composeWarningCollectors, createAllowlistProviderGroupPolicyWarningCollector, createConditionalWarningCollector, createAllowlistProviderOpenWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; +import { createTopLevelChannelReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; import { - createAttachedChannelResultAdapter, createChannelDirectoryAdapter, - createTopLevelChannelReplyToModeResolver, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; -import { listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom, } from "openclaw/plugin-sdk/directory-runtime"; diff --git a/extensions/imessage/runtime-api.ts b/extensions/imessage/runtime-api.ts index aa6d55c75e5..22b1e4a21ba 100644 --- a/extensions/imessage/runtime-api.ts +++ b/extensions/imessage/runtime-api.ts @@ -13,7 +13,7 @@ export { IMessageConfigSchema, type ChannelPlugin, type IMessageAccountConfig, -} from "openclaw/plugin-sdk/imessage"; +} from "../../src/plugin-sdk/imessage.js"; export { resolveIMessageGroupRequireMention, resolveIMessageGroupToolPolicy, diff --git a/extensions/imessage/src/channel.runtime.ts b/extensions/imessage/src/channel.runtime.ts index 32cd39a1d64..5ee80d614d6 100644 --- a/extensions/imessage/src/channel.runtime.ts +++ b/extensions/imessage/src/channel.runtime.ts @@ -1,4 +1,4 @@ -import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; import { PAIRING_APPROVED_MESSAGE, resolveChannelMediaMaxBytes } from "../runtime-api.js"; import type { ResolvedIMessageAccount } from "./accounts.js"; import { monitorIMessageProvider } from "./monitor.js"; diff --git a/extensions/imessage/src/channel.ts b/extensions/imessage/src/channel.ts index d084ee92a15..5257e32f349 100644 --- a/extensions/imessage/src/channel.ts +++ b/extensions/imessage/src/channel.ts @@ -1,12 +1,9 @@ import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit"; -import { - createAttachedChannelResultAdapter, - resolveOutboundSendDep, -} from "openclaw/plugin-sdk/channel-runtime"; -import { buildOutboundBaseSessionKey } from "openclaw/plugin-sdk/core"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; +import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; -import { type RoutePeer } from "openclaw/plugin-sdk/routing"; +import { buildOutboundBaseSessionKey, type RoutePeer } from "openclaw/plugin-sdk/routing"; import { collectStatusIssuesFromLastError, DEFAULT_ACCOUNT_ID, diff --git a/extensions/imessage/src/config-schema.ts b/extensions/imessage/src/config-schema.ts index dc960ccdb0e..230c31ce089 100644 --- a/extensions/imessage/src/config-schema.ts +++ b/extensions/imessage/src/config-schema.ts @@ -1,3 +1,3 @@ -import { buildChannelConfigSchema, IMessageConfigSchema } from "openclaw/plugin-sdk/imessage-core"; +import { buildChannelConfigSchema, IMessageConfigSchema } from "../runtime-api.js"; export const IMessageChannelConfigSchema = buildChannelConfigSchema(IMessageConfigSchema); diff --git a/extensions/imessage/src/monitor/inbound-processing.ts b/extensions/imessage/src/monitor/inbound-processing.ts index 531a8324dfd..358ecf26f17 100644 --- a/extensions/imessage/src/monitor/inbound-processing.ts +++ b/extensions/imessage/src/monitor/inbound-processing.ts @@ -1,24 +1,25 @@ -import { resolveDualTextControlCommandGate } from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop } from "openclaw/plugin-sdk/channel-runtime"; +import { + buildMentionRegexes, + type EnvelopeFormatOptions, + formatInboundEnvelope, + formatInboundFromLabel, + logInboundDrop, + matchesMentionPatterns, + resolveEnvelopeFormatOptions, +} from "openclaw/plugin-sdk/channel-inbound"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +import { resolveDualTextControlCommandGate } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention, } from "openclaw/plugin-sdk/config-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { - formatInboundEnvelope, - formatInboundFromLabel, - resolveEnvelopeFormatOptions, - type EnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; import { buildPendingHistoryContextFromMap, recordPendingHistoryEntryIfEnabled, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; -import { buildMentionRegexes, matchesMentionPatterns } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { DM_GROUP_ACCESS_REASON, diff --git a/extensions/imessage/src/monitor/monitor-provider.ts b/extensions/imessage/src/monitor/monitor-provider.ts index 651926616c6..f5524a12f85 100644 --- a/extensions/imessage/src/monitor/monitor-provider.ts +++ b/extensions/imessage/src/monitor/monitor-provider.ts @@ -1,12 +1,11 @@ import fs from "node:fs/promises"; import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; -import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing"; -import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; import { createChannelInboundDebouncer, shouldDebounceTextInbound, -} from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-inbound"; +import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing"; +import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveOpenProviderRuntimeGroupPolicy, @@ -18,6 +17,7 @@ import { readChannelAllowFromStore, upsertChannelPairingRequest, } from "openclaw/plugin-sdk/conversation-runtime"; +import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime"; import { normalizeScpRemoteHost } from "openclaw/plugin-sdk/infra-runtime"; import { waitForTransportReady } from "openclaw/plugin-sdk/infra-runtime"; import { @@ -26,13 +26,13 @@ import { resolveIMessageRemoteAttachmentRoots, } from "openclaw/plugin-sdk/media-runtime"; import { kindFromMime } from "openclaw/plugin-sdk/media-runtime"; -import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; import { clearHistoryEntriesIfEnabled, DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; +import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; +import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; import { createReplyDispatcher } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose, shouldLogVerbose, warn } from "openclaw/plugin-sdk/runtime-env"; import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime"; diff --git a/extensions/imessage/src/outbound-adapter.ts b/extensions/imessage/src/outbound-adapter.ts index cd961c30bfa..0b023fa2b02 100644 --- a/extensions/imessage/src/outbound-adapter.ts +++ b/extensions/imessage/src/outbound-adapter.ts @@ -1,8 +1,8 @@ +import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/infra-runtime"; import { - createScopedChannelMediaMaxBytesResolver, createDirectTextMediaOutbound, -} from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/channel-runtime"; + createScopedChannelMediaMaxBytesResolver, +} from "openclaw/plugin-sdk/media-runtime"; import { sendMessageIMessage } from "./send.js"; function resolveIMessageSender(deps: OutboundSendDeps | undefined) { diff --git a/extensions/imessage/src/probe.ts b/extensions/imessage/src/probe.ts index 7ae049f02eb..1609ec2f657 100644 --- a/extensions/imessage/src/probe.ts +++ b/extensions/imessage/src/probe.ts @@ -1,4 +1,4 @@ -import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/irc/src/accounts.ts b/extensions/irc/src/accounts.ts index 8c68eb5406e..71281cbcf4d 100644 --- a/extensions/irc/src/accounts.ts +++ b/extensions/irc/src/accounts.ts @@ -1,8 +1,8 @@ import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { parseOptionalDelimitedEntries } from "openclaw/plugin-sdk/core"; import { tryReadSecretFileSync } from "openclaw/plugin-sdk/infra-runtime"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; import type { CoreConfig, IrcAccountConfig, IrcNickServConfig } from "./types.js"; const TRUTHY_ENV = new Set(["true", "1", "yes", "on"]); diff --git a/extensions/irc/src/channel.ts b/extensions/irc/src/channel.ts index 27571c92d35..69fdc07a79f 100644 --- a/extensions/irc/src/channel.ts +++ b/extensions/irc/src/channel.ts @@ -3,17 +3,17 @@ import { createScopedChannelConfigAdapter, createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; +import { createTextPairingAdapter } from "openclaw/plugin-sdk/channel-pairing"; import { composeWarningCollectors, createAllowlistProviderOpenWarningCollector, createConditionalWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { - createAttachedChannelResultAdapter, createChannelDirectoryAdapter, - createTextPairingAdapter, listResolvedDirectoryEntriesFromSources, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/directory-runtime"; import { runStoppablePassiveMonitor } from "openclaw/plugin-sdk/extension-shared"; import { listIrcAccountIds, diff --git a/extensions/irc/src/runtime-api.ts b/extensions/irc/src/runtime-api.ts index 40f35e1ad53..96e4bdbbe90 100644 --- a/extensions/irc/src/runtime-api.ts +++ b/extensions/irc/src/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled IRC extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/irc"; +export * from "../../../src/plugin-sdk/irc.js"; diff --git a/extensions/irc/src/setup-core.ts b/extensions/irc/src/setup-core.ts index 8e3a347e35a..f2e83e9838f 100644 --- a/extensions/irc/src/setup-core.ts +++ b/extensions/irc/src/setup-core.ts @@ -1,5 +1,4 @@ -import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelSetupInput } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelSetupAdapter, ChannelSetupInput } from "openclaw/plugin-sdk/channel-setup"; import type { DmPolicy } from "openclaw/plugin-sdk/config-runtime"; import { normalizeAccountId } from "openclaw/plugin-sdk/routing"; import { diff --git a/extensions/line/runtime-api.ts b/extensions/line/runtime-api.ts index e439c4020b0..675c11a7467 100644 --- a/extensions/line/runtime-api.ts +++ b/extensions/line/runtime-api.ts @@ -1,19 +1,13 @@ // Private runtime barrel for the bundled LINE extension. // Keep this barrel thin and aligned with the local extension surface. -export type { OpenClawConfig } from "openclaw/plugin-sdk/line-core"; -export type { ChannelSetupDmPolicy, ChannelSetupWizard } from "openclaw/plugin-sdk/channel-setup"; -export type { LineConfig, ResolvedLineAccount } from "openclaw/plugin-sdk/line-core"; -export { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema"; +export * from "../../src/plugin-sdk/line.js"; export { DEFAULT_ACCOUNT_ID, formatDocsLink, - LineConfigSchema, - listLineAccountIds, - normalizeAccountId, - resolveDefaultLineAccountId, resolveExactLineGroupConfigKey, - resolveLineAccount, setSetupChannelEnabled, splitSetupEntries, -} from "openclaw/plugin-sdk/line-core"; + type ChannelSetupDmPolicy, + type ChannelSetupWizard, +} from "../../src/plugin-sdk/line-core.js"; diff --git a/extensions/line/src/channel.ts b/extensions/line/src/channel.ts index 54cd54ff7bf..fd81a4c8f8a 100644 --- a/extensions/line/src/channel.ts +++ b/extensions/line/src/channel.ts @@ -1,12 +1,14 @@ import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderRestrictSendersWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { createAttachedChannelResultAdapter, - createEmptyChannelDirectoryAdapter, createEmptyChannelResult, - createPairingPrefixStripper, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-send-result"; +import { createEmptyChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload"; import { buildComputedAccountStatusSnapshot, diff --git a/extensions/line/src/config-adapter.ts b/extensions/line/src/config-adapter.ts index 3894210f0a6..b529ca26712 100644 --- a/extensions/line/src/config-adapter.ts +++ b/extensions/line/src/config-adapter.ts @@ -5,7 +5,7 @@ import { resolveLineAccount, type OpenClawConfig, type ResolvedLineAccount, -} from "openclaw/plugin-sdk/line-core"; +} from "../../../src/plugin-sdk/line-core.js"; export function normalizeLineAllowFrom(entry: string): string { return entry.replace(/^line:(?:user:)?/i, ""); diff --git a/extensions/line/src/group-policy.ts b/extensions/line/src/group-policy.ts index e6b4fa0ba95..16690aad8c1 100644 --- a/extensions/line/src/group-policy.ts +++ b/extensions/line/src/group-policy.ts @@ -1,5 +1,8 @@ import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy"; -import { resolveExactLineGroupConfigKey, type OpenClawConfig } from "openclaw/plugin-sdk/line-core"; +import { + resolveExactLineGroupConfigKey, + type OpenClawConfig, +} from "../../../src/plugin-sdk/line-core.js"; type LineGroupContext = { cfg: OpenClawConfig; diff --git a/extensions/line/src/setup-core.ts b/extensions/line/src/setup-core.ts index 363b4dcb2a1..f4823b9f0d2 100644 --- a/extensions/line/src/setup-core.ts +++ b/extensions/line/src/setup-core.ts @@ -1,11 +1,11 @@ +import type { ChannelSetupAdapter, OpenClawConfig } from "openclaw/plugin-sdk/setup"; import { DEFAULT_ACCOUNT_ID, listLineAccountIds, normalizeAccountId, resolveLineAccount, type LineConfig, -} from "openclaw/plugin-sdk/line-core"; -import type { ChannelSetupAdapter, OpenClawConfig } from "openclaw/plugin-sdk/setup"; +} from "../../../src/plugin-sdk/line-core.js"; const channel = "line" as const; diff --git a/extensions/line/src/setup-surface.ts b/extensions/line/src/setup-surface.ts index 640ad3812b8..b0767b8b4a7 100644 --- a/extensions/line/src/setup-surface.ts +++ b/extensions/line/src/setup-surface.ts @@ -1,3 +1,4 @@ +import { createAllowFromSection, createTopLevelChannelDmPolicy } from "openclaw/plugin-sdk/setup"; import { DEFAULT_ACCOUNT_ID, formatDocsLink, @@ -6,8 +7,7 @@ import { splitSetupEntries, type ChannelSetupDmPolicy, type ChannelSetupWizard, -} from "openclaw/plugin-sdk/line-core"; -import { createAllowFromSection, createTopLevelChannelDmPolicy } from "openclaw/plugin-sdk/setup"; +} from "../../../src/plugin-sdk/line-core.js"; import { isLineConfigured, listLineAccountIds, diff --git a/extensions/matrix/runtime-api.ts b/extensions/matrix/runtime-api.ts index 865936cb6ff..0d2a584b0e1 100644 --- a/extensions/matrix/runtime-api.ts +++ b/extensions/matrix/runtime-api.ts @@ -3,4 +3,27 @@ // matrix-js-sdk during plain runtime-api import. export * from "./src/auth-precedence.js"; export * from "./helper-api.js"; -export * from "./thread-bindings-runtime.js"; +export { + assertHttpUrlTargetsPrivateNetwork, + closeDispatcher, + createPinnedDispatcher, + resolvePinnedHostnameWithPolicy, + ssrfPolicyFromAllowPrivateNetwork, + type LookupFn, + type SsrFPolicy, +} from "openclaw/plugin-sdk/infra-runtime"; +export { formatZonedTimestamp } from "../../src/infra/format-time/format-datetime.js"; +export { + setMatrixThreadBindingIdleTimeoutBySessionKey, + setMatrixThreadBindingMaxAgeBySessionKey, +} from "./thread-bindings-runtime.js"; +export { writeJsonFileAtomically } from "../../src/plugin-sdk/json-store.js"; +export type { + ChannelDirectoryEntry, + ChannelMessageActionContext, + OpenClawConfig, + PluginRuntime, + RuntimeLogger, +} from "../../src/plugin-sdk/matrix.js"; +export type { RuntimeEnv } from "../../src/runtime.js"; +export type { WizardPrompter } from "../../src/wizard/prompts.js"; diff --git a/extensions/matrix/src/actions.account-propagation.test.ts b/extensions/matrix/src/actions.account-propagation.test.ts index 12dfea963f3..eaa2be533b0 100644 --- a/extensions/matrix/src/actions.account-propagation.test.ts +++ b/extensions/matrix/src/actions.account-propagation.test.ts @@ -1,5 +1,5 @@ -import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { ChannelMessageActionContext } from "../runtime-api.js"; import type { CoreConfig } from "./types.js"; const mocks = vi.hoisted(() => ({ diff --git a/extensions/matrix/src/actions.test.ts b/extensions/matrix/src/actions.test.ts index 5e657bb4603..6750f7d9fb7 100644 --- a/extensions/matrix/src/actions.test.ts +++ b/extensions/matrix/src/actions.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it } from "vitest"; +import type { PluginRuntime } from "../runtime-api.js"; import { matrixMessageActions } from "./actions.js"; import { setMatrixRuntime } from "./runtime.js"; import type { CoreConfig } from "./types.js"; diff --git a/extensions/matrix/src/channel.directory.test.ts b/extensions/matrix/src/channel.directory.test.ts index 8f79f592db8..2c4c8a254bf 100644 --- a/extensions/matrix/src/channel.directory.test.ts +++ b/extensions/matrix/src/channel.directory.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime, RuntimeEnv } from "../runtime-api.js"; import { matrixPlugin } from "./channel.js"; import { resolveMatrixAccount } from "./matrix/accounts.js"; import { resolveMatrixConfigForAccount } from "./matrix/client/config.js"; diff --git a/extensions/matrix/src/channel.setup.test.ts b/extensions/matrix/src/channel.setup.test.ts index ecafd4819f6..ba065fba792 100644 --- a/extensions/matrix/src/channel.setup.test.ts +++ b/extensions/matrix/src/channel.setup.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime, RuntimeEnv } from "../runtime-api.js"; const verificationMocks = vi.hoisted(() => ({ bootstrapMatrixVerification: vi.fn(), diff --git a/extensions/matrix/src/channel.ts b/extensions/matrix/src/channel.ts index ca028d8d99d..bef357c3bdd 100644 --- a/extensions/matrix/src/channel.ts +++ b/extensions/matrix/src/channel.ts @@ -2,20 +2,22 @@ import { createScopedChannelConfigAdapter, createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderOpenWarningCollector, projectWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; +import { createScopedAccountReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; import { createChannelDirectoryAdapter, - createPairingPrefixStripper, - createScopedAccountReplyToModeResolver, createRuntimeDirectoryLiveAdapter, - createRuntimeOutboundDelegates, - createTextPairingAdapter, listResolvedDirectoryEntriesFromSources, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/directory-runtime"; import { buildTrafficStatusSummary } from "openclaw/plugin-sdk/extension-shared"; +import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/infra-runtime"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; import { matrixMessageActions } from "./actions.js"; import { MatrixConfigSchema } from "./config-schema.js"; diff --git a/extensions/matrix/src/cli.test.ts b/extensions/matrix/src/cli.test.ts index da10215f435..318db978f6b 100644 --- a/extensions/matrix/src/cli.test.ts +++ b/extensions/matrix/src/cli.test.ts @@ -1,6 +1,6 @@ import { Command } from "commander"; -import { formatZonedTimestamp } from "openclaw/plugin-sdk/matrix"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { formatZonedTimestamp } from "../runtime-api.js"; const bootstrapMatrixVerificationMock = vi.fn(); const getMatrixRoomKeyBackupStatusMock = vi.fn(); diff --git a/extensions/matrix/src/matrix/client.test.ts b/extensions/matrix/src/matrix/client.test.ts index e1b8c78c56f..4e6882bc20b 100644 --- a/extensions/matrix/src/matrix/client.test.ts +++ b/extensions/matrix/src/matrix/client.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from "vitest"; -import type { LookupFn } from "../runtime-api.js"; +import type { LookupFn } from "../../runtime-api.js"; import type { CoreConfig } from "../types.js"; import { getMatrixScopedEnvVarNames, diff --git a/extensions/matrix/src/matrix/client/storage.test.ts b/extensions/matrix/src/matrix/client/storage.test.ts index 923f686df67..f0749dd5bef 100644 --- a/extensions/matrix/src/matrix/client/storage.test.ts +++ b/extensions/matrix/src/matrix/client/storage.test.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { resolveMatrixAccountStorageRoot } from "openclaw/plugin-sdk/matrix"; import { afterEach, beforeAll, describe, expect, it, vi } from "vitest"; +import { resolveMatrixAccountStorageRoot } from "../../../runtime-api.js"; import { setMatrixRuntime } from "../../runtime.js"; const createBackupArchiveMock = vi.hoisted(() => diff --git a/extensions/matrix/src/matrix/monitor/auto-join.test.ts b/extensions/matrix/src/matrix/monitor/auto-join.test.ts index 07dc83fe2a6..9aa8914777e 100644 --- a/extensions/matrix/src/matrix/monitor/auto-join.test.ts +++ b/extensions/matrix/src/matrix/monitor/auto-join.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime } from "../../../runtime-api.js"; import { setMatrixRuntime } from "../../runtime.js"; import type { MatrixConfig } from "../../types.js"; import { registerMatrixAutoJoin } from "./auto-join.js"; @@ -48,7 +48,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -67,7 +67,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); expect(getInviteHandler()).toBeNull(); @@ -88,7 +88,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -112,7 +112,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -135,7 +135,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -161,7 +161,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error, - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -187,7 +187,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); @@ -210,7 +210,7 @@ describe("registerMatrixAutoJoin", () => { runtime: { log: vi.fn(), error: vi.fn(), - } as unknown as import("openclaw/plugin-sdk/matrix").RuntimeEnv, + } as unknown as import("../../../runtime-api.js").RuntimeEnv, }); const inviteHandler = getInviteHandler(); diff --git a/extensions/matrix/src/matrix/monitor/config.test.ts b/extensions/matrix/src/matrix/monitor/config.test.ts index f2a146879f7..0b85ef811d5 100644 --- a/extensions/matrix/src/matrix/monitor/config.test.ts +++ b/extensions/matrix/src/matrix/monitor/config.test.ts @@ -1,5 +1,5 @@ -import type { RuntimeEnv } from "openclaw/plugin-sdk/matrix"; import { describe, expect, it, vi } from "vitest"; +import type { RuntimeEnv } from "../../../runtime-api.js"; import type { CoreConfig, MatrixRoomConfig } from "../../types.js"; import { resolveMatrixMonitorConfig } from "./config.js"; diff --git a/extensions/matrix/src/matrix/monitor/handler.media-failure.test.ts b/extensions/matrix/src/matrix/monitor/handler.media-failure.test.ts index 45c7484d3ca..58b78ff306c 100644 --- a/extensions/matrix/src/matrix/monitor/handler.media-failure.test.ts +++ b/extensions/matrix/src/matrix/monitor/handler.media-failure.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "../../../runtime-api.js"; import { setMatrixRuntime } from "../../runtime.js"; import type { MatrixClient } from "../sdk.js"; import type { MatrixRawEvent } from "./types.js"; diff --git a/extensions/matrix/src/matrix/monitor/handler.thread-root-media.test.ts b/extensions/matrix/src/matrix/monitor/handler.thread-root-media.test.ts index 51f5a07bdd0..aea230f3afc 100644 --- a/extensions/matrix/src/matrix/monitor/handler.thread-root-media.test.ts +++ b/extensions/matrix/src/matrix/monitor/handler.thread-root-media.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "openclaw/plugin-sdk/matrix"; import { describe, expect, it, vi } from "vitest"; +import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "../../../runtime-api.js"; import { setMatrixRuntime } from "../../runtime.js"; import type { MatrixClient } from "../sdk.js"; import { createMatrixRoomMessageHandler } from "./handler.js"; diff --git a/extensions/matrix/src/matrix/monitor/index.test.ts b/extensions/matrix/src/matrix/monitor/index.test.ts index b9aa8e8b624..1e7db90d4df 100644 --- a/extensions/matrix/src/matrix/monitor/index.test.ts +++ b/extensions/matrix/src/matrix/monitor/index.test.ts @@ -46,7 +46,7 @@ const hoisted = vi.hoisted(() => { }; }); -vi.mock("openclaw/plugin-sdk/matrix", () => ({ +vi.mock("../../runtime-api.js", () => ({ GROUP_POLICY_BLOCKED_LABEL: { room: "room", }, diff --git a/extensions/matrix/src/matrix/monitor/legacy-crypto-restore.test.ts b/extensions/matrix/src/matrix/monitor/legacy-crypto-restore.test.ts index 887dd25624a..68e81a48e41 100644 --- a/extensions/matrix/src/matrix/monitor/legacy-crypto-restore.test.ts +++ b/extensions/matrix/src/matrix/monitor/legacy-crypto-restore.test.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; -import { resolveMatrixAccountStorageRoot } from "openclaw/plugin-sdk/matrix"; import { describe, expect, it, vi } from "vitest"; import { withTempHome } from "../../../../../test/helpers/temp-home.js"; +import { resolveMatrixAccountStorageRoot } from "../../../runtime-api.js"; import { maybeRestoreLegacyMatrixBackup } from "./legacy-crypto-restore.js"; function createBackupStatus() { diff --git a/extensions/matrix/src/matrix/monitor/media.test.ts b/extensions/matrix/src/matrix/monitor/media.test.ts index 19ee48cb57e..73abd2feb80 100644 --- a/extensions/matrix/src/matrix/monitor/media.test.ts +++ b/extensions/matrix/src/matrix/monitor/media.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime } from "../../../runtime-api.js"; import { setMatrixRuntime } from "../../runtime.js"; import { downloadMatrixMedia } from "./media.js"; diff --git a/extensions/matrix/src/matrix/monitor/replies.test.ts b/extensions/matrix/src/matrix/monitor/replies.test.ts index 33ed0bba226..92146fa4901 100644 --- a/extensions/matrix/src/matrix/monitor/replies.test.ts +++ b/extensions/matrix/src/matrix/monitor/replies.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime, RuntimeEnv } from "../../../runtime-api.js"; import type { MatrixClient } from "../sdk.js"; const sendMessageMatrixMock = vi.hoisted(() => vi.fn().mockResolvedValue({ messageId: "mx-1" })); diff --git a/extensions/matrix/src/matrix/send.test.ts b/extensions/matrix/src/matrix/send.test.ts index 5b0f9ff8a07..20e5ba8fd67 100644 --- a/extensions/matrix/src/matrix/send.test.ts +++ b/extensions/matrix/src/matrix/send.test.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/matrix"; import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import type { PluginRuntime } from "../../runtime-api.js"; import { setMatrixRuntime } from "../runtime.js"; const loadWebMediaMock = vi.fn().mockResolvedValue({ diff --git a/extensions/matrix/src/matrix/thread-bindings-shared.ts b/extensions/matrix/src/matrix/thread-bindings-shared.ts index 7b5adb5eeda..3d3a08dc0b9 100644 --- a/extensions/matrix/src/matrix/thread-bindings-shared.ts +++ b/extensions/matrix/src/matrix/thread-bindings-shared.ts @@ -1,8 +1,8 @@ -import { resolveThreadBindingLifecycle } from "openclaw/plugin-sdk/channel-runtime"; import type { BindingTargetKind, SessionBindingRecord, } from "openclaw/plugin-sdk/conversation-runtime"; +import { resolveThreadBindingLifecycle } from "openclaw/plugin-sdk/conversation-runtime"; export type MatrixThreadBindingTargetKind = "subagent" | "acp"; diff --git a/extensions/matrix/src/matrix/thread-bindings.test.ts b/extensions/matrix/src/matrix/thread-bindings.test.ts index 2b447447c81..cd08c459171 100644 --- a/extensions/matrix/src/matrix/thread-bindings.test.ts +++ b/extensions/matrix/src/matrix/thread-bindings.test.ts @@ -1,12 +1,12 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import type { PluginRuntime } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { getSessionBindingService, __testing, } from "../../../../src/infra/outbound/session-binding-service.js"; +import type { PluginRuntime } from "../../runtime-api.js"; import { setMatrixRuntime } from "../runtime.js"; import { resolveMatrixStoragePaths } from "./client/storage.js"; import { @@ -30,10 +30,9 @@ const writeJsonFileAtomicallyMock = vi.hoisted(() => vi.fn<(filePath: string, value: unknown) => Promise>(), ); -vi.mock("openclaw/plugin-sdk/matrix", async () => { - const actual = await vi.importActual( - "openclaw/plugin-sdk/matrix", - ); +vi.mock("../../runtime-api.js", async () => { + const actual = + await vi.importActual("../../runtime-api.js"); pluginSdkActual.writeJsonFileAtomically = actual.writeJsonFileAtomically; return { ...actual, diff --git a/extensions/matrix/src/onboarding.resolve.test.ts b/extensions/matrix/src/onboarding.resolve.test.ts index f1d610aa5d4..270343b7509 100644 --- a/extensions/matrix/src/onboarding.resolve.test.ts +++ b/extensions/matrix/src/onboarding.resolve.test.ts @@ -1,5 +1,5 @@ -import type { RuntimeEnv, WizardPrompter } from "openclaw/plugin-sdk/matrix"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import type { RuntimeEnv, WizardPrompter } from "../runtime-api.js"; import type { CoreConfig } from "./types.js"; const resolveMatrixTargetsMock = vi.hoisted(() => diff --git a/extensions/matrix/src/onboarding.test.ts b/extensions/matrix/src/onboarding.test.ts index cb5fd1ef445..b27dbf8189f 100644 --- a/extensions/matrix/src/onboarding.test.ts +++ b/extensions/matrix/src/onboarding.test.ts @@ -1,5 +1,5 @@ -import type { RuntimeEnv, WizardPrompter } from "openclaw/plugin-sdk/matrix"; import { afterEach, describe, expect, it, vi } from "vitest"; +import type { RuntimeEnv, WizardPrompter } from "../runtime-api.js"; import { matrixOnboardingAdapter } from "./onboarding.js"; import { setMatrixRuntime } from "./runtime.js"; import type { CoreConfig } from "./types.js"; diff --git a/extensions/matrix/src/outbound.test.ts b/extensions/matrix/src/outbound.test.ts index 8f695efec3a..29de2346868 100644 --- a/extensions/matrix/src/outbound.test.ts +++ b/extensions/matrix/src/outbound.test.ts @@ -1,5 +1,5 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/matrix"; import { beforeEach, describe, expect, it, vi } from "vitest"; +import type { OpenClawConfig } from "../runtime-api.js"; const mocks = vi.hoisted(() => ({ sendMessageMatrix: vi.fn(), diff --git a/extensions/matrix/src/resolve-targets.test.ts b/extensions/matrix/src/resolve-targets.test.ts index 801d61f71f5..3f0eb8dfefe 100644 --- a/extensions/matrix/src/resolve-targets.test.ts +++ b/extensions/matrix/src/resolve-targets.test.ts @@ -1,5 +1,5 @@ -import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/matrix"; import { describe, expect, it, vi, beforeEach } from "vitest"; +import type { ChannelDirectoryEntry } from "../runtime-api.js"; import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js"; import { resolveMatrixTargets } from "./resolve-targets.js"; diff --git a/extensions/matrix/src/runtime-api.ts b/extensions/matrix/src/runtime-api.ts index b23758626c0..39e38660028 100644 --- a/extensions/matrix/src/runtime-api.ts +++ b/extensions/matrix/src/runtime-api.ts @@ -1,4 +1,4 @@ -export * from "openclaw/plugin-sdk/matrix"; +export * from "../../../src/plugin-sdk/matrix.js"; export { assertHttpUrlTargetsPrivateNetwork, closeDispatcher, diff --git a/extensions/mattermost/runtime-api.ts b/extensions/mattermost/runtime-api.ts index d4e591c8c1e..2bc65439262 100644 --- a/extensions/mattermost/runtime-api.ts +++ b/extensions/mattermost/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Mattermost extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/mattermost"; +export * from "../../src/plugin-sdk/mattermost.js"; diff --git a/extensions/mattermost/src/channel.ts b/extensions/mattermost/src/channel.ts index 94c5bbff092..476c2c2d19e 100644 --- a/extensions/mattermost/src/channel.ts +++ b/extensions/mattermost/src/channel.ts @@ -1,17 +1,19 @@ import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from"; +import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-actions"; import { createScopedChannelConfigAdapter, createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; +import type { + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelMessageToolDiscovery, +} from "openclaw/plugin-sdk/channel-contract"; +import { createLoggedPairingApprovalNotifier } from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderRestrictSendersWarningCollector } from "openclaw/plugin-sdk/channel-policy"; -import { - createAttachedChannelResultAdapter, - createChannelDirectoryAdapter, - createLoggedPairingApprovalNotifier, - createMessageToolButtonsSchema, - createScopedAccountReplyToModeResolver, - type ChannelMessageToolDiscovery, -} from "openclaw/plugin-sdk/channel-runtime"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; +import { createScopedAccountReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; +import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; import { MattermostConfigSchema } from "./config-schema.js"; import { resolveMattermostGroupRequireMention } from "./group-mentions.js"; @@ -39,8 +41,6 @@ import { DEFAULT_ACCOUNT_ID, resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, - type ChannelMessageActionAdapter, - type ChannelMessageActionName, type ChannelPlugin, } from "./runtime-api.js"; import { getMattermostRuntime } from "./runtime.js"; diff --git a/extensions/mattermost/src/session-route.ts b/extensions/mattermost/src/session-route.ts index 14352708986..39f12e37127 100644 --- a/extensions/mattermost/src/session-route.ts +++ b/extensions/mattermost/src/session-route.ts @@ -1,11 +1,11 @@ import { buildChannelOutboundSessionRoute, - normalizeOutboundThreadId, resolveThreadSessionKeys, stripChannelTargetPrefix, stripTargetKindPrefix, type ChannelOutboundSessionRouteParams, } from "openclaw/plugin-sdk/core"; +import { normalizeOutboundThreadId } from "openclaw/plugin-sdk/routing"; export function resolveMattermostOutboundSessionRoute(params: ChannelOutboundSessionRouteParams) { let trimmed = stripChannelTargetPrefix(params.target, "mattermost"); diff --git a/extensions/mattermost/src/setup-core.ts b/extensions/mattermost/src/setup-core.ts index 36954819fd5..14576f4f5d4 100644 --- a/extensions/mattermost/src/setup-core.ts +++ b/extensions/mattermost/src/setup-core.ts @@ -1,4 +1,4 @@ -import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-setup"; import { resolveMattermostAccount, type ResolvedMattermostAccount } from "./mattermost/accounts.js"; import { normalizeMattermostBaseUrl } from "./mattermost/client.js"; import { diff --git a/extensions/minimax/index.ts b/extensions/minimax/index.ts index 7dfd9816264..aca00927171 100644 --- a/extensions/minimax/index.ts +++ b/extensions/minimax/index.ts @@ -10,7 +10,7 @@ import { ensureAuthProfileStore, listProfilesForProvider, } from "openclaw/plugin-sdk/provider-auth"; -import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-oauth"; +import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth"; import { fetchMinimaxUsage } from "openclaw/plugin-sdk/provider-usage"; import { minimaxMediaUnderstandingProvider, diff --git a/extensions/minimax/oauth.ts b/extensions/minimax/oauth.ts index 20296b2a710..818b29b0372 100644 --- a/extensions/minimax/oauth.ts +++ b/extensions/minimax/oauth.ts @@ -1,8 +1,5 @@ import { randomBytes, randomUUID } from "node:crypto"; -import { - generatePkceVerifierChallenge, - toFormUrlEncoded, -} from "openclaw/plugin-sdk/provider-oauth"; +import { generatePkceVerifierChallenge, toFormUrlEncoded } from "openclaw/plugin-sdk/provider-auth"; export type MiniMaxRegion = "cn" | "global"; diff --git a/extensions/msteams/runtime-api.ts b/extensions/msteams/runtime-api.ts index d32cb7b65d5..e2b75780399 100644 --- a/extensions/msteams/runtime-api.ts +++ b/extensions/msteams/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Microsoft Teams extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/msteams"; +export * from "../../src/plugin-sdk/msteams.js"; diff --git a/extensions/msteams/src/channel.ts b/extensions/msteams/src/channel.ts index dc328e46ffc..8a4e66fab9c 100644 --- a/extensions/msteams/src/channel.ts +++ b/extensions/msteams/src/channel.ts @@ -1,22 +1,24 @@ import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from"; +import { createMessageToolCardSchema } from "openclaw/plugin-sdk/channel-actions"; import { createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers"; +import type { + ChannelMessageActionAdapter, + ChannelMessageToolDiscovery, +} from "openclaw/plugin-sdk/channel-contract"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderGroupPolicyWarningCollector, projectWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; import { createChannelDirectoryAdapter, - createMessageToolCardSchema, - createPairingPrefixStripper, createRuntimeDirectoryLiveAdapter, - createRuntimeOutboundDelegates, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { - ChannelMessageActionAdapter, - ChannelMessageToolDiscovery, -} from "openclaw/plugin-sdk/channel-runtime"; -import { listDirectoryEntriesFromSources } from "openclaw/plugin-sdk/directory-runtime"; + listDirectoryEntriesFromSources, +} from "openclaw/plugin-sdk/directory-runtime"; +import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/infra-runtime"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "../runtime-api.js"; import { diff --git a/extensions/msteams/src/outbound.ts b/extensions/msteams/src/outbound.ts index cf482825ed2..0e34f637736 100644 --- a/extensions/msteams/src/outbound.ts +++ b/extensions/msteams/src/outbound.ts @@ -1,5 +1,5 @@ -import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; +import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; import type { ChannelOutboundAdapter } from "../runtime-api.js"; import { createMSTeamsPollStoreFs } from "./polls.js"; import { getMSTeamsRuntime } from "./runtime.js"; diff --git a/extensions/msteams/src/resolve-allowlist.ts b/extensions/msteams/src/resolve-allowlist.ts index 3e28cf8a8cb..a5145bebf0f 100644 --- a/extensions/msteams/src/resolve-allowlist.ts +++ b/extensions/msteams/src/resolve-allowlist.ts @@ -1,4 +1,4 @@ -import { mapAllowlistResolutionInputs } from "openclaw/plugin-sdk/allowlist-resolution"; +import { mapAllowlistResolutionInputs } from "openclaw/plugin-sdk/allow-from"; import { searchGraphUsers } from "./graph-users.js"; import { listChannelsForTeam, diff --git a/extensions/nextcloud-talk/runtime-api.ts b/extensions/nextcloud-talk/runtime-api.ts index b2093a7a057..80bc1b1dc7b 100644 --- a/extensions/nextcloud-talk/runtime-api.ts +++ b/extensions/nextcloud-talk/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Nextcloud Talk extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/nextcloud-talk"; +export * from "../../src/plugin-sdk/nextcloud-talk.js"; diff --git a/extensions/nextcloud-talk/src/channel.ts b/extensions/nextcloud-talk/src/channel.ts index ff316e3a533..880be995ab8 100644 --- a/extensions/nextcloud-talk/src/channel.ts +++ b/extensions/nextcloud-talk/src/channel.ts @@ -4,12 +4,12 @@ import { createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle"; -import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { - createAttachedChannelResultAdapter, createLoggedPairingApprovalNotifier, createPairingPrefixStripper, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-pairing"; +import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { runStoppablePassiveMonitor } from "openclaw/plugin-sdk/extension-shared"; import { buildBaseChannelStatusSummary, diff --git a/extensions/nextcloud-talk/src/setup-core.ts b/extensions/nextcloud-talk/src/setup-core.ts index 6aaf7aafbe8..1059cd0a63a 100644 --- a/extensions/nextcloud-talk/src/setup-core.ts +++ b/extensions/nextcloud-talk/src/setup-core.ts @@ -1,5 +1,4 @@ -import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelSetupInput } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelSetupAdapter, ChannelSetupInput } from "openclaw/plugin-sdk/channel-setup"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing"; import { diff --git a/extensions/nextcloud-talk/src/setup-surface.ts b/extensions/nextcloud-talk/src/setup-surface.ts index 776a9a4fe3e..4aa27c91009 100644 --- a/extensions/nextcloud-talk/src/setup-surface.ts +++ b/extensions/nextcloud-talk/src/setup-surface.ts @@ -1,7 +1,7 @@ -import type { ChannelSetupInput } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelSetupInput } from "openclaw/plugin-sdk/channel-setup"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/config-runtime"; import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing"; +import { hasConfiguredSecretInput } from "openclaw/plugin-sdk/secret-input"; import { setSetupChannelEnabled } from "openclaw/plugin-sdk/setup"; import { type ChannelSetupWizard } from "openclaw/plugin-sdk/setup"; import { formatDocsLink } from "openclaw/plugin-sdk/setup"; diff --git a/extensions/nostr/runtime-api.ts b/extensions/nostr/runtime-api.ts index 29825771891..602b0ac81b7 100644 --- a/extensions/nostr/runtime-api.ts +++ b/extensions/nostr/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Nostr extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/nostr"; +export * from "../../src/plugin-sdk/nostr.js"; diff --git a/extensions/nostr/src/setup-surface.ts b/extensions/nostr/src/setup-surface.ts index 9c7a1512624..bdcb2ca31bf 100644 --- a/extensions/nostr/src/setup-surface.ts +++ b/extensions/nostr/src/setup-surface.ts @@ -1,4 +1,4 @@ -import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelSetupAdapter } from "openclaw/plugin-sdk/channel-setup"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing"; import { diff --git a/extensions/openai/openai-codex-provider.ts b/extensions/openai/openai-codex-provider.ts index 5027f486bb0..36af1146758 100644 --- a/extensions/openai/openai-codex-provider.ts +++ b/extensions/openai/openai-codex-provider.ts @@ -9,6 +9,7 @@ import { listProfilesForProvider, type OAuthCredential, } from "openclaw/plugin-sdk/provider-auth"; +import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth"; import { loginOpenAICodexOAuth } from "openclaw/plugin-sdk/provider-auth-login"; import { DEFAULT_CONTEXT_TOKENS, @@ -16,7 +17,6 @@ import { normalizeProviderId, type ProviderPlugin, } from "openclaw/plugin-sdk/provider-models"; -import { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-oauth"; import { createOpenAIAttributionHeadersWrapper } from "openclaw/plugin-sdk/provider-stream"; import { fetchCodexUsage } from "openclaw/plugin-sdk/provider-usage"; import { buildOpenAICodexProvider } from "./openai-codex-catalog.js"; diff --git a/extensions/qwen-portal-auth/runtime-api.ts b/extensions/qwen-portal-auth/runtime-api.ts index 52ad77bf6f0..5fbd1e571b4 100644 --- a/extensions/qwen-portal-auth/runtime-api.ts +++ b/extensions/qwen-portal-auth/runtime-api.ts @@ -1,10 +1,7 @@ -export { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-oauth"; +export { buildOauthProviderAuthResult } from "openclaw/plugin-sdk/provider-auth"; export { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry"; export type { ProviderAuthContext, ProviderCatalogContext } from "openclaw/plugin-sdk/plugin-entry"; export { ensureAuthProfileStore, listProfilesForProvider } from "openclaw/plugin-sdk/provider-auth"; export { QWEN_OAUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime"; -export { - generatePkceVerifierChallenge, - toFormUrlEncoded, -} from "openclaw/plugin-sdk/provider-oauth"; +export { generatePkceVerifierChallenge, toFormUrlEncoded } from "openclaw/plugin-sdk/provider-auth"; export { refreshQwenPortalCredentials } from "./refresh.js"; diff --git a/extensions/shared/passive-monitor.ts b/extensions/shared/passive-monitor.ts index 435f934b123..f9cd2ed58ab 100644 --- a/extensions/shared/passive-monitor.ts +++ b/extensions/shared/passive-monitor.ts @@ -1,4 +1,4 @@ -import { runPassiveAccountLifecycle } from "openclaw/plugin-sdk/channel-runtime"; +import { runPassiveAccountLifecycle } from "openclaw/plugin-sdk/channel-lifecycle"; type StoppableMonitor = { stop: () => void; diff --git a/extensions/signal/src/channel.ts b/extensions/signal/src/channel.ts index 6ba7fce6084..9612951c3b4 100644 --- a/extensions/signal/src/channel.ts +++ b/extensions/signal/src/channel.ts @@ -1,16 +1,17 @@ import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit"; import { - attachChannelToResult, - createAttachedChannelResultAdapter, createPairingPrefixStripper, createTextPairingAdapter, - resolveOutboundSendDep, -} from "openclaw/plugin-sdk/channel-runtime"; -import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result"; +} from "openclaw/plugin-sdk/channel-pairing"; +import { + attachChannelToResult, + attachChannelToResults, + createAttachedChannelResultAdapter, +} from "openclaw/plugin-sdk/channel-send-result"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; -import { buildOutboundBaseSessionKey } from "openclaw/plugin-sdk/core"; +import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { type RoutePeer } from "openclaw/plugin-sdk/routing"; +import { buildOutboundBaseSessionKey, type RoutePeer } from "openclaw/plugin-sdk/routing"; import { resolveSignalAccount, type ResolvedSignalAccount } from "./accounts.js"; import { markdownToSignalTextChunks } from "./format.js"; import { diff --git a/extensions/signal/src/message-actions.ts b/extensions/signal/src/message-actions.ts index c6082848f02..2645908f3e9 100644 --- a/extensions/signal/src/message-actions.ts +++ b/extensions/signal/src/message-actions.ts @@ -1,11 +1,9 @@ -import { - createActionGate, - jsonResult, - readStringParam, - resolveReactionMessageId, - type ChannelMessageActionAdapter, - type ChannelMessageActionName, -} from "openclaw/plugin-sdk/channel-runtime"; +import { createActionGate, jsonResult, readStringParam } from "openclaw/plugin-sdk/agent-runtime"; +import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions"; +import type { + ChannelMessageActionAdapter, + ChannelMessageActionName, +} from "openclaw/plugin-sdk/channel-contract"; import { listEnabledSignalAccounts, resolveSignalAccount } from "./accounts.js"; import { resolveSignalReactionLevel } from "./reaction-level.js"; import { removeReactionSignal, sendReactionSignal } from "./send-reactions.js"; diff --git a/extensions/signal/src/monitor.ts b/extensions/signal/src/monitor.ts index b0e601fc01e..9aa32731b1d 100644 --- a/extensions/signal/src/monitor.ts +++ b/extensions/signal/src/monitor.ts @@ -9,6 +9,7 @@ import { import type { BackoffPolicy } from "openclaw/plugin-sdk/infra-runtime"; import { waitForTransportReady } from "openclaw/plugin-sdk/infra-runtime"; import { saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime"; +import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import { deliverTextOrMediaReply, resolveSendableOutboundReplyParts, @@ -19,7 +20,6 @@ import { resolveChunkMode, resolveTextChunkLimit, } from "openclaw/plugin-sdk/reply-runtime"; -import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; import { createNonExitingRuntime, type RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import { normalizeStringEntries } from "openclaw/plugin-sdk/text-runtime"; import { normalizeE164 } from "openclaw/plugin-sdk/text-runtime"; diff --git a/extensions/signal/src/monitor/event-handler.ts b/extensions/signal/src/monitor/event-handler.ts index 23eb676ae82..58ff8d4f8d7 100644 --- a/extensions/signal/src/monitor/event-handler.ts +++ b/extensions/signal/src/monitor/event-handler.ts @@ -1,32 +1,33 @@ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; -import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { resolveControlCommandGate } from "openclaw/plugin-sdk/channel-runtime"; +import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback"; import { + buildMentionRegexes, createChannelInboundDebouncer, - shouldDebounceTextInbound, -} from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop, logTypingFailure } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk/channel-runtime"; -import { normalizeSignalMessagingTarget } from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/config-runtime"; -import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; -import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; -import { kindFromMime } from "openclaw/plugin-sdk/media-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; -import { formatInboundEnvelope, formatInboundFromLabel, + matchesMentionPatterns, resolveEnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; + shouldDebounceTextInbound, +} from "openclaw/plugin-sdk/channel-inbound"; +import { + logInboundDrop, + resolveMentionGatingWithBypass, +} from "openclaw/plugin-sdk/channel-inbound"; +import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; +import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/config-runtime"; +import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; +import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime"; +import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; +import { kindFromMime } from "openclaw/plugin-sdk/media-runtime"; import { buildPendingHistoryContextFromMap, clearHistoryEntriesIfEnabled, recordPendingHistoryEntryIfEnabled, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; +import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; -import { buildMentionRegexes, matchesMentionPatterns } from "openclaw/plugin-sdk/reply-runtime"; import { createReplyDispatcherWithTyping } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { danger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; @@ -46,6 +47,7 @@ import { resolveSignalSender, type SignalSender, } from "../identity.js"; +import { normalizeSignalMessagingTarget } from "../runtime-api.js"; import { sendMessageSignal, sendReadReceiptSignal, sendTypingSignal } from "../send.js"; import { handleSignalDirectMessageAccess, resolveSignalAccessState } from "./access-policy.js"; import type { diff --git a/extensions/signal/src/monitor/event-handler.types.ts b/extensions/signal/src/monitor/event-handler.types.ts index 82a96af73cc..4ccb85cde5d 100644 --- a/extensions/signal/src/monitor/event-handler.types.ts +++ b/extensions/signal/src/monitor/event-handler.types.ts @@ -4,7 +4,7 @@ import type { GroupPolicy, SignalReactionNotificationMode, } from "openclaw/plugin-sdk/config-runtime"; -import type { HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; +import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import type { SignalSender } from "../identity.js"; diff --git a/extensions/signal/src/outbound-adapter.ts b/extensions/signal/src/outbound-adapter.ts index 4471871b69b..08d54ddd052 100644 --- a/extensions/signal/src/outbound-adapter.ts +++ b/extensions/signal/src/outbound-adapter.ts @@ -1,12 +1,12 @@ -import { createScopedChannelMediaMaxBytesResolver } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { attachChannelToResult, attachChannelToResults, createAttachedChannelResultAdapter, } from "openclaw/plugin-sdk/channel-send-result"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; +import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/infra-runtime"; +import { createScopedChannelMediaMaxBytesResolver } from "openclaw/plugin-sdk/media-runtime"; import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; import { markdownToSignalTextChunks } from "./format.js"; import { sendMessageSignal } from "./send.js"; diff --git a/extensions/signal/src/probe.ts b/extensions/signal/src/probe.ts index ac7dce428e8..4fd26f12355 100644 --- a/extensions/signal/src/probe.ts +++ b/extensions/signal/src/probe.ts @@ -1,4 +1,4 @@ -import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import { signalCheck, signalRpcRequest } from "./client.js"; export type SignalProbe = BaseProbeResult & { diff --git a/extensions/signal/src/runtime-api.ts b/extensions/signal/src/runtime-api.ts index 6aeeef0adb1..172943641f8 100644 --- a/extensions/signal/src/runtime-api.ts +++ b/extensions/signal/src/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Signal extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/signal"; +export * from "../../../src/plugin-sdk/signal.js"; diff --git a/extensions/slack/src/account-inspect.ts b/extensions/slack/src/account-inspect.ts index a1620cfe33b..f465ccf2d79 100644 --- a/extensions/slack/src/account-inspect.ts +++ b/extensions/slack/src/account-inspect.ts @@ -6,7 +6,7 @@ import { import { hasConfiguredSecretInput, normalizeSecretInputString, -} from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/secret-input"; import type { SlackAccountSurfaceFields } from "./account-surface-fields.js"; import { mergeSlackAccountConfig, diff --git a/extensions/slack/src/channel-actions.ts b/extensions/slack/src/channel-actions.ts index 3d9c2417306..4502ddb36a4 100644 --- a/extensions/slack/src/channel-actions.ts +++ b/extensions/slack/src/channel-actions.ts @@ -2,7 +2,7 @@ import type { AgentToolResult } from "@mariozechner/pi-agent-core"; import { type ChannelMessageActionAdapter, type ChannelMessageToolDiscovery, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-contract"; import type { SlackActionContext } from "./action-runtime.js"; import { handleSlackAction } from "./action-runtime.js"; import { handleSlackMessageAction } from "./message-action-dispatch.js"; diff --git a/extensions/slack/src/channel.test.ts b/extensions/slack/src/channel.test.ts index 691b6126557..e9659c14d7c 100644 --- a/extensions/slack/src/channel.test.ts +++ b/extensions/slack/src/channel.test.ts @@ -1,7 +1,7 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/slack"; import { describe, expect, it, vi } from "vitest"; import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js"; import { slackOutbound } from "./outbound-adapter.js"; +import type { OpenClawConfig } from "./runtime-api.js"; const handleSlackActionMock = vi.fn(); diff --git a/extensions/slack/src/channel.ts b/extensions/slack/src/channel.ts index 7a27e73aa8d..3a2646c0152 100644 --- a/extensions/slack/src/channel.ts +++ b/extensions/slack/src/channel.ts @@ -4,20 +4,29 @@ import { createFlatAllowlistOverrideResolver, } from "openclaw/plugin-sdk/allowlist-config-edit"; import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; -import { createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { - createAttachedChannelResultAdapter, - createChannelDirectoryAdapter, createPairingPrefixStripper, - createScopedAccountReplyToModeResolver, - createRuntimeDirectoryLiveAdapter, createTextPairingAdapter, - resolveOutboundSendDep, - resolveTargetsWithOptionalToken, -} from "openclaw/plugin-sdk/channel-runtime"; -import { buildOutboundBaseSessionKey, normalizeOutboundThreadId } from "openclaw/plugin-sdk/core"; +} from "openclaw/plugin-sdk/channel-pairing"; +import { createOpenProviderConfiguredRouteWarningCollector } from "openclaw/plugin-sdk/channel-policy"; +import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; +import { resolveTargetsWithOptionalToken } from "openclaw/plugin-sdk/channel-targets"; +import { createScopedAccountReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; +import { + createChannelDirectoryAdapter, + createRuntimeDirectoryLiveAdapter, +} from "openclaw/plugin-sdk/directory-runtime"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; -import { resolveThreadSessionKeys, type RoutePeer } from "openclaw/plugin-sdk/routing"; +import { + createRuntimeOutboundDelegates, + resolveOutboundSendDep, +} from "openclaw/plugin-sdk/infra-runtime"; +import { + buildOutboundBaseSessionKey, + normalizeOutboundThreadId, + resolveThreadSessionKeys, + type RoutePeer, +} from "openclaw/plugin-sdk/routing"; import { listEnabledSlackAccounts, resolveSlackAccount, diff --git a/extensions/slack/src/config-schema.ts b/extensions/slack/src/config-schema.ts index d5f28cf7905..5b2e38e1665 100644 --- a/extensions/slack/src/config-schema.ts +++ b/extensions/slack/src/config-schema.ts @@ -1,3 +1,3 @@ -import { buildChannelConfigSchema, SlackConfigSchema } from "openclaw/plugin-sdk/slack-core"; +import { buildChannelConfigSchema, SlackConfigSchema } from "./runtime-api.js"; export const SlackChannelConfigSchema = buildChannelConfigSchema(SlackConfigSchema); diff --git a/extensions/slack/src/directory-live.ts b/extensions/slack/src/directory-live.ts index 0a8bd04af22..93d83978268 100644 --- a/extensions/slack/src/directory-live.ts +++ b/extensions/slack/src/directory-live.ts @@ -1,5 +1,7 @@ -import type { DirectoryConfigParams } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/channel-runtime"; +import type { + ChannelDirectoryEntry, + DirectoryConfigParams, +} from "openclaw/plugin-sdk/directory-runtime"; import { resolveSlackAccount } from "./accounts.js"; import { createSlackWebClient } from "./client.js"; diff --git a/extensions/slack/src/draft-stream.ts b/extensions/slack/src/draft-stream.ts index f122e2664c5..c4840b938fe 100644 --- a/extensions/slack/src/draft-stream.ts +++ b/extensions/slack/src/draft-stream.ts @@ -1,4 +1,4 @@ -import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-runtime"; +import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-lifecycle"; import { deleteSlackMessage, editSlackMessage } from "./actions.js"; import { sendMessageSlack } from "./send.js"; diff --git a/extensions/slack/src/group-policy.ts b/extensions/slack/src/group-policy.ts index d49138fb5f8..b77a63c7a81 100644 --- a/extensions/slack/src/group-policy.ts +++ b/extensions/slack/src/group-policy.ts @@ -1,9 +1,9 @@ +import type { ChannelGroupContext } from "openclaw/plugin-sdk/channel-contract"; import { resolveToolsBySender, type GroupToolPolicyBySenderConfig, type GroupToolPolicyConfig, } from "openclaw/plugin-sdk/channel-policy"; -import { type ChannelGroupContext } from "openclaw/plugin-sdk/channel-runtime"; import { normalizeHyphenSlug } from "openclaw/plugin-sdk/core"; import { inspectSlackAccount } from "./account-inspect.js"; diff --git a/extensions/slack/src/message-action-dispatch.ts b/extensions/slack/src/message-action-dispatch.ts index 55576d9e822..372ae915700 100644 --- a/extensions/slack/src/message-action-dispatch.ts +++ b/extensions/slack/src/message-action-dispatch.ts @@ -1,9 +1,9 @@ import type { AgentToolResult } from "@mariozechner/pi-agent-core"; -import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelMessageActionContext } from "openclaw/plugin-sdk/channel-contract"; import { normalizeInteractiveReply } from "openclaw/plugin-sdk/interactive-runtime"; -import { readNumberParam, readStringParam } from "openclaw/plugin-sdk/slack-core"; import { parseSlackBlocksInput } from "./blocks-input.js"; import { buildSlackInteractiveBlocks } from "./blocks-render.js"; +import { readNumberParam, readStringParam } from "./runtime-api.js"; type SlackActionInvoke = ( action: Record, diff --git a/extensions/slack/src/message-actions.ts b/extensions/slack/src/message-actions.ts index 938659c9354..5eb3bdb9e76 100644 --- a/extensions/slack/src/message-actions.ts +++ b/extensions/slack/src/message-actions.ts @@ -1,9 +1,7 @@ import { createActionGate } from "openclaw/plugin-sdk/agent-runtime"; -import type { - ChannelMessageActionName, - ChannelToolSend, -} from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelMessageActionName } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +import type { ChannelToolSend } from "openclaw/plugin-sdk/tool-send"; import { listEnabledSlackAccounts } from "./accounts.js"; export function listSlackMessageActions(cfg: OpenClawConfig): ChannelMessageActionName[] { diff --git a/extensions/slack/src/monitor/allow-list.ts b/extensions/slack/src/monitor/allow-list.ts index 32fb7f40530..0ae6de23ec1 100644 --- a/extensions/slack/src/monitor/allow-list.ts +++ b/extensions/slack/src/monitor/allow-list.ts @@ -2,7 +2,7 @@ import { compileAllowlist, resolveCompiledAllowlistMatch, type AllowlistMatch, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/allow-from"; import { normalizeHyphenSlug, normalizeStringEntries, diff --git a/extensions/slack/src/monitor/channel-config.ts b/extensions/slack/src/monitor/channel-config.ts index 32ad0e6f022..4aca5fc1422 100644 --- a/extensions/slack/src/monitor/channel-config.ts +++ b/extensions/slack/src/monitor/channel-config.ts @@ -3,7 +3,7 @@ import { buildChannelKeyCandidates, resolveChannelEntryMatchWithFallback, type ChannelMatchSource, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-targets"; import type { SlackReactionNotificationMode } from "openclaw/plugin-sdk/config-runtime"; import type { SlackMessageEvent } from "../types.js"; import { allowListMatches, normalizeAllowListLower, normalizeSlackSlug } from "./allow-list.js"; diff --git a/extensions/slack/src/monitor/context.ts b/extensions/slack/src/monitor/context.ts index f39a92ce207..0d3f5706697 100644 --- a/extensions/slack/src/monitor/context.ts +++ b/extensions/slack/src/monitor/context.ts @@ -1,5 +1,5 @@ import type { App } from "@slack/bolt"; -import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/channel-runtime"; +import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/allow-from"; import type { OpenClawConfig, SlackReactionNotificationMode, @@ -7,7 +7,7 @@ import type { import { resolveSessionKey, type SessionScope } from "openclaw/plugin-sdk/config-runtime"; import type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/config-runtime"; import { createDedupeCache } from "openclaw/plugin-sdk/infra-runtime"; -import type { HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; +import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { getChildLogger } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/slack/src/monitor/dm-auth.ts b/extensions/slack/src/monitor/dm-auth.ts index 75a0515bce7..0783fa17acf 100644 --- a/extensions/slack/src/monitor/dm-auth.ts +++ b/extensions/slack/src/monitor/dm-auth.ts @@ -1,5 +1,5 @@ +import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/allow-from"; import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing"; -import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/channel-runtime"; import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime"; import { resolveSlackAllowListMatch } from "./allow-list.js"; import type { SlackMonitorContext } from "./context.js"; diff --git a/extensions/slack/src/monitor/events/channels.ts b/extensions/slack/src/monitor/events/channels.ts index e4940f80d9f..47fdc2647c4 100644 --- a/extensions/slack/src/monitor/events/channels.ts +++ b/extensions/slack/src/monitor/events/channels.ts @@ -1,5 +1,5 @@ import type { SlackEventMiddlewareArgs } from "@slack/bolt"; -import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-helpers"; import { loadConfig, writeConfigFile } from "openclaw/plugin-sdk/config-runtime"; import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; import { danger, warn } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/slack/src/monitor/message-handler.ts b/extensions/slack/src/monitor/message-handler.ts index feaddff98df..fb700b78350 100644 --- a/extensions/slack/src/monitor/message-handler.ts +++ b/extensions/slack/src/monitor/message-handler.ts @@ -1,7 +1,7 @@ import { createChannelInboundDebouncer, shouldDebounceTextInbound, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-inbound"; import type { ResolvedSlackAccount } from "../accounts.js"; import type { SlackMessageEvent } from "../types.js"; import { stripSlackMentionsForCommandDetection } from "./commands.js"; diff --git a/extensions/slack/src/monitor/message-handler/dispatch.ts b/extensions/slack/src/monitor/message-handler/dispatch.ts index 2b31791284e..f3860c2f6bd 100644 --- a/extensions/slack/src/monitor/message-handler/dispatch.ts +++ b/extensions/slack/src/monitor/message-handler/dispatch.ts @@ -1,12 +1,15 @@ import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime"; +import { + logAckFailure, + logTypingFailure, + removeAckReactionAfterReply, +} from "openclaw/plugin-sdk/channel-feedback"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { removeAckReactionAfterReply } from "openclaw/plugin-sdk/channel-runtime"; -import { logAckFailure, logTypingFailure } from "openclaw/plugin-sdk/channel-runtime"; import { resolveStorePath, updateLastRoute } from "openclaw/plugin-sdk/config-runtime"; import { resolveAgentOutboundIdentity } from "openclaw/plugin-sdk/infra-runtime"; +import { clearHistoryEntriesIfEnabled } from "openclaw/plugin-sdk/reply-history"; import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; import { dispatchInboundMessage } from "openclaw/plugin-sdk/reply-runtime"; -import { clearHistoryEntriesIfEnabled } from "openclaw/plugin-sdk/reply-runtime"; import { createReplyDispatcherWithTyping } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/slack/src/monitor/message-handler/prepare-thread-context.ts b/extensions/slack/src/monitor/message-handler/prepare-thread-context.ts index 5d4020f1b46..e1cfc33088a 100644 --- a/extensions/slack/src/monitor/message-handler/prepare-thread-context.ts +++ b/extensions/slack/src/monitor/message-handler/prepare-thread-context.ts @@ -1,5 +1,5 @@ +import { formatInboundEnvelope } from "openclaw/plugin-sdk/channel-inbound"; import { readSessionUpdatedAt } from "openclaw/plugin-sdk/config-runtime"; -import { formatInboundEnvelope } from "openclaw/plugin-sdk/reply-runtime"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import type { ResolvedSlackAccount } from "../../accounts.js"; import type { SlackMessageEvent } from "../../types.js"; @@ -30,7 +30,7 @@ export async function resolveSlackThreadContextData(params: { storePath: string; sessionKey: string; envelopeOptions: ReturnType< - typeof import("openclaw/plugin-sdk/reply-runtime").resolveEnvelopeFormatOptions + typeof import("openclaw/plugin-sdk/channel-inbound").resolveEnvelopeFormatOptions >; effectiveDirectMedia: SlackMediaResult[] | null; }): Promise { diff --git a/extensions/slack/src/monitor/message-handler/prepare.ts b/extensions/slack/src/monitor/message-handler/prepare.ts index e6bc3a23446..1f36eef491c 100644 --- a/extensions/slack/src/monitor/message-handler/prepare.ts +++ b/extensions/slack/src/monitor/message-handler/prepare.ts @@ -2,26 +2,29 @@ import { resolveAckReaction } from "openclaw/plugin-sdk/agent-runtime"; import { shouldAckReaction as shouldAckReactionGate, type AckReactionScope, -} from "openclaw/plugin-sdk/channel-runtime"; -import { resolveControlCommandGate } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveConversationLabel } from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; -import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; -import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { shouldHandleTextCommands } from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/channel-feedback"; import { + buildMentionRegexes, formatInboundEnvelope, + logInboundDrop, + matchesMentionWithExplicit, resolveEnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; + resolveMentionGatingWithBypass, +} from "openclaw/plugin-sdk/channel-inbound"; +import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; +import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-auth"; +import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; +import { + recordInboundSession, + resolveConversationLabel, +} from "openclaw/plugin-sdk/conversation-runtime"; +import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; import { buildPendingHistoryContextFromMap, recordPendingHistoryEntryIfEnabled, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; -import { buildMentionRegexes, matchesMentionWithExplicit } from "openclaw/plugin-sdk/reply-runtime"; import type { FinalizedMsgContext } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing"; diff --git a/extensions/slack/src/monitor/provider.ts b/extensions/slack/src/monitor/provider.ts index 5a382551b47..1af83676e93 100644 --- a/extensions/slack/src/monitor/provider.ts +++ b/extensions/slack/src/monitor/provider.ts @@ -6,7 +6,7 @@ import { mergeAllowlist, patchAllowlistUsersInConfigEntries, summarizeMapping, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/allow-from"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime"; import { @@ -15,15 +15,15 @@ import { warnMissingProviderGroupPolicyFallbackOnce, } from "openclaw/plugin-sdk/config-runtime"; import type { SessionScope } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { createConnectedChannelStatusPatch } from "openclaw/plugin-sdk/gateway-runtime"; import { computeBackoff, sleepWithAbort } from "openclaw/plugin-sdk/infra-runtime"; import { installRequestBodyLimitGuard } from "openclaw/plugin-sdk/infra-runtime"; +import { DEFAULT_GROUP_HISTORY_LIMIT } from "openclaw/plugin-sdk/reply-history"; import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { DEFAULT_GROUP_HISTORY_LIMIT } from "openclaw/plugin-sdk/reply-runtime"; import { normalizeMainKey } from "openclaw/plugin-sdk/routing"; import { warn } from "openclaw/plugin-sdk/runtime-env"; import { createNonExitingRuntime, type RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; import { normalizeStringEntries } from "openclaw/plugin-sdk/text-runtime"; import { resolveSlackAccount } from "../accounts.js"; import { resolveSlackWebClientOptions } from "../client.js"; diff --git a/extensions/slack/src/monitor/slash-commands.runtime.ts b/extensions/slack/src/monitor/slash-commands.runtime.ts index aaae82a0602..6659ae61031 100644 --- a/extensions/slack/src/monitor/slash-commands.runtime.ts +++ b/extensions/slack/src/monitor/slash-commands.runtime.ts @@ -4,17 +4,17 @@ import { listNativeCommandSpecsForConfig as listNativeCommandSpecsForConfigImpl, parseCommandArgs as parseCommandArgsImpl, resolveCommandArgMenu as resolveCommandArgMenuImpl, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/command-auth"; type BuildCommandTextFromArgs = - typeof import("openclaw/plugin-sdk/reply-runtime").buildCommandTextFromArgs; + typeof import("openclaw/plugin-sdk/command-auth").buildCommandTextFromArgs; type FindCommandByNativeName = - typeof import("openclaw/plugin-sdk/reply-runtime").findCommandByNativeName; + typeof import("openclaw/plugin-sdk/command-auth").findCommandByNativeName; type ListNativeCommandSpecsForConfig = - typeof import("openclaw/plugin-sdk/reply-runtime").listNativeCommandSpecsForConfig; -type ParseCommandArgs = typeof import("openclaw/plugin-sdk/reply-runtime").parseCommandArgs; + typeof import("openclaw/plugin-sdk/command-auth").listNativeCommandSpecsForConfig; +type ParseCommandArgs = typeof import("openclaw/plugin-sdk/command-auth").parseCommandArgs; type ResolveCommandArgMenu = - typeof import("openclaw/plugin-sdk/reply-runtime").resolveCommandArgMenu; + typeof import("openclaw/plugin-sdk/command-auth").resolveCommandArgMenu; export function buildCommandTextFromArgs( ...args: Parameters diff --git a/extensions/slack/src/monitor/slash-dispatch.runtime.ts b/extensions/slack/src/monitor/slash-dispatch.runtime.ts index affa13c01dd..a9c7eaba1d3 100644 --- a/extensions/slack/src/monitor/slash-dispatch.runtime.ts +++ b/extensions/slack/src/monitor/slash-dispatch.runtime.ts @@ -1,8 +1,8 @@ +import { resolveMarkdownTableMode as resolveMarkdownTableModeImpl } from "openclaw/plugin-sdk/config-runtime"; import { recordInboundSessionMetaSafe as recordInboundSessionMetaSafeImpl, resolveConversationLabel as resolveConversationLabelImpl, -} from "openclaw/plugin-sdk/channel-runtime"; -import { resolveMarkdownTableMode as resolveMarkdownTableModeImpl } from "openclaw/plugin-sdk/config-runtime"; +} from "openclaw/plugin-sdk/conversation-runtime"; import { dispatchReplyWithDispatcher as dispatchReplyWithDispatcherImpl, finalizeInboundContext as finalizeInboundContextImpl, @@ -17,9 +17,9 @@ type FinalizeInboundContext = type DispatchReplyWithDispatcher = typeof import("openclaw/plugin-sdk/reply-runtime").dispatchReplyWithDispatcher; type ResolveConversationLabel = - typeof import("openclaw/plugin-sdk/channel-runtime").resolveConversationLabel; + typeof import("openclaw/plugin-sdk/conversation-runtime").resolveConversationLabel; type RecordInboundSessionMetaSafe = - typeof import("openclaw/plugin-sdk/channel-runtime").recordInboundSessionMetaSafe; + typeof import("openclaw/plugin-sdk/conversation-runtime").recordInboundSessionMetaSafe; type ResolveMarkdownTableMode = typeof import("openclaw/plugin-sdk/config-runtime").resolveMarkdownTableMode; type ResolveAgentRoute = typeof import("openclaw/plugin-sdk/routing").resolveAgentRoute; diff --git a/extensions/slack/src/monitor/slash-skill-commands.runtime.ts b/extensions/slack/src/monitor/slash-skill-commands.runtime.ts index ec25e104fec..926eb5a3932 100644 --- a/extensions/slack/src/monitor/slash-skill-commands.runtime.ts +++ b/extensions/slack/src/monitor/slash-skill-commands.runtime.ts @@ -1,7 +1,7 @@ -import { listSkillCommandsForAgents as listSkillCommandsForAgentsImpl } from "openclaw/plugin-sdk/reply-runtime"; +import { listSkillCommandsForAgents as listSkillCommandsForAgentsImpl } from "openclaw/plugin-sdk/command-auth"; type ListSkillCommandsForAgents = - typeof import("openclaw/plugin-sdk/reply-runtime").listSkillCommandsForAgents; + typeof import("openclaw/plugin-sdk/command-auth").listSkillCommandsForAgents; export function listSkillCommandsForAgents( ...args: Parameters diff --git a/extensions/slack/src/monitor/slash.test-harness.ts b/extensions/slack/src/monitor/slash.test-harness.ts index 48a11cf3460..f5618dde5be 100644 --- a/extensions/slack/src/monitor/slash.test-harness.ts +++ b/extensions/slack/src/monitor/slash.test-harness.ts @@ -7,7 +7,6 @@ const mocks = vi.hoisted(() => ({ resolveAgentRouteMock: vi.fn(), finalizeInboundContextMock: vi.fn(), resolveConversationLabelMock: vi.fn(), - createReplyPrefixOptionsMock: vi.fn(), recordSessionMetaFromInboundMock: vi.fn(), resolveStorePathMock: vi.fn(), })); @@ -38,12 +37,11 @@ vi.mock("openclaw/plugin-sdk/routing", async (importOriginal) => { }; }); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, resolveConversationLabel: (...args: unknown[]) => mocks.resolveConversationLabelMock(...args), - createReplyPrefixOptions: (...args: unknown[]) => mocks.createReplyPrefixOptionsMock(...args), recordInboundSessionMetaSafe: (...args: unknown[]) => mocks.recordSessionMetaFromInboundMock(...args), }; @@ -64,7 +62,6 @@ type SlashHarnessMocks = { resolveAgentRouteMock: ReturnType; finalizeInboundContextMock: ReturnType; resolveConversationLabelMock: ReturnType; - createReplyPrefixOptionsMock: ReturnType; recordSessionMetaFromInboundMock: ReturnType; resolveStorePathMock: ReturnType; }; @@ -84,7 +81,6 @@ export function resetSlackSlashMocks() { }); mocks.finalizeInboundContextMock.mockReset().mockImplementation((ctx: unknown) => ctx); mocks.resolveConversationLabelMock.mockReset().mockReturnValue(undefined); - mocks.createReplyPrefixOptionsMock.mockReset().mockReturnValue({ onModelSelected: () => {} }); mocks.recordSessionMetaFromInboundMock.mockReset().mockResolvedValue(undefined); mocks.resolveStorePathMock.mockReset().mockReturnValue("/tmp/openclaw-sessions.json"); } diff --git a/extensions/slack/src/monitor/slash.ts b/extensions/slack/src/monitor/slash.ts index e06b22d2e91..6ff790e42b2 100644 --- a/extensions/slack/src/monitor/slash.ts +++ b/extensions/slack/src/monitor/slash.ts @@ -1,12 +1,14 @@ import type { SlackActionMiddlewareArgs, SlackCommandMiddlewareArgs } from "@slack/bolt"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveNativeCommandSessionTargets } from "openclaw/plugin-sdk/channel-runtime"; +import { + resolveCommandAuthorizedFromAuthorizers, + resolveNativeCommandSessionTargets, +} from "openclaw/plugin-sdk/command-auth"; +import { type ChatCommandDefinition, type CommandArgs } from "openclaw/plugin-sdk/command-auth"; import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled, } from "openclaw/plugin-sdk/config-runtime"; -import { type ChatCommandDefinition, type CommandArgs } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { chunkItems } from "openclaw/plugin-sdk/text-runtime"; diff --git a/extensions/slack/src/outbound-adapter.ts b/extensions/slack/src/outbound-adapter.ts index ed107d4c63f..ee3946dde9b 100644 --- a/extensions/slack/src/outbound-adapter.ts +++ b/extensions/slack/src/outbound-adapter.ts @@ -1,20 +1,19 @@ -import { - resolvePayloadMediaUrls, - sendPayloadMediaSequenceAndFinalize, - sendTextMediaPayload, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; import { attachChannelToResult, + type ChannelOutboundAdapter, createAttachedChannelResultAdapter, } from "openclaw/plugin-sdk/channel-send-result"; -import type { OutboundIdentity } from "openclaw/plugin-sdk/infra-runtime"; +import { resolveOutboundSendDep, type OutboundIdentity } from "openclaw/plugin-sdk/infra-runtime"; import { resolveInteractiveTextFallback, type InteractiveReply, } from "openclaw/plugin-sdk/interactive-runtime"; import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime"; +import { + resolvePayloadMediaUrls, + sendPayloadMediaSequenceAndFinalize, + sendTextMediaPayload, +} from "openclaw/plugin-sdk/reply-payload"; import { parseSlackBlocksInput } from "./blocks-input.js"; import { buildSlackInteractiveBlocks, type SlackBlock } from "./blocks-render.js"; import { sendMessageSlack, type SlackSendIdentity } from "./send.js"; diff --git a/extensions/slack/src/probe.ts b/extensions/slack/src/probe.ts index c370b11be9b..a0d698e54b5 100644 --- a/extensions/slack/src/probe.ts +++ b/extensions/slack/src/probe.ts @@ -1,4 +1,4 @@ -import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import { withTimeout } from "openclaw/plugin-sdk/text-runtime"; import { createSlackWebClient } from "./client.js"; diff --git a/extensions/slack/src/runtime-api.ts b/extensions/slack/src/runtime-api.ts index 5dac68be756..84f7b9d480b 100644 --- a/extensions/slack/src/runtime-api.ts +++ b/extensions/slack/src/runtime-api.ts @@ -9,7 +9,7 @@ export { type ChannelPlugin, type OpenClawConfig, type SlackAccountConfig, -} from "openclaw/plugin-sdk/slack"; +} from "../../../src/plugin-sdk/slack.js"; export { listSlackDirectoryGroupsFromConfig, listSlackDirectoryPeersFromConfig, @@ -25,5 +25,5 @@ export { readStringParam, SlackConfigSchema, withNormalizedTimestamp, -} from "openclaw/plugin-sdk/slack-core"; +} from "../../../src/plugin-sdk/slack-core.js"; export { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js"; diff --git a/extensions/slack/src/targets.ts b/extensions/slack/src/targets.ts index 43162a447d5..356f990d600 100644 --- a/extensions/slack/src/targets.ts +++ b/extensions/slack/src/targets.ts @@ -6,7 +6,7 @@ import { type MessagingTarget, type MessagingTargetKind, type MessagingTargetParseOptions, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-targets"; export type SlackTargetKind = MessagingTargetKind; diff --git a/extensions/slack/src/threading-tool-context.ts b/extensions/slack/src/threading-tool-context.ts index 30451be5b6b..a6b59189dee 100644 --- a/extensions/slack/src/threading-tool-context.ts +++ b/extensions/slack/src/threading-tool-context.ts @@ -1,7 +1,7 @@ import type { ChannelThreadingContext, ChannelThreadingToolContext, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveSlackAccount, resolveSlackReplyToMode } from "./accounts.js"; diff --git a/extensions/slack/src/token.ts b/extensions/slack/src/token.ts index 36f31c89383..03c8c653344 100644 --- a/extensions/slack/src/token.ts +++ b/extensions/slack/src/token.ts @@ -1,4 +1,4 @@ -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; export function normalizeSlackToken(raw?: unknown): string | undefined { return normalizeResolvedSecretInputString({ diff --git a/extensions/synology-chat/src/channel.ts b/extensions/synology-chat/src/channel.ts index ef01c240e10..e4ae0bc857d 100644 --- a/extensions/synology-chat/src/channel.ts +++ b/extensions/synology-chat/src/channel.ts @@ -9,15 +9,13 @@ import { createScopedDmSecurityResolver, } from "openclaw/plugin-sdk/channel-config-helpers"; import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema"; +import { createTextPairingAdapter } from "openclaw/plugin-sdk/channel-pairing"; import { createConditionalWarningCollector, projectWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; -import { - attachChannelToResult, - createEmptyChannelDirectoryAdapter, - createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result"; +import { createEmptyChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/setup"; import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-ingress"; import { z } from "zod"; diff --git a/extensions/tavily/src/config.ts b/extensions/tavily/src/config.ts index 752a721d17c..7bef2dcdd51 100644 --- a/extensions/tavily/src/config.ts +++ b/extensions/tavily/src/config.ts @@ -1,6 +1,6 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { normalizeSecretInput } from "openclaw/plugin-sdk/provider-auth"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; export const DEFAULT_TAVILY_BASE_URL = "https://api.tavily.com"; export const DEFAULT_TAVILY_SEARCH_TIMEOUT_SECONDS = 30; diff --git a/extensions/telegram/runtime-api.ts b/extensions/telegram/runtime-api.ts index c069a35e40e..28c7788ef9d 100644 --- a/extensions/telegram/runtime-api.ts +++ b/extensions/telegram/runtime-api.ts @@ -7,7 +7,7 @@ export type { TelegramAccountConfig, TelegramActionConfig, TelegramNetworkConfig, -} from "openclaw/plugin-sdk/telegram"; +} from "../../src/plugin-sdk/telegram.js"; export type { OpenClawPluginService, OpenClawPluginServiceContext, @@ -37,7 +37,7 @@ export { projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, resolveTelegramPollVisibility, -} from "openclaw/plugin-sdk/telegram"; +} from "../../src/plugin-sdk/telegram.js"; export { buildChannelConfigSchema, getChatChannelMeta, @@ -49,7 +49,7 @@ export { readStringParam, resolvePollMaxSelections, TelegramConfigSchema, -} from "openclaw/plugin-sdk/telegram-core"; +} from "../../src/plugin-sdk/telegram-core.js"; export type { TelegramProbe } from "./src/probe.js"; export { auditTelegramGroupMembership, collectTelegramUnmentionedGroupIds } from "./src/audit.js"; export { telegramMessageActions } from "./src/channel-actions.js"; diff --git a/extensions/telegram/src/account-inspect.ts b/extensions/telegram/src/account-inspect.ts index 5d131a70586..47c6183fb8b 100644 --- a/extensions/telegram/src/account-inspect.ts +++ b/extensions/telegram/src/account-inspect.ts @@ -1,13 +1,13 @@ import { resolveAccountWithDefaultFallback } from "openclaw/plugin-sdk/account-resolution"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { - coerceSecretRef, - hasConfiguredSecretInput, - normalizeSecretInputString, -} from "openclaw/plugin-sdk/config-runtime"; +import { coerceSecretRef } from "openclaw/plugin-sdk/config-runtime"; import { tryReadSecretFileSync } from "openclaw/plugin-sdk/infra-runtime"; import { resolveDefaultSecretProviderAlias } from "openclaw/plugin-sdk/provider-auth"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing"; +import { + hasConfiguredSecretInput, + normalizeSecretInputString, +} from "openclaw/plugin-sdk/secret-input"; import type { TelegramAccountConfig } from "../runtime-api.js"; import { mergeTelegramAccountConfig, diff --git a/extensions/telegram/src/action-runtime.ts b/extensions/telegram/src/action-runtime.ts index c07dae07681..436f7d84874 100644 --- a/extensions/telegram/src/action-runtime.ts +++ b/extensions/telegram/src/action-runtime.ts @@ -1,6 +1,6 @@ import type { AgentToolResult } from "@mariozechner/pi-agent-core"; import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param"; -import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions"; import { resolveTelegramPollVisibility } from "../runtime-api.js"; import { jsonResult, diff --git a/extensions/telegram/src/bot-access.ts b/extensions/telegram/src/bot-access.ts index c89a8fe6f48..82034aeadb2 100644 --- a/extensions/telegram/src/bot-access.ts +++ b/extensions/telegram/src/bot-access.ts @@ -2,8 +2,8 @@ import { firstDefined, isSenderIdAllowed, mergeDmAllowFromSources, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { AllowlistMatch } from "openclaw/plugin-sdk/channel-runtime"; + type AllowlistMatch, +} from "openclaw/plugin-sdk/allow-from"; import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env"; export type NormalizedAllowFrom = { diff --git a/extensions/telegram/src/bot-deps.ts b/extensions/telegram/src/bot-deps.ts index a21c4f0c586..93aac0c8b8f 100644 --- a/extensions/telegram/src/bot-deps.ts +++ b/extensions/telegram/src/bot-deps.ts @@ -1,12 +1,12 @@ +import { + buildModelsProviderData, + listSkillCommandsForAgents, +} from "openclaw/plugin-sdk/command-auth"; import { loadConfig, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; import { readChannelAllowFromStore } from "openclaw/plugin-sdk/conversation-runtime"; import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime"; import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; -import { - buildModelsProviderData, - dispatchReplyWithBufferedBlockDispatcher, - listSkillCommandsForAgents, -} from "openclaw/plugin-sdk/reply-runtime"; +import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/reply-runtime"; import { wasSentByBot } from "./sent-message-cache.js"; export type TelegramBotDeps = { diff --git a/extensions/telegram/src/bot-handlers.buffers.ts b/extensions/telegram/src/bot-handlers.buffers.ts index 41dcee18aa4..7d301251176 100644 --- a/extensions/telegram/src/bot-handlers.buffers.ts +++ b/extensions/telegram/src/bot-handlers.buffers.ts @@ -1,10 +1,10 @@ import type { Message } from "@grammyjs/types"; -import { shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-runtime"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { createInboundDebouncer, resolveInboundDebounceMs, -} from "openclaw/plugin-sdk/reply-runtime"; + shouldDebounceTextInbound, +} from "openclaw/plugin-sdk/channel-inbound"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { danger, logVerbose, warn } from "openclaw/plugin-sdk/runtime-env"; import { hasInboundMedia, diff --git a/extensions/telegram/src/bot-handlers.runtime.ts b/extensions/telegram/src/bot-handlers.runtime.ts index 00dc35041c9..6df428d1273 100644 --- a/extensions/telegram/src/bot-handlers.runtime.ts +++ b/extensions/telegram/src/bot-handlers.runtime.ts @@ -1,8 +1,18 @@ import type { Message, ReactionTypeEmoji } from "@grammyjs/types"; import { resolveAgentDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime"; import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime"; -import { shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-helpers"; +import { shouldDebounceTextInbound } from "openclaw/plugin-sdk/channel-inbound"; +import { + createInboundDebouncer, + resolveInboundDebounceMs, +} from "openclaw/plugin-sdk/channel-inbound"; +import { + buildCommandsMessagePaginated, + buildCommandsPaginationKeyboard, + formatModelsAvailableHeader, + resolveStoredModelOverride, +} from "openclaw/plugin-sdk/command-auth"; import { writeConfigFile } from "openclaw/plugin-sdk/config-runtime"; import { loadSessionStore, @@ -22,14 +32,6 @@ import { resolvePluginConversationBindingApproval, } from "openclaw/plugin-sdk/conversation-runtime"; import { dispatchPluginInteractiveHandler } from "openclaw/plugin-sdk/plugin-runtime"; -import { - createInboundDebouncer, - resolveInboundDebounceMs, -} from "openclaw/plugin-sdk/reply-runtime"; -import { buildCommandsPaginationKeyboard } from "openclaw/plugin-sdk/reply-runtime"; -import { formatModelsAvailableHeader } from "openclaw/plugin-sdk/reply-runtime"; -import { resolveStoredModelOverride } from "openclaw/plugin-sdk/reply-runtime"; -import { buildCommandsMessagePaginated } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing"; import { danger, logVerbose, warn } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/telegram/src/bot-message-context.body.ts b/extensions/telegram/src/bot-message-context.body.ts index 63e6aaa12dd..04e5739d663 100644 --- a/extensions/telegram/src/bot-message-context.body.ts +++ b/extensions/telegram/src/bot-message-context.body.ts @@ -4,22 +4,26 @@ import { modelSupportsVision, } from "openclaw/plugin-sdk/agent-runtime"; import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime"; -import { resolveControlCommandGate } from "openclaw/plugin-sdk/channel-runtime"; -import { formatLocationText, type NormalizedLocation } from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveMentionGatingWithBypass } from "openclaw/plugin-sdk/channel-runtime"; +import { + buildMentionRegexes, + formatLocationText, + logInboundDrop, + matchesMentionWithExplicit, + resolveMentionGatingWithBypass, + type NormalizedLocation, +} from "openclaw/plugin-sdk/channel-inbound"; +import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { TelegramDirectConfig, TelegramGroupConfig, TelegramTopicConfig, } from "openclaw/plugin-sdk/config-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; import { recordPendingHistoryEntryIfEnabled, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; -import { buildMentionRegexes, matchesMentionWithExplicit } from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import type { NormalizedAllowFrom } from "./bot-access.js"; diff --git a/extensions/telegram/src/bot-message-context.named-account-dm.test.ts b/extensions/telegram/src/bot-message-context.named-account-dm.test.ts index e51c7920ae7..33d1e35e470 100644 --- a/extensions/telegram/src/bot-message-context.named-account-dm.test.ts +++ b/extensions/telegram/src/bot-message-context.named-account-dm.test.ts @@ -6,8 +6,8 @@ import { import { buildTelegramMessageContextForTest } from "./bot-message-context.test-harness.js"; const recordInboundSessionMock = vi.fn().mockResolvedValue(undefined); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, recordInboundSession: (...args: unknown[]) => recordInboundSessionMock(...args), diff --git a/extensions/telegram/src/bot-message-context.session.ts b/extensions/telegram/src/bot-message-context.session.ts index 47bcda8592f..2581e1d398b 100644 --- a/extensions/telegram/src/bot-message-context.session.ts +++ b/extensions/telegram/src/bot-message-context.session.ts @@ -1,5 +1,10 @@ -import { toLocationContext } from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSession } from "openclaw/plugin-sdk/channel-runtime"; +import { + formatInboundEnvelope, + resolveEnvelopeFormatOptions, + toLocationContext, + type NormalizedLocation, +} from "openclaw/plugin-sdk/channel-inbound"; +import { normalizeCommandBody } from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { readSessionUpdatedAt, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; import type { @@ -7,15 +12,11 @@ import type { TelegramGroupConfig, TelegramTopicConfig, } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeCommandBody } from "openclaw/plugin-sdk/reply-runtime"; -import { - formatInboundEnvelope, - resolveEnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; +import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime"; import { buildPendingHistoryContextFromMap, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing"; import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing"; @@ -63,7 +64,7 @@ export async function buildTelegramInboundContextPayload(params: { stickerCacheHit: boolean; effectiveWasMentioned: boolean; commandAuthorized: boolean; - locationData?: import("openclaw/plugin-sdk/channel-runtime").NormalizedLocation; + locationData?: NormalizedLocation; options?: TelegramMessageContextOptions; dmAllowFrom?: Array; }): Promise<{ diff --git a/extensions/telegram/src/bot-message-context.ts b/extensions/telegram/src/bot-message-context.ts index 3c90a344708..046717b8175 100644 --- a/extensions/telegram/src/bot-message-context.ts +++ b/extensions/telegram/src/bot-message-context.ts @@ -1,10 +1,10 @@ import { resolveAckReaction } from "openclaw/plugin-sdk/agent-runtime"; -import { shouldAckReaction as shouldAckReactionGate } from "openclaw/plugin-sdk/channel-runtime"; -import { logInboundDrop } from "openclaw/plugin-sdk/channel-runtime"; import { createStatusReactionController, + shouldAckReaction as shouldAckReactionGate, type StatusReactionController, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-feedback"; +import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import type { TelegramDirectConfig, TelegramGroupConfig } from "openclaw/plugin-sdk/config-runtime"; import { ensureConfiguredBindingRouteReady } from "openclaw/plugin-sdk/conversation-runtime"; diff --git a/extensions/telegram/src/bot-message-context.types.ts b/extensions/telegram/src/bot-message-context.types.ts index ff782c0a1fa..a7e00397b33 100644 --- a/extensions/telegram/src/bot-message-context.types.ts +++ b/extensions/telegram/src/bot-message-context.types.ts @@ -6,7 +6,7 @@ import type { TelegramGroupConfig, TelegramTopicConfig, } from "openclaw/plugin-sdk/config-runtime"; -import type { HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; +import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import type { StickerMetadata, TelegramContext } from "./bot/types.js"; export type TelegramMediaRef = { diff --git a/extensions/telegram/src/bot-message-dispatch.ts b/extensions/telegram/src/bot-message-dispatch.ts index a5f9cb58c89..70e5acf0922 100644 --- a/extensions/telegram/src/bot-message-dispatch.ts +++ b/extensions/telegram/src/bot-message-dispatch.ts @@ -6,9 +6,12 @@ import { modelSupportsVision, } from "openclaw/plugin-sdk/agent-runtime"; import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime"; +import { + logAckFailure, + logTypingFailure, + removeAckReactionAfterReply, +} from "openclaw/plugin-sdk/channel-feedback"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { removeAckReactionAfterReply } from "openclaw/plugin-sdk/channel-runtime"; -import { logAckFailure, logTypingFailure } from "openclaw/plugin-sdk/channel-runtime"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; import { loadSessionStore, @@ -21,9 +24,9 @@ import type { TelegramAccountConfig, } from "openclaw/plugin-sdk/config-runtime"; import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"; +import { clearHistoryEntriesIfEnabled } from "openclaw/plugin-sdk/reply-history"; import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; import { resolveChunkMode } from "openclaw/plugin-sdk/reply-runtime"; -import { clearHistoryEntriesIfEnabled } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/telegram/src/bot-native-commands.menu-test-support.ts b/extensions/telegram/src/bot-native-commands.menu-test-support.ts index e74220b248a..9701802bb2a 100644 --- a/extensions/telegram/src/bot-native-commands.menu-test-support.ts +++ b/extensions/telegram/src/bot-native-commands.menu-test-support.ts @@ -34,8 +34,8 @@ const deliveryMocks = vi.hoisted(() => ({ export const listSkillCommandsForAgents = skillCommandMocks.listSkillCommandsForAgents; export const deliverReplies = deliveryMocks.deliverReplies; -vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/command-auth", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, listSkillCommandsForAgents, diff --git a/extensions/telegram/src/bot-native-commands.session-meta.test.ts b/extensions/telegram/src/bot-native-commands.session-meta.test.ts index bfe314d4140..eef2f76abda 100644 --- a/extensions/telegram/src/bot-native-commands.session-meta.test.ts +++ b/extensions/telegram/src/bot-native-commands.session-meta.test.ts @@ -73,23 +73,6 @@ vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { ...actual, resolveConfiguredBindingRoute: persistentBindingMocks.resolveConfiguredBindingRoute, ensureConfiguredBindingRouteReady: persistentBindingMocks.ensureConfiguredBindingRouteReady, - readChannelAllowFromStore: conversationStoreMocks.readChannelAllowFromStore, - upsertChannelPairingRequest: conversationStoreMocks.upsertChannelPairingRequest, - getSessionBindingService: () => ({ - bind: vi.fn(), - getCapabilities: vi.fn(), - listBySession: vi.fn(), - resolveByConversation: (ref: unknown) => sessionBindingMocks.resolveByConversation(ref), - touch: (bindingId: string, at?: number) => sessionBindingMocks.touch(bindingId, at), - unbind: vi.fn(), - }), - }; -}); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); - return { - ...actual, - createReplyPrefixOptions: vi.fn(() => ({ onModelSelected: () => {} })), recordInboundSessionMetaSafe: vi.fn( async (params: { cfg: OpenClawConfig; @@ -112,6 +95,23 @@ vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { } }, ), + readChannelAllowFromStore: conversationStoreMocks.readChannelAllowFromStore, + upsertChannelPairingRequest: conversationStoreMocks.upsertChannelPairingRequest, + getSessionBindingService: () => ({ + bind: vi.fn(), + getCapabilities: vi.fn(), + listBySession: vi.fn(), + resolveByConversation: (ref: unknown) => sessionBindingMocks.resolveByConversation(ref), + touch: (bindingId: string, at?: number) => sessionBindingMocks.touch(bindingId, at), + unbind: vi.fn(), + }), + }; +}); +vi.mock("openclaw/plugin-sdk/command-auth", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + listSkillCommandsForAgents: vi.fn(() => []), }; }); vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { @@ -120,7 +120,6 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { ...actual, finalizeInboundContext: vi.fn((ctx: unknown) => ctx), dispatchReplyWithBufferedBlockDispatcher: replyMocks.dispatchReplyWithBufferedBlockDispatcher, - listSkillCommandsForAgents: vi.fn(() => []), }; }); vi.mock("../../../src/config/sessions.js", () => ({ diff --git a/extensions/telegram/src/bot-native-commands.test-helpers.ts b/extensions/telegram/src/bot-native-commands.test-helpers.ts index 973d62485ab..65e3baf411d 100644 --- a/extensions/telegram/src/bot-native-commands.test-helpers.ts +++ b/extensions/telegram/src/bot-native-commands.test-helpers.ts @@ -22,7 +22,7 @@ type DispatchReplyWithBufferedBlockDispatcherResult = Awaited< ReturnType >; type RecordInboundSessionMetaSafeFn = - typeof import("openclaw/plugin-sdk/channel-runtime").recordInboundSessionMetaSafe; + typeof import("openclaw/plugin-sdk/conversation-runtime").recordInboundSessionMetaSafe; type AnyMock = MockFn<(...args: unknown[]) => unknown>; type AnyAsyncMock = MockFn<(...args: unknown[]) => Promise>; type NativeCommandHarness = { @@ -74,11 +74,12 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { replyPipelineMocks.dispatchReplyWithBufferedBlockDispatcher, }; }); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, recordInboundSessionMetaSafe: replyPipelineMocks.recordInboundSessionMetaSafe, + readChannelAllowFromStore: vi.fn(async () => []), }; }); vi.mock("openclaw/plugin-sdk/channel-reply-pipeline", async (importOriginal) => { @@ -95,13 +96,6 @@ const deliveryMocks = vi.hoisted(() => ({ })); export const deliverReplies = deliveryMocks.deliverReplies; vi.mock("./bot/delivery.js", () => ({ deliverReplies: deliveryMocks.deliverReplies })); -vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { - const actual = await importOriginal(); - return { - ...actual, - readChannelAllowFromStore: vi.fn(async () => []), - }; -}); export { createNativeCommandTestParams }; export function createNativeCommandsHarness(params?: { diff --git a/extensions/telegram/src/bot-native-commands.test.ts b/extensions/telegram/src/bot-native-commands.test.ts index e85a444369b..2674762b1e0 100644 --- a/extensions/telegram/src/bot-native-commands.test.ts +++ b/extensions/telegram/src/bot-native-commands.test.ts @@ -17,8 +17,8 @@ const deliveryMocks = vi.hoisted(() => ({ deliverReplies: vi.fn(async () => ({ delivered: true })), })); -vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/command-auth", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, listSkillCommandsForAgents: skillCommandMocks.listSkillCommandsForAgents, diff --git a/extensions/telegram/src/bot-native-commands.ts b/extensions/telegram/src/bot-native-commands.ts index 103cca984e0..e81713956cd 100644 --- a/extensions/telegram/src/bot-native-commands.ts +++ b/extensions/telegram/src/bot-native-commands.ts @@ -1,8 +1,19 @@ import type { Bot, Context } from "grammy"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { resolveCommandAuthorizedFromAuthorizers } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveNativeCommandSessionTargets } from "openclaw/plugin-sdk/channel-runtime"; -import { recordInboundSessionMetaSafe } from "openclaw/plugin-sdk/channel-runtime"; +import { + resolveCommandAuthorization, + resolveCommandAuthorizedFromAuthorizers, + resolveNativeCommandSessionTargets, +} from "openclaw/plugin-sdk/command-auth"; +import { + buildCommandTextFromArgs, + findCommandByNativeName, + listNativeCommandSpecs, + listNativeCommandSpecsForConfig, + parseCommandArgs, + resolveCommandArgMenu, + type CommandArgs, +} from "openclaw/plugin-sdk/command-auth"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { ChannelGroupPolicy } from "openclaw/plugin-sdk/config-runtime"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; @@ -18,7 +29,10 @@ import type { TelegramGroupConfig, TelegramTopicConfig, } from "openclaw/plugin-sdk/config-runtime"; -import { ensureConfiguredBindingRouteReady } from "openclaw/plugin-sdk/conversation-runtime"; +import { + ensureConfiguredBindingRouteReady, + recordInboundSessionMetaSafe, +} from "openclaw/plugin-sdk/conversation-runtime"; import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"; import { executePluginCommand, @@ -26,16 +40,6 @@ import { matchPluginCommand, } from "openclaw/plugin-sdk/plugin-runtime"; import { resolveChunkMode } from "openclaw/plugin-sdk/reply-runtime"; -import { resolveCommandAuthorization } from "openclaw/plugin-sdk/reply-runtime"; -import type { CommandArgs } from "openclaw/plugin-sdk/reply-runtime"; -import { - buildCommandTextFromArgs, - findCommandByNativeName, - listNativeCommandSpecs, - listNativeCommandSpecsForConfig, - parseCommandArgs, - resolveCommandArgMenu, -} from "openclaw/plugin-sdk/reply-runtime"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing"; diff --git a/extensions/telegram/src/bot.create-telegram-bot.test-harness.ts b/extensions/telegram/src/bot.create-telegram-bot.test-harness.ts index a9793692b21..6009b16947a 100644 --- a/extensions/telegram/src/bot.create-telegram-bot.test-harness.ts +++ b/extensions/telegram/src/bot.create-telegram-bot.test-harness.ts @@ -230,28 +230,40 @@ function createModelsProviderDataFromConfig(cfg: OpenClawConfig): { return { byProvider, providers, resolvedDefault }; } +vi.doMock("openclaw/plugin-sdk/command-auth", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + listSkillCommandsForAgents: skillCommandListHoisted.listSkillCommandsForAgents, + buildModelsProviderData, + }; +}); +vi.doMock("openclaw/plugin-sdk/command-auth.js", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + listSkillCommandsForAgents: skillCommandListHoisted.listSkillCommandsForAgents, + buildModelsProviderData, + }; +}); vi.doMock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { const actual = await importOriginal(); return { ...actual, - listSkillCommandsForAgents: skillCommandListHoisted.listSkillCommandsForAgents, getReplyFromConfig: replySpyHoisted.replySpy, __replySpy: replySpyHoisted.replySpy, dispatchReplyWithBufferedBlockDispatcher: dispatchReplyHoisted.dispatchReplyWithBufferedBlockDispatcher, - buildModelsProviderData, }; }); vi.doMock("openclaw/plugin-sdk/reply-runtime.js", async (importOriginal) => { const actual = await importOriginal(); return { ...actual, - listSkillCommandsForAgents: skillCommandListHoisted.listSkillCommandsForAgents, getReplyFromConfig: replySpyHoisted.replySpy, __replySpy: replySpyHoisted.replySpy, dispatchReplyWithBufferedBlockDispatcher: dispatchReplyHoisted.dispatchReplyWithBufferedBlockDispatcher, - buildModelsProviderData, }; }); diff --git a/extensions/telegram/src/bot.ts b/extensions/telegram/src/bot.ts index 36dcc0f5db2..479560c8e38 100644 --- a/extensions/telegram/src/bot.ts +++ b/extensions/telegram/src/bot.ts @@ -1,9 +1,4 @@ import { resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime"; -import { - resolveThreadBindingIdleTimeoutMsForChannel, - resolveThreadBindingMaxAgeMsForChannel, - resolveThreadBindingSpawnPolicy, -} from "openclaw/plugin-sdk/channel-runtime"; import { isNativeCommandsExplicitlyDisabled, resolveNativeCommandsEnabled, @@ -15,9 +10,14 @@ import { resolveChannelGroupRequireMention, } from "openclaw/plugin-sdk/config-runtime"; import { loadSessionStore, resolveStorePath } from "openclaw/plugin-sdk/config-runtime"; +import { + resolveThreadBindingIdleTimeoutMsForChannel, + resolveThreadBindingMaxAgeMsForChannel, + resolveThreadBindingSpawnPolicy, +} from "openclaw/plugin-sdk/conversation-runtime"; import { formatUncaughtError } from "openclaw/plugin-sdk/infra-runtime"; +import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry } from "openclaw/plugin-sdk/reply-history"; import { resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; import { getChildLogger } from "openclaw/plugin-sdk/runtime-env"; import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/telegram/src/bot/helpers.ts b/extensions/telegram/src/bot/helpers.ts index 98ec1f1aaf6..29561953466 100644 --- a/extensions/telegram/src/bot/helpers.ts +++ b/extensions/telegram/src/bot/helpers.ts @@ -1,5 +1,5 @@ import type { Chat, Message, MessageOrigin, User } from "@grammyjs/types"; -import { formatLocationText, type NormalizedLocation } from "openclaw/plugin-sdk/channel-runtime"; +import { formatLocationText, type NormalizedLocation } from "openclaw/plugin-sdk/channel-inbound"; import { resolveTelegramPreviewStreamMode } from "openclaw/plugin-sdk/config-runtime"; import type { TelegramDirectConfig, diff --git a/extensions/telegram/src/channel-actions.ts b/extensions/telegram/src/channel-actions.ts index d01c5f91839..5cb17a2ee12 100644 --- a/extensions/telegram/src/channel-actions.ts +++ b/extensions/telegram/src/channel-actions.ts @@ -1,13 +1,15 @@ import { - createMessageToolButtonsSchema, createUnionActionGate, listTokenSourcedAccounts, resolveReactionMessageId, - type ChannelMessageActionAdapter, - type ChannelMessageActionName, - type ChannelMessageToolDiscovery, - type ChannelMessageToolSchemaContribution, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-actions"; +import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-actions"; +import type { + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelMessageToolDiscovery, + ChannelMessageToolSchemaContribution, +} from "openclaw/plugin-sdk/channel-contract"; import type { TelegramActionConfig } from "openclaw/plugin-sdk/config-runtime"; import { extractToolSend } from "openclaw/plugin-sdk/tool-send"; import { diff --git a/extensions/telegram/src/channel.test.ts b/extensions/telegram/src/channel.test.ts index c9e8df40be0..1a174f7200f 100644 --- a/extensions/telegram/src/channel.test.ts +++ b/extensions/telegram/src/channel.test.ts @@ -1,10 +1,10 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; import type { ChannelAccountSnapshot, ChannelGatewayContext, - OpenClawConfig, - PluginRuntime, -} from "openclaw/plugin-sdk/telegram"; -import { afterEach, describe, expect, it, vi } from "vitest"; +} from "../../../src/channels/plugins/types.js"; +import type { OpenClawConfig } from "../../../src/config/config.js"; +import type { PluginRuntime } from "../../../src/plugins/runtime/types.js"; import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js"; import type { ResolvedTelegramAccount } from "./accounts.js"; import * as auditModule from "./audit.js"; diff --git a/extensions/telegram/src/channel.ts b/extensions/telegram/src/channel.ts index 25c81509820..a56606af2e0 100644 --- a/extensions/telegram/src/channel.ts +++ b/extensions/telegram/src/channel.ts @@ -3,22 +3,27 @@ import { createNestedAllowlistOverrideResolver, } from "openclaw/plugin-sdk/allowlist-config-edit"; import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; +import { + createPairingPrefixStripper, + createTextPairingAdapter, +} from "openclaw/plugin-sdk/channel-pairing"; import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { attachChannelToResult, createAttachedChannelResultAdapter, - createChannelDirectoryAdapter, - createPairingPrefixStripper, - createTopLevelChannelReplyToModeResolver, - createTextPairingAdapter, - normalizeMessageChannel, - type OutboundSendDeps, - resolveOutboundSendDep, -} from "openclaw/plugin-sdk/channel-runtime"; -import { buildOutboundBaseSessionKey, normalizeOutboundThreadId } from "openclaw/plugin-sdk/core"; +} from "openclaw/plugin-sdk/channel-send-result"; +import { createTopLevelChannelReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; +import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { resolveExecApprovalCommandDisplay } from "openclaw/plugin-sdk/infra-runtime"; import { buildExecApprovalPendingReplyPayload } from "openclaw/plugin-sdk/infra-runtime"; -import { resolveThreadSessionKeys, type RoutePeer } from "openclaw/plugin-sdk/routing"; +import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/infra-runtime"; +import { + buildOutboundBaseSessionKey, + normalizeMessageChannel, + normalizeOutboundThreadId, + resolveThreadSessionKeys, + type RoutePeer, +} from "openclaw/plugin-sdk/routing"; import { parseTelegramTopicConversation } from "../runtime-api.js"; import { buildTokenChannelStatusSummary, diff --git a/extensions/telegram/src/config-schema.ts b/extensions/telegram/src/config-schema.ts index ec32270c2f2..ea385dcd3a8 100644 --- a/extensions/telegram/src/config-schema.ts +++ b/extensions/telegram/src/config-schema.ts @@ -1,3 +1,3 @@ -import { buildChannelConfigSchema, TelegramConfigSchema } from "openclaw/plugin-sdk/telegram-core"; +import { buildChannelConfigSchema, TelegramConfigSchema } from "../runtime-api.js"; export const TelegramChannelConfigSchema = buildChannelConfigSchema(TelegramConfigSchema); diff --git a/extensions/telegram/src/draft-stream.ts b/extensions/telegram/src/draft-stream.ts index baebe687c50..ae943f169d3 100644 --- a/extensions/telegram/src/draft-stream.ts +++ b/extensions/telegram/src/draft-stream.ts @@ -1,5 +1,5 @@ import type { Bot } from "grammy"; -import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-runtime"; +import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-lifecycle"; import { resolveGlobalSingleton } from "openclaw/plugin-sdk/text-runtime"; import { buildTelegramThreadParams, type TelegramThreadSpec } from "./bot/helpers.js"; import { isSafeToRetrySendError, isTelegramClientRejection } from "./network-errors.js"; diff --git a/extensions/telegram/src/group-policy.ts b/extensions/telegram/src/group-policy.ts index a90e930a4a5..29614436ccc 100644 --- a/extensions/telegram/src/group-policy.ts +++ b/extensions/telegram/src/group-policy.ts @@ -1,9 +1,9 @@ +import type { ChannelGroupContext } from "openclaw/plugin-sdk/channel-contract"; import { resolveChannelGroupRequireMention, resolveChannelGroupToolsPolicy, type GroupToolPolicyConfig, } from "openclaw/plugin-sdk/channel-policy"; -import { type ChannelGroupContext } from "openclaw/plugin-sdk/channel-runtime"; function parseTelegramGroupId(value?: string | null) { const raw = value?.trim() ?? ""; diff --git a/extensions/telegram/src/outbound-adapter.ts b/extensions/telegram/src/outbound-adapter.ts index b5cb70a2c66..b500fb870cf 100644 --- a/extensions/telegram/src/outbound-adapter.ts +++ b/extensions/telegram/src/outbound-adapter.ts @@ -1,14 +1,14 @@ -import { - resolvePayloadMediaUrls, - sendPayloadMediaSequenceOrFallback, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { attachChannelToResult, createAttachedChannelResultAdapter, } from "openclaw/plugin-sdk/channel-send-result"; +import { resolveOutboundSendDep, type OutboundSendDeps } from "openclaw/plugin-sdk/infra-runtime"; import { resolveInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime"; +import { + resolvePayloadMediaUrls, + sendPayloadMediaSequenceOrFallback, +} from "openclaw/plugin-sdk/reply-payload"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import type { TelegramInlineButtons } from "./button-types.js"; import { resolveTelegramInlineButtons } from "./button-types.js"; diff --git a/extensions/telegram/src/probe.ts b/extensions/telegram/src/probe.ts index 60d9b3a3a40..d297635e4a1 100644 --- a/extensions/telegram/src/probe.ts +++ b/extensions/telegram/src/probe.ts @@ -1,4 +1,4 @@ -import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import { fetchWithTimeout } from "openclaw/plugin-sdk/text-runtime"; import type { TelegramNetworkConfig } from "../runtime-api.js"; import { resolveTelegramFetch } from "./fetch.js"; diff --git a/extensions/telegram/src/status-issues.ts b/extensions/telegram/src/status-issues.ts index 0178c0c7346..b819308503a 100644 --- a/extensions/telegram/src/status-issues.ts +++ b/extensions/telegram/src/status-issues.ts @@ -1,13 +1,13 @@ +import type { + ChannelAccountSnapshot, + ChannelStatusIssue, +} from "openclaw/plugin-sdk/channel-contract"; import { appendMatchMetadata, asString, isRecord, resolveEnabledConfiguredAccountId, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { - ChannelAccountSnapshot, - ChannelStatusIssue, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/status-helpers"; type TelegramAccountStatus = { accountId?: unknown; diff --git a/extensions/telegram/src/status-reaction-variants.ts b/extensions/telegram/src/status-reaction-variants.ts index 8c04a87554e..7d995a23168 100644 --- a/extensions/telegram/src/status-reaction-variants.ts +++ b/extensions/telegram/src/status-reaction-variants.ts @@ -1,4 +1,4 @@ -import { DEFAULT_EMOJIS, type StatusReactionEmojis } from "openclaw/plugin-sdk/channel-runtime"; +import { DEFAULT_EMOJIS, type StatusReactionEmojis } from "openclaw/plugin-sdk/channel-feedback"; type StatusReactionEmojiKey = keyof Required; diff --git a/extensions/telegram/src/thread-bindings.ts b/extensions/telegram/src/thread-bindings.ts index 0078c3362e6..be734804efb 100644 --- a/extensions/telegram/src/thread-bindings.ts +++ b/extensions/telegram/src/thread-bindings.ts @@ -1,11 +1,11 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { resolveThreadBindingConversationIdFromBindingId } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveThreadBindingEffectiveExpiresAt } from "openclaw/plugin-sdk/channel-runtime"; -import { formatThreadBindingDurationLabel } from "openclaw/plugin-sdk/channel-runtime"; import { + formatThreadBindingDurationLabel, registerSessionBindingAdapter, + resolveThreadBindingConversationIdFromBindingId, + resolveThreadBindingEffectiveExpiresAt, unregisterSessionBindingAdapter, type BindingTargetKind, type SessionBindingRecord, diff --git a/extensions/telegram/src/token.ts b/extensions/telegram/src/token.ts index 87ee2a7e11b..c2482772c61 100644 --- a/extensions/telegram/src/token.ts +++ b/extensions/telegram/src/token.ts @@ -1,8 +1,8 @@ -import type { BaseTokenResolution } from "openclaw/plugin-sdk/channel-runtime"; +import type { BaseTokenResolution } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; -import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/config-runtime"; import { tryReadSecretFileSync } from "openclaw/plugin-sdk/infra-runtime"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing"; +import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input"; import type { TelegramAccountConfig } from "../runtime-api.js"; export type TelegramTokenSource = "env" | "tokenFile" | "config" | "none"; diff --git a/extensions/tlon/runtime-api.ts b/extensions/tlon/runtime-api.ts index 3c2c83655c5..3ba9718868f 100644 --- a/extensions/tlon/runtime-api.ts +++ b/extensions/tlon/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Tlon extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/tlon"; +export * from "../../src/plugin-sdk/tlon.js"; diff --git a/extensions/tlon/src/channel.runtime.ts b/extensions/tlon/src/channel.runtime.ts index 56d59d6003b..c00199eeb9b 100644 --- a/extensions/tlon/src/channel.runtime.ts +++ b/extensions/tlon/src/channel.runtime.ts @@ -1,8 +1,6 @@ import crypto from "node:crypto"; -import type { - ChannelAccountSnapshot, - ChannelOutboundAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelAccountSnapshot } from "openclaw/plugin-sdk/channel-contract"; +import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-send-result"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import type { ChannelPlugin } from "openclaw/plugin-sdk/core"; import { createLoggerBackedRuntime } from "openclaw/plugin-sdk/runtime"; diff --git a/extensions/tlon/src/channel.ts b/extensions/tlon/src/channel.ts index 89e4a235b60..71752c4d1a3 100644 --- a/extensions/tlon/src/channel.ts +++ b/extensions/tlon/src/channel.ts @@ -1,10 +1,8 @@ import { createHybridChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers"; -import { - createRuntimeOutboundDelegates, - type ChannelAccountSnapshot, - type ChannelPlugin, -} from "openclaw/plugin-sdk/channel-runtime"; +import type { ChannelAccountSnapshot } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; +import type { ChannelPlugin } from "openclaw/plugin-sdk/core"; +import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/infra-runtime"; import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; import { tlonChannelConfigSchema } from "./config-schema.js"; import { resolveTlonOutboundSessionRoute } from "./session-route.js"; diff --git a/extensions/twitch/runtime-api.ts b/extensions/twitch/runtime-api.ts index 87433b1997f..9d055202a39 100644 --- a/extensions/twitch/runtime-api.ts +++ b/extensions/twitch/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Twitch extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/twitch"; +export * from "../../src/plugin-sdk/twitch.js"; diff --git a/extensions/voice-call/runtime-api.ts b/extensions/voice-call/runtime-api.ts index 9dd4fb0f3bc..f0b32548645 100644 --- a/extensions/voice-call/runtime-api.ts +++ b/extensions/voice-call/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Voice Call extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/voice-call"; +export * from "../../src/plugin-sdk/voice-call.js"; diff --git a/extensions/whatsapp/api.ts b/extensions/whatsapp/api.ts index 8bf50cefccd..c9d2ae0bcee 100644 --- a/extensions/whatsapp/api.ts +++ b/extensions/whatsapp/api.ts @@ -7,4 +7,4 @@ export { listWhatsAppDirectoryGroupsFromConfig, listWhatsAppDirectoryPeersFromConfig, } from "./src/directory-config.js"; -export { resolveWhatsAppGroupIntroHint } from "openclaw/plugin-sdk/whatsapp-core"; +export { resolveWhatsAppGroupIntroHint } from "./src/runtime-api.js"; diff --git a/extensions/whatsapp/src/agent-tools-login.ts b/extensions/whatsapp/src/agent-tools-login.ts index d53f5105ca2..653f4c5ef6b 100644 --- a/extensions/whatsapp/src/agent-tools-login.ts +++ b/extensions/whatsapp/src/agent-tools-login.ts @@ -1,6 +1,6 @@ import { Type } from "@sinclair/typebox"; -import type { ChannelAgentTool } from "openclaw/plugin-sdk/channel-runtime"; -import { startWebLoginWithQr, waitForWebLogin } from "openclaw/plugin-sdk/whatsapp-login-qr"; +import type { ChannelAgentTool } from "openclaw/plugin-sdk/channel-contract"; +import { startWebLoginWithQr, waitForWebLogin } from "../login-qr-api.js"; export function createWhatsAppLoginTool(): ChannelAgentTool { return { diff --git a/extensions/whatsapp/src/auto-reply/heartbeat-runner.ts b/extensions/whatsapp/src/auto-reply/heartbeat-runner.ts index 8fb27a39fe4..8c8c8639734 100644 --- a/extensions/whatsapp/src/auto-reply/heartbeat-runner.ts +++ b/extensions/whatsapp/src/auto-reply/heartbeat-runner.ts @@ -1,5 +1,4 @@ import { appendCronStyleCurrentTimeLine } from "openclaw/plugin-sdk/agent-runtime"; -import { resolveWhatsAppHeartbeatRecipients } from "openclaw/plugin-sdk/channel-runtime"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { loadSessionStore, @@ -25,6 +24,7 @@ import { normalizeMainKey } from "openclaw/plugin-sdk/routing"; import { getChildLogger } from "openclaw/plugin-sdk/runtime-env"; import { redactIdentifier } from "openclaw/plugin-sdk/text-runtime"; import { newConnectionId } from "../reconnect.js"; +import { resolveWhatsAppHeartbeatRecipients } from "../runtime-api.js"; import { sendMessageWhatsApp } from "../send.js"; import { formatError } from "../session.js"; import { whatsappHeartbeatLog } from "./loggers.js"; diff --git a/extensions/whatsapp/src/auto-reply/mentions.ts b/extensions/whatsapp/src/auto-reply/mentions.ts index ad42c814c26..967b4c1c61b 100644 --- a/extensions/whatsapp/src/auto-reply/mentions.ts +++ b/extensions/whatsapp/src/auto-reply/mentions.ts @@ -1,5 +1,5 @@ +import { buildMentionRegexes, normalizeMentionText } from "openclaw/plugin-sdk/channel-inbound"; import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; -import { buildMentionRegexes, normalizeMentionText } from "openclaw/plugin-sdk/reply-runtime"; import { isSelfChatMode, jidToE164, normalizeE164 } from "openclaw/plugin-sdk/text-runtime"; import type { WebInboundMsg } from "./types.js"; diff --git a/extensions/whatsapp/src/auto-reply/monitor.ts b/extensions/whatsapp/src/auto-reply/monitor.ts index 2f83e65079a..1997ddc38a1 100644 --- a/extensions/whatsapp/src/auto-reply/monitor.ts +++ b/extensions/whatsapp/src/auto-reply/monitor.ts @@ -1,13 +1,13 @@ +import { resolveInboundDebounceMs } from "openclaw/plugin-sdk/channel-inbound"; import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime"; import { waitForever } from "openclaw/plugin-sdk/cli-runtime"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; import { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { createConnectedChannelStatusPatch } from "openclaw/plugin-sdk/gateway-runtime"; import { formatDurationPrecise } from "openclaw/plugin-sdk/infra-runtime"; import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { resolveInboundDebounceMs } from "openclaw/plugin-sdk/reply-runtime"; +import { DEFAULT_GROUP_HISTORY_LIMIT } from "openclaw/plugin-sdk/reply-history"; import { getReplyFromConfig } from "openclaw/plugin-sdk/reply-runtime"; -import { DEFAULT_GROUP_HISTORY_LIMIT } from "openclaw/plugin-sdk/reply-runtime"; import { resolveAgentRoute } from "openclaw/plugin-sdk/routing"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { registerUnhandledRejectionHandler } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/whatsapp/src/auto-reply/monitor/ack-reaction.ts b/extensions/whatsapp/src/auto-reply/monitor/ack-reaction.ts index 126c485ec6f..bb6e1a181ab 100644 --- a/extensions/whatsapp/src/auto-reply/monitor/ack-reaction.ts +++ b/extensions/whatsapp/src/auto-reply/monitor/ack-reaction.ts @@ -1,4 +1,4 @@ -import { shouldAckReactionForWhatsApp } from "openclaw/plugin-sdk/channel-runtime"; +import { shouldAckReactionForWhatsApp } from "openclaw/plugin-sdk/channel-feedback"; import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { sendReactionWhatsApp } from "../../send.js"; diff --git a/extensions/whatsapp/src/auto-reply/monitor/group-gating.ts b/extensions/whatsapp/src/auto-reply/monitor/group-gating.ts index 847e5e3182f..d639e9e182a 100644 --- a/extensions/whatsapp/src/auto-reply/monitor/group-gating.ts +++ b/extensions/whatsapp/src/auto-reply/monitor/group-gating.ts @@ -1,8 +1,8 @@ -import { resolveMentionGating } from "openclaw/plugin-sdk/channel-runtime"; +import { resolveMentionGating } from "openclaw/plugin-sdk/channel-inbound"; +import { hasControlCommand } from "openclaw/plugin-sdk/command-auth"; import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; -import { hasControlCommand } from "openclaw/plugin-sdk/reply-runtime"; +import { recordPendingHistoryEntryIfEnabled } from "openclaw/plugin-sdk/reply-history"; import { parseActivationCommand } from "openclaw/plugin-sdk/reply-runtime"; -import { recordPendingHistoryEntryIfEnabled } from "openclaw/plugin-sdk/reply-runtime"; import { normalizeE164 } from "openclaw/plugin-sdk/text-runtime"; import type { MentionConfig } from "../mentions.js"; import { buildMentionConfig, debugMention, resolveOwnerList } from "../mentions.js"; diff --git a/extensions/whatsapp/src/auto-reply/monitor/message-line.ts b/extensions/whatsapp/src/auto-reply/monitor/message-line.ts index b9494f0325c..4b33649da43 100644 --- a/extensions/whatsapp/src/auto-reply/monitor/message-line.ts +++ b/extensions/whatsapp/src/auto-reply/monitor/message-line.ts @@ -1,9 +1,9 @@ import { resolveMessagePrefix } from "openclaw/plugin-sdk/agent-runtime"; -import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { formatInboundEnvelope, type EnvelopeFormatOptions, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/channel-inbound"; +import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import type { WebInboundMsg } from "../types.js"; export function formatReplyContext(msg: WebInboundMsg) { diff --git a/extensions/whatsapp/src/auto-reply/monitor/process-message.ts b/extensions/whatsapp/src/auto-reply/monitor/process-message.ts index 067087f87d3..255c211f0ee 100644 --- a/extensions/whatsapp/src/auto-reply/monitor/process-message.ts +++ b/extensions/whatsapp/src/auto-reply/monitor/process-message.ts @@ -1,20 +1,22 @@ import { resolveIdentityNamePrefix } from "openclaw/plugin-sdk/agent-runtime"; +import { + resolveInboundSessionEnvelopeContext, + toLocationContext, +} from "openclaw/plugin-sdk/channel-inbound"; +import { formatInboundEnvelope } from "openclaw/plugin-sdk/channel-inbound"; import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline"; -import { toLocationContext } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveInboundSessionEnvelopeContext } from "openclaw/plugin-sdk/channel-runtime"; +import { shouldComputeCommandAuthorized } from "openclaw/plugin-sdk/command-auth"; import type { loadConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime"; import { recordSessionMetaFromInbound } from "openclaw/plugin-sdk/config-runtime"; import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime"; -import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; -import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; -import { shouldComputeCommandAuthorized } from "openclaw/plugin-sdk/reply-runtime"; -import { formatInboundEnvelope } from "openclaw/plugin-sdk/reply-runtime"; -import type { getReplyFromConfig } from "openclaw/plugin-sdk/reply-runtime"; import { buildHistoryContextFromEntries, type HistoryEntry, -} from "openclaw/plugin-sdk/reply-runtime"; +} from "openclaw/plugin-sdk/reply-history"; +import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; +import { resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-runtime"; +import type { getReplyFromConfig } from "openclaw/plugin-sdk/reply-runtime"; import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime"; import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/reply-runtime"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; diff --git a/extensions/whatsapp/src/channel.directory.test.ts b/extensions/whatsapp/src/channel.directory.test.ts index 3fd58b31d4d..d9a072c86f1 100644 --- a/extensions/whatsapp/src/channel.directory.test.ts +++ b/extensions/whatsapp/src/channel.directory.test.ts @@ -1,10 +1,10 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/whatsapp"; import { describe, expect, it } from "vitest"; import { createDirectoryTestRuntime, expectDirectorySurface, } from "../../../test/helpers/extensions/directory.ts"; import { whatsappPlugin } from "./channel.js"; +import type { OpenClawConfig } from "./runtime-api.js"; describe("whatsapp directory", () => { const runtimeEnv = createDirectoryTestRuntime() as never; diff --git a/extensions/whatsapp/src/config-schema.ts b/extensions/whatsapp/src/config-schema.ts index 23f7de4058f..89681ce2d54 100644 --- a/extensions/whatsapp/src/config-schema.ts +++ b/extensions/whatsapp/src/config-schema.ts @@ -1,3 +1,3 @@ -import { buildChannelConfigSchema, WhatsAppConfigSchema } from "openclaw/plugin-sdk/whatsapp-core"; +import { buildChannelConfigSchema, WhatsAppConfigSchema } from "./runtime-api.js"; export const WhatsAppChannelConfigSchema = buildChannelConfigSchema(WhatsAppConfigSchema); diff --git a/extensions/whatsapp/src/inbound/extract.ts b/extensions/whatsapp/src/inbound/extract.ts index 9fa663847a6..b1b64e4fe91 100644 --- a/extensions/whatsapp/src/inbound/extract.ts +++ b/extensions/whatsapp/src/inbound/extract.ts @@ -4,7 +4,7 @@ import { getContentType, normalizeMessageContent, } from "@whiskeysockets/baileys"; -import { formatLocationText, type NormalizedLocation } from "openclaw/plugin-sdk/channel-runtime"; +import { formatLocationText, type NormalizedLocation } from "openclaw/plugin-sdk/channel-inbound"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { jidToE164 } from "openclaw/plugin-sdk/text-runtime"; import { parseVcard } from "../vcard.js"; diff --git a/extensions/whatsapp/src/inbound/monitor.ts b/extensions/whatsapp/src/inbound/monitor.ts index 35669bc1b49..b19e37feb69 100644 --- a/extensions/whatsapp/src/inbound/monitor.ts +++ b/extensions/whatsapp/src/inbound/monitor.ts @@ -1,9 +1,8 @@ import type { AnyMessageContent, proto, WAMessage } from "@whiskeysockets/baileys"; import { DisconnectReason, isJidGroup } from "@whiskeysockets/baileys"; -import { formatLocationText } from "openclaw/plugin-sdk/channel-runtime"; +import { createInboundDebouncer, formatLocationText } from "openclaw/plugin-sdk/channel-inbound"; import { recordChannelActivity } from "openclaw/plugin-sdk/infra-runtime"; import { saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime"; -import { createInboundDebouncer } from "openclaw/plugin-sdk/reply-runtime"; import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env"; import { getChildLogger } from "openclaw/plugin-sdk/text-runtime"; diff --git a/extensions/whatsapp/src/inbound/types.ts b/extensions/whatsapp/src/inbound/types.ts index 42e4b5121d1..731dcd2c8cc 100644 --- a/extensions/whatsapp/src/inbound/types.ts +++ b/extensions/whatsapp/src/inbound/types.ts @@ -1,5 +1,5 @@ import type { AnyMessageContent } from "@whiskeysockets/baileys"; -import type { NormalizedLocation } from "openclaw/plugin-sdk/channel-runtime"; +import type { NormalizedLocation } from "openclaw/plugin-sdk/channel-inbound"; export type WebListenerCloseReason = { status?: number; diff --git a/extensions/whatsapp/src/normalize.ts b/extensions/whatsapp/src/normalize.ts index d0506cd5883..63a1c8279bb 100644 --- a/extensions/whatsapp/src/normalize.ts +++ b/extensions/whatsapp/src/normalize.ts @@ -4,4 +4,4 @@ export { normalizeWhatsAppAllowFromEntries, normalizeWhatsAppMessagingTarget, normalizeWhatsAppTarget, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "./runtime-api.js"; diff --git a/extensions/whatsapp/src/outbound-adapter.ts b/extensions/whatsapp/src/outbound-adapter.ts index 4800e2ded43..45fa8d046e7 100644 --- a/extensions/whatsapp/src/outbound-adapter.ts +++ b/extensions/whatsapp/src/outbound-adapter.ts @@ -1,11 +1,13 @@ -import { sendTextMediaPayload } from "openclaw/plugin-sdk/channel-runtime"; -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-runtime"; -import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; import { + type ChannelOutboundAdapter, createAttachedChannelResultAdapter, createEmptyChannelResult, } from "openclaw/plugin-sdk/channel-send-result"; -import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload"; +import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; +import { + resolveSendableOutboundReplyParts, + sendTextMediaPayload, +} from "openclaw/plugin-sdk/reply-payload"; import { chunkText } from "openclaw/plugin-sdk/reply-runtime"; import { shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env"; import { resolveWhatsAppOutboundTarget } from "./runtime-api.js"; diff --git a/extensions/whatsapp/src/resolve-target.test.ts b/extensions/whatsapp/src/resolve-target.test.ts index c24b6812cae..ca5cef77b9b 100644 --- a/extensions/whatsapp/src/resolve-target.test.ts +++ b/extensions/whatsapp/src/resolve-target.test.ts @@ -1,10 +1,8 @@ import { installCommonResolveTargetErrorCases } from "openclaw/plugin-sdk/testing"; import { describe, expect, it, vi } from "vitest"; -vi.mock("openclaw/plugin-sdk/whatsapp", async () => { - const actual = await vi.importActual( - "openclaw/plugin-sdk/whatsapp", - ); +vi.mock("./runtime-api.js", async () => { + const actual = await vi.importActual("./runtime-api.js"); const normalizeWhatsAppTarget = (value: string) => { if (value === "invalid-target") return null; // Simulate E.164 normalization: strip leading + and whatsapp: prefix. @@ -84,7 +82,7 @@ describe("whatsapp resolveTarget", () => { if (!result.ok) { throw result.error; } - expect(result.to).toBe("+5511999999999"); + expect(result.to).toBe("5511999999999@s.whatsapp.net"); }); it("should resolve target in implicit mode with wildcard", () => { @@ -98,7 +96,7 @@ describe("whatsapp resolveTarget", () => { if (!result.ok) { throw result.error; } - expect(result.to).toBe("+5511999999999"); + expect(result.to).toBe("5511999999999@s.whatsapp.net"); }); it("should resolve target in implicit mode when in allowlist", () => { @@ -112,7 +110,7 @@ describe("whatsapp resolveTarget", () => { if (!result.ok) { throw result.error; } - expect(result.to).toBe("+5511999999999"); + expect(result.to).toBe("5511999999999@s.whatsapp.net"); }); it("should allow group JID regardless of allowlist", () => { diff --git a/extensions/whatsapp/src/runtime-api.ts b/extensions/whatsapp/src/runtime-api.ts index 515040ffb42..41af8dd4ea4 100644 --- a/extensions/whatsapp/src/runtime-api.ts +++ b/extensions/whatsapp/src/runtime-api.ts @@ -9,12 +9,14 @@ export { readReactionParams, readStringParam, resolveWhatsAppGroupIntroHint, + resolveWhatsAppGroupRequireMention, + resolveWhatsAppGroupToolPolicy, resolveWhatsAppOutboundTarget, ToolAuthorizationError, WhatsAppConfigSchema, type ChannelPlugin, type OpenClawConfig, -} from "openclaw/plugin-sdk/whatsapp-core"; +} from "../../../src/plugin-sdk/whatsapp-core.js"; export { createWhatsAppOutboundBase, @@ -26,6 +28,11 @@ export { type DmPolicy, type GroupPolicy, type WhatsAppAccountConfig, -} from "openclaw/plugin-sdk/whatsapp-shared"; +} from "../../../src/plugin-sdk/whatsapp-shared.js"; +export { + looksLikeWhatsAppTargetId, + normalizeWhatsAppAllowFromEntries, + normalizeWhatsAppMessagingTarget, +} from "../../../src/channels/plugins/normalize/whatsapp.js"; export { monitorWebChannel } from "./channel.runtime.js"; diff --git a/extensions/whatsapp/src/shared.ts b/extensions/whatsapp/src/shared.ts index 3e241c9f94c..fcc5bb92421 100644 --- a/extensions/whatsapp/src/shared.ts +++ b/extensions/whatsapp/src/shared.ts @@ -5,6 +5,12 @@ import { import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { createChannelPluginBase } from "openclaw/plugin-sdk/core"; import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup"; +import { + listWhatsAppAccountIds, + resolveDefaultWhatsAppAccountId, + resolveWhatsAppAccount, + type ResolvedWhatsAppAccount, +} from "./accounts.js"; import { buildChannelConfigSchema, formatWhatsAppConfigAllowFromEntries, @@ -15,13 +21,7 @@ import { resolveWhatsAppGroupToolPolicy, WhatsAppConfigSchema, type ChannelPlugin, -} from "openclaw/plugin-sdk/whatsapp-core"; -import { - listWhatsAppAccountIds, - resolveDefaultWhatsAppAccountId, - resolveWhatsAppAccount, - type ResolvedWhatsAppAccount, -} from "./accounts.js"; +} from "./runtime-api.js"; export const WHATSAPP_CHANNEL = "whatsapp" as const; diff --git a/extensions/whatsapp/src/status-issues.ts b/extensions/whatsapp/src/status-issues.ts index f369ba29cda..15e6e6b216f 100644 --- a/extensions/whatsapp/src/status-issues.ts +++ b/extensions/whatsapp/src/status-issues.ts @@ -1,13 +1,13 @@ +import type { + ChannelAccountSnapshot, + ChannelStatusIssue, +} from "openclaw/plugin-sdk/channel-contract"; +import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime"; import { asString, collectIssuesForEnabledAccounts, isRecord, -} from "openclaw/plugin-sdk/channel-runtime"; -import type { - ChannelAccountSnapshot, - ChannelStatusIssue, -} from "openclaw/plugin-sdk/channel-runtime"; -import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime"; +} from "openclaw/plugin-sdk/status-helpers"; type WhatsAppAccountStatus = { accountId?: unknown; diff --git a/extensions/zalo/runtime-api.ts b/extensions/zalo/runtime-api.ts index 90ced0da803..082f65d43b8 100644 --- a/extensions/zalo/runtime-api.ts +++ b/extensions/zalo/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Zalo extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/zalo"; +export * from "../../src/plugin-sdk/zalo.js"; diff --git a/extensions/zalo/src/channel.ts b/extensions/zalo/src/channel.ts index b8d11b50937..165fe5bac52 100644 --- a/extensions/zalo/src/channel.ts +++ b/extensions/zalo/src/channel.ts @@ -9,11 +9,11 @@ import { createOpenProviderGroupPolicyWarningCollector, } from "openclaw/plugin-sdk/channel-policy"; import { - createChannelDirectoryAdapter, createEmptyChannelResult, createRawChannelSendResultAdapter, - createStaticReplyToModeResolver, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-send-result"; +import { createStaticReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; +import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-runtime"; import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; import { diff --git a/extensions/zalouser/runtime-api.ts b/extensions/zalouser/runtime-api.ts index 7d931f2d118..1b63edaea42 100644 --- a/extensions/zalouser/runtime-api.ts +++ b/extensions/zalouser/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Zalo Personal extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "openclaw/plugin-sdk/zalouser"; +export * from "../../src/plugin-sdk/zalouser.js"; diff --git a/extensions/zalouser/src/channel.ts b/extensions/zalouser/src/channel.ts index 571ad31c164..c9b6fc17a67 100644 --- a/extensions/zalouser/src/channel.ts +++ b/extensions/zalouser/src/channel.ts @@ -1,12 +1,14 @@ import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers"; import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle"; import { - createEmptyChannelResult, createPairingPrefixStripper, - createRawChannelSendResultAdapter, - createStaticReplyToModeResolver, createTextPairingAdapter, -} from "openclaw/plugin-sdk/channel-runtime"; +} from "openclaw/plugin-sdk/channel-pairing"; +import { + createEmptyChannelResult, + createRawChannelSendResultAdapter, +} from "openclaw/plugin-sdk/channel-send-result"; +import { createStaticReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; import type { ChannelAccountSnapshot, diff --git a/package.json b/package.json index 8c8572581f9..d0ace1f4e9c 100644 --- a/package.json +++ b/package.json @@ -177,118 +177,6 @@ "types": "./dist/plugin-sdk/acp-runtime.d.ts", "default": "./dist/plugin-sdk/acp-runtime.js" }, - "./plugin-sdk/telegram": { - "types": "./dist/plugin-sdk/telegram.d.ts", - "default": "./dist/plugin-sdk/telegram.js" - }, - "./plugin-sdk/telegram-core": { - "types": "./dist/plugin-sdk/telegram-core.d.ts", - "default": "./dist/plugin-sdk/telegram-core.js" - }, - "./plugin-sdk/discord": { - "types": "./dist/plugin-sdk/discord.d.ts", - "default": "./dist/plugin-sdk/discord.js" - }, - "./plugin-sdk/discord-core": { - "types": "./dist/plugin-sdk/discord-core.d.ts", - "default": "./dist/plugin-sdk/discord-core.js" - }, - "./plugin-sdk/feishu": { - "types": "./dist/plugin-sdk/feishu.d.ts", - "default": "./dist/plugin-sdk/feishu.js" - }, - "./plugin-sdk/googlechat": { - "types": "./dist/plugin-sdk/googlechat.d.ts", - "default": "./dist/plugin-sdk/googlechat.js" - }, - "./plugin-sdk/irc": { - "types": "./dist/plugin-sdk/irc.d.ts", - "default": "./dist/plugin-sdk/irc.js" - }, - "./plugin-sdk/line": { - "types": "./dist/plugin-sdk/line.d.ts", - "default": "./dist/plugin-sdk/line.js" - }, - "./plugin-sdk/line-core": { - "types": "./dist/plugin-sdk/line-core.d.ts", - "default": "./dist/plugin-sdk/line-core.js" - }, - "./plugin-sdk/matrix": { - "types": "./dist/plugin-sdk/matrix.d.ts", - "default": "./dist/plugin-sdk/matrix.js" - }, - "./plugin-sdk/mattermost": { - "types": "./dist/plugin-sdk/mattermost.d.ts", - "default": "./dist/plugin-sdk/mattermost.js" - }, - "./plugin-sdk/msteams": { - "types": "./dist/plugin-sdk/msteams.d.ts", - "default": "./dist/plugin-sdk/msteams.js" - }, - "./plugin-sdk/nextcloud-talk": { - "types": "./dist/plugin-sdk/nextcloud-talk.d.ts", - "default": "./dist/plugin-sdk/nextcloud-talk.js" - }, - "./plugin-sdk/nostr": { - "types": "./dist/plugin-sdk/nostr.d.ts", - "default": "./dist/plugin-sdk/nostr.js" - }, - "./plugin-sdk/signal": { - "types": "./dist/plugin-sdk/signal.d.ts", - "default": "./dist/plugin-sdk/signal.js" - }, - "./plugin-sdk/slack": { - "types": "./dist/plugin-sdk/slack.d.ts", - "default": "./dist/plugin-sdk/slack.js" - }, - "./plugin-sdk/slack-core": { - "types": "./dist/plugin-sdk/slack-core.d.ts", - "default": "./dist/plugin-sdk/slack-core.js" - }, - "./plugin-sdk/tlon": { - "types": "./dist/plugin-sdk/tlon.d.ts", - "default": "./dist/plugin-sdk/tlon.js" - }, - "./plugin-sdk/twitch": { - "types": "./dist/plugin-sdk/twitch.d.ts", - "default": "./dist/plugin-sdk/twitch.js" - }, - "./plugin-sdk/voice-call": { - "types": "./dist/plugin-sdk/voice-call.d.ts", - "default": "./dist/plugin-sdk/voice-call.js" - }, - "./plugin-sdk/imessage": { - "types": "./dist/plugin-sdk/imessage.d.ts", - "default": "./dist/plugin-sdk/imessage.js" - }, - "./plugin-sdk/imessage-core": { - "types": "./dist/plugin-sdk/imessage-core.d.ts", - "default": "./dist/plugin-sdk/imessage-core.js" - }, - "./plugin-sdk/whatsapp": { - "types": "./dist/plugin-sdk/whatsapp.d.ts", - "default": "./dist/plugin-sdk/whatsapp.js" - }, - "./plugin-sdk/whatsapp-shared": { - "types": "./dist/plugin-sdk/whatsapp-shared.d.ts", - "default": "./dist/plugin-sdk/whatsapp-shared.js" - }, - "./plugin-sdk/whatsapp-action-runtime": { - "types": "./dist/plugin-sdk/whatsapp-action-runtime.d.ts", - "default": "./dist/plugin-sdk/whatsapp-action-runtime.js" - }, - "./plugin-sdk/whatsapp-login-qr": { - "types": "./dist/plugin-sdk/whatsapp-login-qr.d.ts", - "default": "./dist/plugin-sdk/whatsapp-login-qr.js" - }, - "./plugin-sdk/whatsapp-core": { - "types": "./dist/plugin-sdk/whatsapp-core.d.ts", - "default": "./dist/plugin-sdk/whatsapp-core.js" - }, - "./plugin-sdk/bluebubbles": { - "types": "./dist/plugin-sdk/bluebubbles.d.ts", - "default": "./dist/plugin-sdk/bluebubbles.js" - }, "./plugin-sdk/lazy-runtime": { "types": "./dist/plugin-sdk/lazy-runtime.d.ts", "default": "./dist/plugin-sdk/lazy-runtime.js" @@ -313,10 +201,6 @@ "types": "./dist/plugin-sdk/allow-from.d.ts", "default": "./dist/plugin-sdk/allow-from.js" }, - "./plugin-sdk/allowlist-resolution": { - "types": "./dist/plugin-sdk/allowlist-resolution.d.ts", - "default": "./dist/plugin-sdk/allowlist-resolution.js" - }, "./plugin-sdk/allowlist-config-edit": { "types": "./dist/plugin-sdk/allowlist-config-edit.d.ts", "default": "./dist/plugin-sdk/allowlist-config-edit.js" @@ -325,6 +209,10 @@ "types": "./dist/plugin-sdk/boolean-param.d.ts", "default": "./dist/plugin-sdk/boolean-param.js" }, + "./plugin-sdk/command-auth": { + "types": "./dist/plugin-sdk/command-auth.d.ts", + "default": "./dist/plugin-sdk/command-auth.js" + }, "./plugin-sdk/device-bootstrap": { "types": "./dist/plugin-sdk/device-bootstrap.d.ts", "default": "./dist/plugin-sdk/device-bootstrap.js" @@ -349,6 +237,22 @@ "types": "./dist/plugin-sdk/channel-config-schema.d.ts", "default": "./dist/plugin-sdk/channel-config-schema.js" }, + "./plugin-sdk/channel-actions": { + "types": "./dist/plugin-sdk/channel-actions.d.ts", + "default": "./dist/plugin-sdk/channel-actions.js" + }, + "./plugin-sdk/channel-contract": { + "types": "./dist/plugin-sdk/channel-contract.d.ts", + "default": "./dist/plugin-sdk/channel-contract.js" + }, + "./plugin-sdk/channel-feedback": { + "types": "./dist/plugin-sdk/channel-feedback.d.ts", + "default": "./dist/plugin-sdk/channel-feedback.js" + }, + "./plugin-sdk/channel-inbound": { + "types": "./dist/plugin-sdk/channel-inbound.d.ts", + "default": "./dist/plugin-sdk/channel-inbound.js" + }, "./plugin-sdk/channel-lifecycle": { "types": "./dist/plugin-sdk/channel-lifecycle.d.ts", "default": "./dist/plugin-sdk/channel-lifecycle.js" @@ -365,6 +269,10 @@ "types": "./dist/plugin-sdk/channel-send-result.d.ts", "default": "./dist/plugin-sdk/channel-send-result.js" }, + "./plugin-sdk/channel-targets": { + "types": "./dist/plugin-sdk/channel-targets.d.ts", + "default": "./dist/plugin-sdk/channel-targets.js" + }, "./plugin-sdk/group-access": { "types": "./dist/plugin-sdk/group-access.d.ts", "default": "./dist/plugin-sdk/group-access.js" @@ -393,10 +301,6 @@ "types": "./dist/plugin-sdk/provider-auth.d.ts", "default": "./dist/plugin-sdk/provider-auth.js" }, - "./plugin-sdk/provider-oauth": { - "types": "./dist/plugin-sdk/provider-oauth.d.ts", - "default": "./dist/plugin-sdk/provider-oauth.js" - }, "./plugin-sdk/provider-auth-api-key": { "types": "./dist/plugin-sdk/provider-auth-api-key.d.ts", "default": "./dist/plugin-sdk/provider-auth-api-key.js" @@ -457,14 +361,6 @@ "types": "./dist/plugin-sdk/media-understanding.d.ts", "default": "./dist/plugin-sdk/media-understanding.js" }, - "./plugin-sdk/secret-input-runtime": { - "types": "./dist/plugin-sdk/secret-input-runtime.d.ts", - "default": "./dist/plugin-sdk/secret-input-runtime.js" - }, - "./plugin-sdk/secret-input-schema": { - "types": "./dist/plugin-sdk/secret-input-schema.d.ts", - "default": "./dist/plugin-sdk/secret-input-schema.js" - }, "./plugin-sdk/request-url": { "types": "./dist/plugin-sdk/request-url.d.ts", "default": "./dist/plugin-sdk/request-url.js" @@ -481,6 +377,10 @@ "types": "./dist/plugin-sdk/runtime-store.d.ts", "default": "./dist/plugin-sdk/runtime-store.js" }, + "./plugin-sdk/status-helpers": { + "types": "./dist/plugin-sdk/status-helpers.d.ts", + "default": "./dist/plugin-sdk/status-helpers.js" + }, "./plugin-sdk/secret-input": { "types": "./dist/plugin-sdk/secret-input.d.ts", "default": "./dist/plugin-sdk/secret-input.js" diff --git a/scripts/lib/plugin-sdk-entrypoints.json b/scripts/lib/plugin-sdk-entrypoints.json index 57ccd34d3a6..914abc25627 100644 --- a/scripts/lib/plugin-sdk-entrypoints.json +++ b/scripts/lib/plugin-sdk-entrypoints.json @@ -34,53 +34,30 @@ "process-runtime", "windows-spawn", "acp-runtime", - "telegram", - "telegram-core", - "discord", - "discord-core", - "feishu", - "googlechat", - "irc", - "line", - "line-core", - "matrix", - "mattermost", - "msteams", - "nextcloud-talk", - "nostr", - "signal", - "slack", - "slack-core", - "tlon", - "twitch", - "voice-call", - "imessage", - "imessage-core", - "whatsapp", - "whatsapp-shared", - "whatsapp-action-runtime", - "whatsapp-login-qr", - "whatsapp-core", - "bluebubbles", "lazy-runtime", "testing", "account-helpers", "account-id", "account-resolution", "allow-from", - "allowlist-resolution", "allowlist-config-edit", "boolean-param", + "command-auth", "device-bootstrap", "diagnostics-otel", "diffs", "extension-shared", "channel-config-helpers", "channel-config-schema", + "channel-actions", + "channel-contract", + "channel-feedback", + "channel-inbound", "channel-lifecycle", "channel-pairing", "channel-policy", "channel-send-result", + "channel-targets", "group-access", "directory-runtime", "json-store", @@ -88,7 +65,6 @@ "llm-task", "memory-lancedb", "provider-auth", - "provider-oauth", "provider-auth-api-key", "provider-auth-login", "plugin-entry", @@ -104,12 +80,11 @@ "image-generation", "reply-history", "media-understanding", - "secret-input-runtime", - "secret-input-schema", "request-url", "webhook-ingress", "webhook-path", "runtime-store", + "status-helpers", "secret-input", "thread-ownership", "web-media", diff --git a/src/agents/pi-embedded-runner/compact.ts b/src/agents/pi-embedded-runner/compact.ts index 6c753e9d723..d76a01ed5af 100644 --- a/src/agents/pi-embedded-runner/compact.ts +++ b/src/agents/pi-embedded-runner/compact.ts @@ -10,7 +10,7 @@ import { import { resolveTelegramInlineButtonsScope, resolveTelegramReactionLevel, -} from "openclaw/plugin-sdk/telegram"; +} from "../../../extensions/telegram/api.js"; import { resolveHeartbeatPrompt } from "../../auto-reply/heartbeat.js"; import type { ReasoningLevel, ThinkLevel } from "../../auto-reply/thinking.js"; import { resolveChannelCapabilities } from "../../config/channel-capabilities.js"; diff --git a/src/agents/pi-embedded-runner/run/attempt.ts b/src/agents/pi-embedded-runner/run/attempt.ts index 71db23d0f5b..c7c7a728ae7 100644 --- a/src/agents/pi-embedded-runner/run/attempt.ts +++ b/src/agents/pi-embedded-runner/run/attempt.ts @@ -10,7 +10,7 @@ import { import { resolveTelegramInlineButtonsScope, resolveTelegramReactionLevel, -} from "openclaw/plugin-sdk/telegram"; +} from "../../../../extensions/telegram/api.js"; import { resolveHeartbeatPrompt } from "../../../auto-reply/heartbeat.js"; import { resolveChannelCapabilities } from "../../../config/channel-capabilities.js"; import type { OpenClawConfig } from "../../../config/config.js"; diff --git a/src/agents/tools/message-tool.test.ts b/src/agents/tools/message-tool.test.ts index e87df84b909..0b418806612 100644 --- a/src/agents/tools/message-tool.test.ts +++ b/src/agents/tools/message-tool.test.ts @@ -3,7 +3,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite import type { ChannelMessageCapability } from "../../channels/plugins/message-capabilities.js"; import type { ChannelMessageActionName, ChannelPlugin } from "../../channels/plugins/types.js"; import type { MessageActionRunResult } from "../../infra/outbound/message-action-runner.js"; -import { createMessageToolButtonsSchema } from "../../plugin-sdk/message-tool-schema.js"; +import { createMessageToolButtonsSchema } from "../../plugin-sdk/channel-actions.js"; type CreateMessageTool = typeof import("./message-tool.js").createMessageTool; type SetActivePluginRegistry = typeof import("../../plugins/runtime.js").setActivePluginRegistry; type CreateTestRegistry = typeof import("../../test-utils/channel-plugins.js").createTestRegistry; diff --git a/src/auto-reply/reply/commands-approve.ts b/src/auto-reply/reply/commands-approve.ts index 05d7fe0139a..94487294500 100644 --- a/src/auto-reply/reply/commands-approve.ts +++ b/src/auto-reply/reply/commands-approve.ts @@ -1,7 +1,7 @@ import { isTelegramExecApprovalApprover, isTelegramExecApprovalClientEnabled, -} from "openclaw/plugin-sdk/telegram"; +} from "../../../extensions/telegram/api.js"; import { callGateway } from "../../gateway/call.js"; import { logVerbose } from "../../globals.js"; import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../../utils/message-channel.js"; diff --git a/src/auto-reply/reply/commands-models.ts b/src/auto-reply/reply/commands-models.ts index b1a1fcba8da..08574530ed9 100644 --- a/src/auto-reply/reply/commands-models.ts +++ b/src/auto-reply/reply/commands-models.ts @@ -4,7 +4,7 @@ import { calculateTotalPages, getModelsPageSize, type ProviderInfo, -} from "openclaw/plugin-sdk/telegram"; +} from "../../../extensions/telegram/api.js"; import { resolveAgentDir, resolveSessionAgentId } from "../../agents/agent-scope.js"; import { resolveModelAuthLabel } from "../../agents/model-auth-label.js"; import { loadModelCatalog } from "../../agents/model-catalog.js"; diff --git a/src/auto-reply/reply/directive-handling.model.ts b/src/auto-reply/reply/directive-handling.model.ts index 5d8d871f9ec..5e79ed7ae9f 100644 --- a/src/auto-reply/reply/directive-handling.model.ts +++ b/src/auto-reply/reply/directive-handling.model.ts @@ -1,4 +1,4 @@ -import { buildBrowseProvidersButton } from "openclaw/plugin-sdk/telegram"; +import { buildBrowseProvidersButton } from "../../../extensions/telegram/api.js"; import { ensureAuthProfileStore, resolveAuthStorePathForDisplay, diff --git a/src/auto-reply/templating.ts b/src/auto-reply/templating.ts index 4485e2c22ee..601fa6891bf 100644 --- a/src/auto-reply/templating.ts +++ b/src/auto-reply/templating.ts @@ -1,4 +1,4 @@ -import type { StickerMetadata } from "openclaw/plugin-sdk/telegram"; +import type { StickerMetadata } from "../../extensions/telegram/api.js"; import type { ChannelId } from "../channels/plugins/types.js"; import type { MediaUnderstandingDecision, diff --git a/src/channels/plugins/outbound/direct-text-media.ts b/src/channels/plugins/outbound/direct-text-media.ts index c0b4caafeba..80a7178a10e 100644 --- a/src/channels/plugins/outbound/direct-text-media.ts +++ b/src/channels/plugins/outbound/direct-text-media.ts @@ -1,4 +1,10 @@ -import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload"; +import { + resolvePayloadMediaUrls, + sendPayloadMediaSequence, + sendPayloadMediaSequenceAndFinalize, + sendPayloadMediaSequenceOrFallback, + sendTextMediaPayload, +} from "openclaw/plugin-sdk/reply-payload"; import { chunkText } from "../../../auto-reply/chunk.js"; import type { OpenClawConfig } from "../../../config/config.js"; import type { OutboundSendDeps } from "../../../infra/outbound/deliver.js"; @@ -21,110 +27,13 @@ type DirectSendFn, TResult extends DirectS text: string, opts: TOpts, ) => Promise; - -type SendPayloadContext = Parameters>[0]; -type SendPayloadResult = Awaited>>; -type SendPayloadAdapter = Pick< - ChannelOutboundAdapter, - "sendMedia" | "sendText" | "chunker" | "textChunkLimit" ->; - -export function resolvePayloadMediaUrls(payload: SendPayloadContext["payload"]): string[] { - return resolveOutboundMediaUrls(payload); -} - -export async function sendPayloadMediaSequence(params: { - text: string; - mediaUrls: readonly string[]; - send: (input: { - text: string; - mediaUrl: string; - index: number; - isFirst: boolean; - }) => Promise; -}): Promise { - let lastResult: TResult | undefined; - for (let i = 0; i < params.mediaUrls.length; i += 1) { - const mediaUrl = params.mediaUrls[i]; - if (!mediaUrl) { - continue; - } - lastResult = await params.send({ - text: i === 0 ? params.text : "", - mediaUrl, - index: i, - isFirst: i === 0, - }); - } - return lastResult; -} - -export async function sendPayloadMediaSequenceOrFallback(params: { - text: string; - mediaUrls: readonly string[]; - send: (input: { - text: string; - mediaUrl: string; - index: number; - isFirst: boolean; - }) => Promise; - fallbackResult: TResult; - sendNoMedia?: () => Promise; -}): Promise { - if (params.mediaUrls.length === 0) { - return params.sendNoMedia ? await params.sendNoMedia() : params.fallbackResult; - } - return (await sendPayloadMediaSequence(params)) ?? params.fallbackResult; -} - -export async function sendPayloadMediaSequenceAndFinalize(params: { - text: string; - mediaUrls: readonly string[]; - send: (input: { - text: string; - mediaUrl: string; - index: number; - isFirst: boolean; - }) => Promise; - finalize: () => Promise; -}): Promise { - if (params.mediaUrls.length > 0) { - await sendPayloadMediaSequence(params); - } - return await params.finalize(); -} - -export async function sendTextMediaPayload(params: { - channel: string; - ctx: SendPayloadContext; - adapter: SendPayloadAdapter; -}): Promise { - const text = params.ctx.payload.text ?? ""; - const urls = resolvePayloadMediaUrls(params.ctx.payload); - if (!text && urls.length === 0) { - return { channel: params.channel, messageId: "" }; - } - if (urls.length > 0) { - const lastResult = await sendPayloadMediaSequence({ - text, - mediaUrls: urls, - send: async ({ text, mediaUrl }) => - await params.adapter.sendMedia!({ - ...params.ctx, - text, - mediaUrl, - }), - }); - return lastResult ?? { channel: params.channel, messageId: "" }; - } - const limit = params.adapter.textChunkLimit; - const chunks = limit && params.adapter.chunker ? params.adapter.chunker(text, limit) : [text]; - let lastResult: Awaited>>; - for (const chunk of chunks) { - lastResult = await params.adapter.sendText!({ ...params.ctx, text: chunk }); - } - return lastResult!; -} +export { + resolvePayloadMediaUrls, + sendPayloadMediaSequence, + sendPayloadMediaSequenceAndFinalize, + sendPayloadMediaSequenceOrFallback, + sendTextMediaPayload, +} from "openclaw/plugin-sdk/reply-payload"; export function resolveScopedChannelMediaMaxBytes(params: { cfg: OpenClawConfig; diff --git a/src/channels/read-only-account-inspect.discord.runtime.ts b/src/channels/read-only-account-inspect.discord.runtime.ts index d52f56ad316..5e3fe8fdafd 100644 --- a/src/channels/read-only-account-inspect.discord.runtime.ts +++ b/src/channels/read-only-account-inspect.discord.runtime.ts @@ -1,8 +1,8 @@ -import { inspectDiscordAccount as inspectDiscordAccountImpl } from "openclaw/plugin-sdk/discord"; +import { inspectDiscordAccount as inspectDiscordAccountImpl } from "../../extensions/discord/api.js"; -export type { InspectedDiscordAccount } from "openclaw/plugin-sdk/discord"; +export type { InspectedDiscordAccount } from "../../extensions/discord/api.js"; -type InspectDiscordAccount = typeof import("openclaw/plugin-sdk/discord").inspectDiscordAccount; +type InspectDiscordAccount = typeof import("../../extensions/discord/api.js").inspectDiscordAccount; export function inspectDiscordAccount( ...args: Parameters diff --git a/src/channels/read-only-account-inspect.slack.runtime.ts b/src/channels/read-only-account-inspect.slack.runtime.ts index 0d3e2c878c1..8e8db46073c 100644 --- a/src/channels/read-only-account-inspect.slack.runtime.ts +++ b/src/channels/read-only-account-inspect.slack.runtime.ts @@ -1,8 +1,8 @@ -import { inspectSlackAccount as inspectSlackAccountImpl } from "openclaw/plugin-sdk/slack"; +import { inspectSlackAccount as inspectSlackAccountImpl } from "../../extensions/slack/api.js"; -export type { InspectedSlackAccount } from "openclaw/plugin-sdk/slack"; +export type { InspectedSlackAccount } from "../../extensions/slack/api.js"; -type InspectSlackAccount = typeof import("openclaw/plugin-sdk/slack").inspectSlackAccount; +type InspectSlackAccount = typeof import("../../extensions/slack/api.js").inspectSlackAccount; export function inspectSlackAccount( ...args: Parameters diff --git a/src/channels/read-only-account-inspect.telegram.runtime.ts b/src/channels/read-only-account-inspect.telegram.runtime.ts index 12158022b2b..661cdd3b9c4 100644 --- a/src/channels/read-only-account-inspect.telegram.runtime.ts +++ b/src/channels/read-only-account-inspect.telegram.runtime.ts @@ -1,8 +1,9 @@ -import { inspectTelegramAccount as inspectTelegramAccountImpl } from "openclaw/plugin-sdk/telegram"; +import { inspectTelegramAccount as inspectTelegramAccountImpl } from "../../extensions/telegram/api.js"; -export type { InspectedTelegramAccount } from "openclaw/plugin-sdk/telegram"; +export type { InspectedTelegramAccount } from "../../extensions/telegram/api.js"; -type InspectTelegramAccount = typeof import("openclaw/plugin-sdk/telegram").inspectTelegramAccount; +type InspectTelegramAccount = + typeof import("../../extensions/telegram/api.js").inspectTelegramAccount; export function inspectTelegramAccount( ...args: Parameters diff --git a/src/cli/send-runtime/discord.ts b/src/cli/send-runtime/discord.ts index 3c6527a8175..5c15549cfae 100644 --- a/src/cli/send-runtime/discord.ts +++ b/src/cli/send-runtime/discord.ts @@ -1,7 +1,7 @@ -import { sendMessageDiscord as sendMessageDiscordImpl } from "openclaw/plugin-sdk/discord"; +import { sendMessageDiscord as sendMessageDiscordImpl } from "../../../extensions/discord/runtime-api.js"; type RuntimeSend = { - sendMessage: typeof import("openclaw/plugin-sdk/discord").sendMessageDiscord; + sendMessage: typeof import("../../../extensions/discord/runtime-api.js").sendMessageDiscord; }; export const runtimeSend = { diff --git a/src/cli/send-runtime/slack.ts b/src/cli/send-runtime/slack.ts index beec4f55906..e7d50aefe1f 100644 --- a/src/cli/send-runtime/slack.ts +++ b/src/cli/send-runtime/slack.ts @@ -1,7 +1,7 @@ -import { sendMessageSlack as sendMessageSlackImpl } from "openclaw/plugin-sdk/slack"; +import { sendMessageSlack as sendMessageSlackImpl } from "../../../extensions/slack/runtime-api.js"; type RuntimeSend = { - sendMessage: typeof import("openclaw/plugin-sdk/slack").sendMessageSlack; + sendMessage: typeof import("../../../extensions/slack/runtime-api.js").sendMessageSlack; }; export const runtimeSend = { diff --git a/src/cli/send-runtime/telegram.ts b/src/cli/send-runtime/telegram.ts index bfa22643976..e5e04680532 100644 --- a/src/cli/send-runtime/telegram.ts +++ b/src/cli/send-runtime/telegram.ts @@ -1,7 +1,7 @@ -import { sendMessageTelegram as sendMessageTelegramImpl } from "openclaw/plugin-sdk/telegram"; +import { sendMessageTelegram as sendMessageTelegramImpl } from "../../../extensions/telegram/runtime-api.js"; type RuntimeSend = { - sendMessage: typeof import("openclaw/plugin-sdk/telegram").sendMessageTelegram; + sendMessage: typeof import("../../../extensions/telegram/runtime-api.js").sendMessageTelegram; }; export const runtimeSend = { diff --git a/src/commands/doctor-config-flow.ts b/src/commands/doctor-config-flow.ts index e0599eca1bb..3bd8c871e6e 100644 --- a/src/commands/doctor-config-flow.ts +++ b/src/commands/doctor-config-flow.ts @@ -4,7 +4,7 @@ import { isNumericTelegramUserId, listTelegramAccountIds, normalizeTelegramAllowFromEntry, -} from "openclaw/plugin-sdk/telegram"; +} from "../../extensions/telegram/api.js"; import { normalizeChatChannelId } from "../channels/registry.js"; import { formatCliCommand } from "../cli/command-format.js"; import { resolveCommandSecretRefsViaGateway } from "../cli/command-secret-gateway.js"; diff --git a/src/config/plugin-auto-enable.ts b/src/config/plugin-auto-enable.ts index 54fd24b5880..6cf09647cf6 100644 --- a/src/config/plugin-auto-enable.ts +++ b/src/config/plugin-auto-enable.ts @@ -1,4 +1,4 @@ -import { hasAnyWhatsAppAuth } from "openclaw/plugin-sdk/whatsapp"; +import { hasAnyWhatsAppAuth } from "../../extensions/whatsapp/api.js"; import { normalizeProviderId } from "../agents/model-selection.js"; import { hasMeaningfulChannelConfig } from "../channels/config-presence.js"; import { diff --git a/src/config/schema.help.ts b/src/config/schema.help.ts index c22d5e15b32..947726bd7e8 100644 --- a/src/config/schema.help.ts +++ b/src/config/schema.help.ts @@ -1,7 +1,7 @@ import { DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, -} from "openclaw/plugin-sdk/discord"; +} from "../../extensions/discord/runtime-api.js"; import { MEDIA_AUDIO_FIELD_HELP } from "./media-audio-field-metadata.js"; import { IRC_FIELD_HELP } from "./schema.irc.js"; import { describeTalkSilenceTimeoutDefaults } from "./talk-defaults.js"; diff --git a/src/cron/isolated-agent/delivery-target.ts b/src/cron/isolated-agent/delivery-target.ts index 85966c3e07c..538ebdca273 100644 --- a/src/cron/isolated-agent/delivery-target.ts +++ b/src/cron/isolated-agent/delivery-target.ts @@ -1,4 +1,4 @@ -import { resolveWhatsAppAccount } from "openclaw/plugin-sdk/whatsapp"; +import { resolveWhatsAppAccount } from "../../../extensions/whatsapp/api.js"; import type { ChannelId } from "../../channels/plugins/types.js"; import type { OpenClawConfig } from "../../config/config.js"; import { diff --git a/src/gateway/server-http.ts b/src/gateway/server-http.ts index ebf81bea62c..dd5a659dbc9 100644 --- a/src/gateway/server-http.ts +++ b/src/gateway/server-http.ts @@ -7,8 +7,8 @@ import { } from "node:http"; import { createServer as createHttpsServer } from "node:https"; import type { TlsOptions } from "node:tls"; -import { handleSlackHttpRequest } from "openclaw/plugin-sdk/slack"; import type { WebSocketServer } from "ws"; +import { handleSlackHttpRequest } from "../../extensions/slack/api.js"; import { resolveAgentAvatar } from "../agents/identity-avatar.js"; import { CANVAS_WS_PATH, handleA2uiHttpRequest } from "../canvas-host/a2ui.js"; import type { CanvasHostHandler } from "../canvas-host/server.js"; diff --git a/src/infra/state-migrations.ts b/src/infra/state-migrations.ts index 8c8dd821df6..a5b5bc9111f 100644 --- a/src/infra/state-migrations.ts +++ b/src/infra/state-migrations.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { listTelegramAccountIds } from "openclaw/plugin-sdk/telegram"; +import { listTelegramAccountIds } from "../../extensions/telegram/api.js"; import { resolveDefaultAgentId } from "../agents/agent-scope.js"; import type { OpenClawConfig } from "../config/config.js"; import { diff --git a/src/plugin-sdk/allow-from.ts b/src/plugin-sdk/allow-from.ts index f03f2427558..5b15896c917 100644 --- a/src/plugin-sdk/allow-from.ts +++ b/src/plugin-sdk/allow-from.ts @@ -1,3 +1,32 @@ +export type { + AllowlistMatch, + AllowlistMatchSource, + CompiledAllowlist, +} from "../channels/allowlist-match.js"; +export type { AllowlistUserResolutionLike } from "../channels/allowlists/resolve-utils.js"; +export { + compileAllowlist, + formatAllowlistMatchMeta, + resolveAllowlistCandidates, + resolveAllowlistMatchByCandidates, + resolveAllowlistMatchSimple, + resolveCompiledAllowlistMatch, +} from "../channels/allowlist-match.js"; +export { + firstDefined, + isSenderIdAllowed, + mergeDmAllowFromSources, + resolveGroupAllowFromSources, +} from "../channels/allow-from.js"; +export { + addAllowlistUserEntriesFromConfigEntry, + buildAllowlistResolutionSummary, + canonicalizeAllowlistWithResolvedIds, + mergeAllowlist, + patchAllowlistUsersInConfigEntries, + summarizeMapping, +} from "../channels/allowlists/resolve-utils.js"; + /** Lowercase and optionally strip prefixes from allowlist entries before sender comparisons. */ export function formatAllowFromLowercase(params: { allowFrom: Array; @@ -96,3 +125,36 @@ export function isAllowedParsedChatSender } return false; } + +export type BasicAllowlistResolutionEntry = { + input: string; + resolved: boolean; + id?: string; + name?: string; + note?: string; +}; + +/** Clone allowlist resolution entries into a plain serializable shape for UI and docs output. */ +export function mapBasicAllowlistResolutionEntries( + entries: BasicAllowlistResolutionEntry[], +): BasicAllowlistResolutionEntry[] { + return entries.map((entry) => ({ + input: entry.input, + resolved: entry.resolved, + id: entry.id, + name: entry.name, + note: entry.note, + })); +} + +/** Map allowlist inputs sequentially so resolver side effects stay ordered and predictable. */ +export async function mapAllowlistResolutionInputs(params: { + inputs: string[]; + mapInput: (input: string) => Promise | T; +}): Promise { + const results: T[] = []; + for (const input of params.inputs) { + results.push(await params.mapInput(input)); + } + return results; +} diff --git a/src/plugin-sdk/allowlist-resolution.test.ts b/src/plugin-sdk/allowlist-resolution.test.ts index 5b606cfbe9f..12619308269 100644 --- a/src/plugin-sdk/allowlist-resolution.test.ts +++ b/src/plugin-sdk/allowlist-resolution.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { mapAllowlistResolutionInputs } from "./allowlist-resolution.js"; +import { mapAllowlistResolutionInputs } from "./allow-from.js"; describe("mapAllowlistResolutionInputs", () => { it("maps inputs sequentially and preserves order", async () => { diff --git a/src/plugin-sdk/allowlist-resolution.ts b/src/plugin-sdk/allowlist-resolution.ts deleted file mode 100644 index 1acf87f4d1c..00000000000 --- a/src/plugin-sdk/allowlist-resolution.ts +++ /dev/null @@ -1,32 +0,0 @@ -export type BasicAllowlistResolutionEntry = { - input: string; - resolved: boolean; - id?: string; - name?: string; - note?: string; -}; - -/** Clone allowlist resolution entries into a plain serializable shape for UI and docs output. */ -export function mapBasicAllowlistResolutionEntries( - entries: BasicAllowlistResolutionEntry[], -): BasicAllowlistResolutionEntry[] { - return entries.map((entry) => ({ - input: entry.input, - resolved: entry.resolved, - id: entry.id, - name: entry.name, - note: entry.note, - })); -} - -/** Map allowlist inputs sequentially so resolver side effects stay ordered and predictable. */ -export async function mapAllowlistResolutionInputs(params: { - inputs: string[]; - mapInput: (input: string) => Promise | T; -}): Promise { - const results: T[] = []; - for (const input of params.inputs) { - results.push(await params.mapInput(input)); - } - return results; -} diff --git a/src/plugin-sdk/message-tool-schema.ts b/src/plugin-sdk/channel-actions.ts similarity index 78% rename from src/plugin-sdk/message-tool-schema.ts rename to src/plugin-sdk/channel-actions.ts index 889812fdbe4..2f6f5748461 100644 --- a/src/plugin-sdk/message-tool-schema.ts +++ b/src/plugin-sdk/channel-actions.ts @@ -1,3 +1,8 @@ +export { + createUnionActionGate, + listTokenSourcedAccounts, +} from "../channels/plugins/actions/shared.js"; +export { resolveReactionMessageId } from "../channels/plugins/actions/reaction-message-id.js"; import { Type } from "@sinclair/typebox"; import type { TSchema } from "@sinclair/typebox"; import { stringEnum } from "../agents/schema/typebox.js"; diff --git a/src/plugin-sdk/channel-config-helpers.ts b/src/plugin-sdk/channel-config-helpers.ts index d9a229657dd..18fb609de31 100644 --- a/src/plugin-sdk/channel-config-helpers.ts +++ b/src/plugin-sdk/channel-config-helpers.ts @@ -2,6 +2,15 @@ import { deleteAccountFromConfigSection, setAccountEnabledInConfigSection, } from "../channels/plugins/config-helpers.js"; +import { + authorizeConfigWrite, + canBypassConfigWritePolicy, + formatConfigWriteDeniedMessage, + resolveChannelConfigWrites, + type ConfigWriteAuthorizationResult, + type ConfigWriteScope, + type ConfigWriteTarget, +} from "../channels/plugins/config-writes.js"; import { collectAllowlistProviderGroupPolicyWarnings, collectAllowlistProviderRestrictSendersWarnings, @@ -17,6 +26,14 @@ import type { OpenClawConfig } from "../config/config.js"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js"; import { normalizeStringEntries } from "../shared/string-normalization.js"; +export { + authorizeConfigWrite, + canBypassConfigWritePolicy, + formatConfigWriteDeniedMessage, + resolveChannelConfigWrites, +}; +export type { ConfigWriteAuthorizationResult, ConfigWriteScope, ConfigWriteTarget }; + /** Coerce mixed allowlist config values into plain strings without trimming or deduping. */ export function mapAllowFromEntries( allowFrom: Array | null | undefined, diff --git a/src/plugin-sdk/channel-contract.ts b/src/plugin-sdk/channel-contract.ts new file mode 100644 index 00000000000..507166d87f0 --- /dev/null +++ b/src/plugin-sdk/channel-contract.ts @@ -0,0 +1,16 @@ +export type { + BaseProbeResult, + BaseTokenResolution, + ChannelAgentTool, + ChannelAccountSnapshot, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelMessageActionContext, + ChannelMessageActionDiscoveryContext, + ChannelMessageActionName, + ChannelMessageToolDiscovery, + ChannelMessageToolSchemaContribution, + ChannelStatusIssue, + ChannelThreadingContext, + ChannelThreadingToolContext, +} from "../channels/plugins/types.js"; diff --git a/src/plugin-sdk/channel-feedback.ts b/src/plugin-sdk/channel-feedback.ts new file mode 100644 index 00000000000..f9f03011ee0 --- /dev/null +++ b/src/plugin-sdk/channel-feedback.ts @@ -0,0 +1,21 @@ +export { + removeAckReactionAfterReply, + shouldAckReaction, + shouldAckReactionForWhatsApp, + type AckReactionGateParams, + type AckReactionScope, + type WhatsAppAckReactionMode, +} from "../channels/ack-reactions.js"; +export { logAckFailure, logTypingFailure, type LogFn } from "../channels/logging.js"; +export { + CODING_TOOL_TOKENS, + createStatusReactionController, + DEFAULT_EMOJIS, + DEFAULT_TIMING, + resolveToolEmoji, + WEB_TOOL_TOKENS, + type StatusReactionAdapter, + type StatusReactionController, + type StatusReactionEmojis, + type StatusReactionTiming, +} from "../channels/status-reactions.js"; diff --git a/src/plugin-sdk/channel-inbound.ts b/src/plugin-sdk/channel-inbound.ts new file mode 100644 index 00000000000..3f2f2708564 --- /dev/null +++ b/src/plugin-sdk/channel-inbound.ts @@ -0,0 +1,34 @@ +export { + createInboundDebouncer, + resolveInboundDebounceMs, +} from "../auto-reply/inbound-debounce.js"; +export { + formatInboundEnvelope, + formatInboundFromLabel, + resolveEnvelopeFormatOptions, +} from "../auto-reply/envelope.js"; +export type { EnvelopeFormatOptions } from "../auto-reply/envelope.js"; +export { + buildMentionRegexes, + matchesMentionPatterns, + matchesMentionWithExplicit, + normalizeMentionText, +} from "../auto-reply/reply/mentions.js"; +export { + createChannelInboundDebouncer, + shouldDebounceTextInbound, +} from "../channels/inbound-debounce-policy.js"; +export type { + MentionGateParams, + MentionGateResult, + MentionGateWithBypassParams, + MentionGateWithBypassResult, +} from "../channels/mention-gating.js"; +export { + resolveMentionGating, + resolveMentionGatingWithBypass, +} from "../channels/mention-gating.js"; +export type { NormalizedLocation } from "../channels/location.js"; +export { formatLocationText, toLocationContext } from "../channels/location.js"; +export { logInboundDrop } from "../channels/logging.js"; +export { resolveInboundSessionEnvelopeContext } from "../channels/session-envelope.js"; diff --git a/src/plugin-sdk/channel-lifecycle.ts b/src/plugin-sdk/channel-lifecycle.ts index 28045aeb058..96a031ce5b7 100644 --- a/src/plugin-sdk/channel-lifecycle.ts +++ b/src/plugin-sdk/channel-lifecycle.ts @@ -1,4 +1,12 @@ import type { ChannelAccountSnapshot } from "../channels/plugins/types.core.js"; +export * from "../channels/draft-stream-controls.js"; +export * from "../channels/draft-stream-loop.js"; +export { createRunStateMachine } from "../channels/run-state-machine.js"; +export { + createArmableStallWatchdog, + type ArmableStallWatchdog, + type StallWatchdogTimeoutMeta, +} from "../channels/transport/stall-watchdog.js"; type CloseAwareServer = { once: (event: "close", listener: () => void) => unknown; diff --git a/src/plugin-sdk/channel-pairing.ts b/src/plugin-sdk/channel-pairing.ts index 749c18bf86c..e085dc4e381 100644 --- a/src/plugin-sdk/channel-pairing.ts +++ b/src/plugin-sdk/channel-pairing.ts @@ -1,4 +1,9 @@ import type { ChannelId } from "../channels/plugins/types.js"; +export { + createLoggedPairingApprovalNotifier, + createPairingPrefixStripper, + createTextPairingAdapter, +} from "../channels/plugins/pairing-adapters.js"; import { issuePairingChallenge } from "../pairing/pairing-challenge.js"; import type { PluginRuntime } from "../plugins/runtime/types.js"; import { createScopedPairingAccess } from "./pairing-access.js"; diff --git a/src/plugin-sdk/channel-runtime.ts b/src/plugin-sdk/channel-runtime.ts index b45315a6757..377c7269613 100644 --- a/src/plugin-sdk/channel-runtime.ts +++ b/src/plugin-sdk/channel-runtime.ts @@ -1,73 +1,18 @@ -// Shared channel/runtime helpers for plugins. Channel plugins should use this -// surface instead of reaching into src/channels or adjacent infra modules. +// Legacy compatibility shim for older channel helpers. Prefer the dedicated +// plugin-sdk subpaths instead of adding new imports here. -export * from "../channels/ack-reactions.js"; -export * from "../channels/allow-from.js"; -export * from "../channels/allowlists/resolve-utils.js"; -export * from "../channels/allowlist-match.js"; -export * from "../channels/channel-config.js"; export * from "../channels/chat-type.js"; -export * from "../channels/command-gating.js"; -export * from "../channels/conversation-label.js"; -export * from "../channels/draft-stream-controls.js"; -export * from "../channels/draft-stream-loop.js"; -export * from "../channels/inbound-debounce-policy.js"; -export * from "../channels/location.js"; -export * from "../channels/logging.js"; -export * from "../channels/mention-gating.js"; -export * from "../channels/native-command-session-targets.js"; export * from "../channels/reply-prefix.js"; -export * from "../channels/run-state-machine.js"; -export * from "../channels/session.js"; -export * from "../channels/session-envelope.js"; -export * from "../channels/session-meta.js"; -export * from "../channels/status-reactions.js"; -export * from "../channels/targets.js"; -export * from "../channels/thread-binding-id.js"; -export * from "../channels/thread-bindings-messages.js"; -export * from "../channels/thread-bindings-policy.js"; -export * from "../channels/transport/stall-watchdog.js"; export * from "../channels/typing.js"; -export * from "../channels/plugins/actions/reaction-message-id.js"; -export * from "../channels/plugins/actions/shared.js"; export type * from "../channels/plugins/types.js"; -export * from "../channels/plugins/config-writes.js"; -export * from "../channels/plugins/directory-adapters.js"; -export * from "../channels/plugins/media-payload.js"; -export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; -export * from "./message-tool-schema.js"; export * from "../channels/plugins/normalize/signal.js"; export * from "../channels/plugins/normalize/whatsapp.js"; -export * from "../channels/plugins/outbound/direct-text-media.js"; export * from "../channels/plugins/outbound/interactive.js"; -export * from "../channels/plugins/pairing-adapters.js"; -export * from "../channels/plugins/runtime-forwarders.js"; -export * from "../channels/plugins/target-resolvers.js"; -export * from "../channels/plugins/threading-helpers.js"; -export * from "../channels/plugins/status-issues/shared.js"; export * from "../channels/plugins/whatsapp-heartbeat.js"; -export { - buildComputedAccountStatusSnapshot, - buildTokenChannelStatusSummary, -} from "./status-helpers.js"; -export { - projectCredentialSnapshotFields, - resolveConfiguredFromCredentialStatuses, -} from "../channels/account-snapshot-fields.js"; -export * from "../infra/outbound/send-deps.js"; export * from "../polls.js"; -export * from "../utils/message-channel.js"; export * from "../whatsapp/normalize.js"; -export { createActionGate, jsonResult, readStringParam } from "../agents/tools/common.js"; -export * from "./channel-send-result.js"; -export * from "./channel-lifecycle.js"; -export * from "./directory-runtime.js"; -export type { - InteractiveButtonStyle, - InteractiveReplyButton, - InteractiveReply, -} from "../interactive/payload.js"; export { - normalizeInteractiveReply, - resolveInteractiveTextFallback, -} from "../interactive/payload.js"; + createAccountStatusSink, + keepHttpServerTaskAlive, + waitUntilAbort, +} from "./channel-lifecycle.js"; diff --git a/src/plugin-sdk/channel-send-result.ts b/src/plugin-sdk/channel-send-result.ts index 12e74741264..07c0099500f 100644 --- a/src/plugin-sdk/channel-send-result.ts +++ b/src/plugin-sdk/channel-send-result.ts @@ -1,6 +1,8 @@ import type { ChannelOutboundAdapter, ChannelPollResult } from "../channels/plugins/types.js"; import type { OutboundDeliveryResult } from "../infra/outbound/deliver.js"; +export type { ChannelOutboundAdapter } from "../channels/plugins/types.js"; + export type ChannelSendRawResult = { ok: boolean; messageId?: string | null; diff --git a/src/plugin-sdk/channel-setup.ts b/src/plugin-sdk/channel-setup.ts index 6488bd1a770..c12027f2944 100644 --- a/src/plugin-sdk/channel-setup.ts +++ b/src/plugin-sdk/channel-setup.ts @@ -1,11 +1,13 @@ import type { ChannelSetupWizard } from "../channels/plugins/setup-wizard.js"; import type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js"; +import type { ChannelSetupInput } from "../channels/plugins/types.core.js"; import { createOptionalChannelSetupAdapter, createOptionalChannelSetupWizard, } from "./optional-channel-setup.js"; export type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js"; +export type { ChannelSetupInput } from "../channels/plugins/types.core.js"; export type { ChannelSetupDmPolicy, ChannelSetupWizard } from "./setup.js"; export { DEFAULT_ACCOUNT_ID, diff --git a/src/plugin-sdk/channel-targets.ts b/src/plugin-sdk/channel-targets.ts new file mode 100644 index 00000000000..c24bc9b3046 --- /dev/null +++ b/src/plugin-sdk/channel-targets.ts @@ -0,0 +1,29 @@ +export { + applyChannelMatchMeta, + buildChannelKeyCandidates, + normalizeChannelSlug, + resolveChannelEntryMatch, + resolveChannelEntryMatchWithFallback, + resolveChannelMatchConfig, + resolveNestedAllowlistDecision, + type ChannelEntryMatch, + type ChannelMatchSource, +} from "../channels/channel-config.js"; +export { + buildMessagingTarget, + ensureTargetId, + normalizeTargetId, + parseAtUserTarget, + parseMentionPrefixOrAtUserTarget, + parseTargetMention, + parseTargetPrefix, + parseTargetPrefixes, + requireTargetKind, + type MessagingTarget, + type MessagingTargetKind, + type MessagingTargetParseOptions, +} from "../channels/targets.js"; +export { + buildUnresolvedTargetResults, + resolveTargetsWithOptionalToken, +} from "../channels/plugins/target-resolvers.js"; diff --git a/src/plugin-sdk/command-auth.ts b/src/plugin-sdk/command-auth.ts index 0a09e0c1dcd..4d4324ce891 100644 --- a/src/plugin-sdk/command-auth.ts +++ b/src/plugin-sdk/command-auth.ts @@ -1,6 +1,83 @@ import type { OpenClawConfig } from "../config/config.js"; import { resolveDmGroupAccessWithLists } from "../security/dm-policy-shared.js"; +export { + hasControlCommand, + hasInlineCommandTokens, + isControlCommandMessage, + shouldComputeCommandAuthorized, +} from "../auto-reply/command-detection.js"; +export { + buildCommandText, + buildCommandTextFromArgs, + findCommandByNativeName, + getCommandDetection, + isCommandEnabled, + isCommandMessage, + isNativeCommandSurface, + listChatCommands, + listChatCommandsForConfig, + listNativeCommandSpecs, + listNativeCommandSpecsForConfig, + maybeResolveTextAlias, + normalizeCommandBody, + parseCommandArgs, + resolveCommandArgChoices, + resolveCommandArgMenu, + resolveTextCommand, + serializeCommandArgs, + shouldHandleTextCommands, +} from "../auto-reply/commands-registry.js"; +export type { + ChatCommandDefinition, + CommandArgChoiceContext, + CommandArgDefinition, + CommandArgMenuSpec, + CommandArgValues, + CommandArgs, + CommandDetection, + CommandNormalizeOptions, + CommandScope, + NativeCommandSpec, + ResolvedCommandArgChoice, + ShouldHandleTextCommandsParams, +} from "../auto-reply/commands-registry.js"; +export { + resolveCommandAuthorizedFromAuthorizers, + resolveControlCommandGate, + resolveDualTextControlCommandGate, + type CommandAuthorizer, + type CommandGatingModeWhenAccessGroupsOff, +} from "../channels/command-gating.js"; +export { + resolveNativeCommandSessionTargets, + type ResolveNativeCommandSessionTargetsParams, +} from "../channels/native-command-session-targets.js"; +export { + resolveCommandAuthorization, + type CommandAuthorization, +} from "../auto-reply/command-auth.js"; +export { + listReservedChatSlashCommandNames, + listSkillCommandsForAgents, + listSkillCommandsForWorkspace, + resolveSkillCommandInvocation, +} from "../auto-reply/skill-commands.js"; +export { buildCommandsPaginationKeyboard } from "../auto-reply/reply/commands-info.js"; +export { + buildModelsProviderData, + formatModelsAvailableHeader, + resolveModelsCommandReply, +} from "../auto-reply/reply/commands-models.js"; +export type { ModelsProviderData } from "../auto-reply/reply/commands-models.js"; +export { resolveStoredModelOverride } from "../auto-reply/reply/model-selection.js"; +export type { StoredModelOverride } from "../auto-reply/reply/model-selection.js"; +export { + buildCommandsMessage, + buildCommandsMessagePaginated, + buildHelpMessage, +} from "../auto-reply/status.js"; + export type ResolveSenderCommandAuthorizationParams = { cfg: OpenClawConfig; rawBody: string; diff --git a/src/plugin-sdk/compat.ts b/src/plugin-sdk/compat.ts index 643557f0960..eb85c062c71 100644 --- a/src/plugin-sdk/compat.ts +++ b/src/plugin-sdk/compat.ts @@ -43,7 +43,7 @@ export * from "./channel-config-schema.js"; export * from "./channel-policy.js"; export * from "./reply-history.js"; export * from "./directory-runtime.js"; -export { mapAllowlistResolutionInputs } from "./allowlist-resolution.js"; +export { mapAllowlistResolutionInputs } from "./allow-from.js"; export { resolveBlueBubblesGroupRequireMention, diff --git a/src/plugin-sdk/config-runtime.ts b/src/plugin-sdk/config-runtime.ts index 67b2ec82fee..3836f15508d 100644 --- a/src/plugin-sdk/config-runtime.ts +++ b/src/plugin-sdk/config-runtime.ts @@ -1,19 +1,78 @@ // Shared config/runtime boundary for plugins that need config loading, // config writes, or session-store helpers without importing src internals. -export * from "../config/config.js"; -export * from "../config/markdown-tables.js"; -export * from "../config/group-policy.js"; -export * from "../config/runtime-group-policy.js"; -export * from "../config/commands.js"; -export * from "../config/discord-preview-streaming.js"; -export * from "../config/io.js"; -export * from "../config/telegram-custom-commands.js"; -export * from "../config/talk.js"; -export * from "../config/agent-limits.js"; -export * from "../cron/store.js"; -export * from "../sessions/model-overrides.js"; -export type * from "../config/types.slack.js"; +export { + getRuntimeConfigSnapshot, + loadConfig, + readConfigFileSnapshotForWrite, + writeConfigFile, +} from "../config/io.js"; +export { resolveMarkdownTableMode } from "../config/markdown-tables.js"; +export { + resolveChannelGroupPolicy, + resolveChannelGroupRequireMention, + type ChannelGroupPolicy, +} from "../config/group-policy.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + resolveOpenProviderRuntimeGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export { + isNativeCommandsExplicitlyDisabled, + resolveNativeCommandsEnabled, + resolveNativeSkillsEnabled, +} from "../config/commands.js"; +export { + TELEGRAM_COMMAND_NAME_PATTERN, + normalizeTelegramCommandName, + resolveTelegramCustomCommands, +} from "../config/telegram-custom-commands.js"; +export { + mapStreamingModeToSlackLegacyDraftStreamMode, + resolveDiscordPreviewStreamMode, + resolveSlackNativeStreaming, + resolveSlackStreamingMode, + resolveTelegramPreviewStreamMode, + type SlackLegacyDraftStreamMode, + type StreamingMode, +} from "../config/discord-preview-streaming.js"; +export { resolveActiveTalkProviderConfig } from "../config/talk.js"; +export { resolveAgentMaxConcurrent } from "../config/agent-limits.js"; +export { loadCronStore, resolveCronStorePath, saveCronStore } from "../cron/store.js"; +export { applyModelOverrideToSessionEntry } from "../sessions/model-overrides.js"; +export { coerceSecretRef } from "../config/types.secrets.js"; +export type { + DiscordAccountConfig, + DiscordActionConfig, + DiscordAutoPresenceConfig, + DiscordExecApprovalConfig, + DiscordGuildChannelConfig, + DiscordGuildEntry, + DiscordIntentsConfig, + DiscordSlashCommandConfig, + DmPolicy, + GroupPolicy, + MarkdownTableMode, + OpenClawConfig, + ReplyToMode, + SignalReactionNotificationMode, + SlackAccountConfig, + SlackChannelConfig, + SlackReactionNotificationMode, + SlackSlashCommandConfig, + TelegramAccountConfig, + TelegramActionConfig, + TelegramDirectConfig, + TelegramExecApprovalConfig, + TelegramGroupConfig, + TelegramInlineButtonsScope, + TelegramNetworkConfig, + TelegramTopicConfig, + TtsConfig, +} from "../config/types.js"; export { loadSessionStore, readSessionUpdatedAt, @@ -35,8 +94,3 @@ export { } from "../config/sessions/reset.js"; export { resolveSessionStoreEntry } from "../config/sessions/store.js"; export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js"; -export { - hasConfiguredSecretInput, - normalizeResolvedSecretInputString, - normalizeSecretInputString, -} from "../config/types.secrets.js"; diff --git a/src/plugin-sdk/conversation-runtime.ts b/src/plugin-sdk/conversation-runtime.ts index 66b7e3b938f..6a9546bf0f2 100644 --- a/src/plugin-sdk/conversation-runtime.ts +++ b/src/plugin-sdk/conversation-runtime.ts @@ -26,6 +26,36 @@ export { ensureConfiguredBindingTargetSession, resetConfiguredBindingTargetInPlace, } from "../channels/plugins/binding-targets.js"; +export { resolveConversationLabel } from "../channels/conversation-label.js"; +export { recordInboundSession } from "../channels/session.js"; +export { recordInboundSessionMetaSafe } from "../channels/session-meta.js"; +export { resolveThreadBindingConversationIdFromBindingId } from "../channels/thread-binding-id.js"; +export { + createScopedAccountReplyToModeResolver, + createStaticReplyToModeResolver, + createTopLevelChannelReplyToModeResolver, +} from "../channels/plugins/threading-helpers.js"; +export { + formatThreadBindingDurationLabel, + resolveThreadBindingFarewellText, + resolveThreadBindingIntroText, + resolveThreadBindingThreadName, +} from "../channels/thread-bindings-messages.js"; +export { + DISCORD_THREAD_BINDING_CHANNEL, + MATRIX_THREAD_BINDING_CHANNEL, + formatThreadBindingDisabledError, + resolveThreadBindingEffectiveExpiresAt, + resolveThreadBindingIdleTimeoutMs, + resolveThreadBindingIdleTimeoutMsForChannel, + resolveThreadBindingLifecycle, + resolveThreadBindingMaxAgeMs, + resolveThreadBindingMaxAgeMsForChannel, + resolveThreadBindingsEnabled, + resolveThreadBindingSpawnPolicy, + type ThreadBindingSpawnKind, + type ThreadBindingSpawnPolicy, +} from "../channels/thread-bindings-policy.js"; export type { ConfiguredBindingConversation, ConfiguredBindingResolution, diff --git a/src/plugin-sdk/core.ts b/src/plugin-sdk/core.ts index 6ed9704cfa8..24f99bb3dad 100644 --- a/src/plugin-sdk/core.ts +++ b/src/plugin-sdk/core.ts @@ -122,8 +122,6 @@ export { type RoutePeer, type RoutePeerKind, } from "../routing/resolve-route.js"; -export { buildOutboundBaseSessionKey } from "../infra/outbound/base-session-key.js"; -export { normalizeOutboundThreadId } from "../infra/outbound/thread-id.js"; export { resolveThreadSessionKeys } from "../routing/session-key.js"; export type ChannelOutboundSessionRouteParams = Parameters< diff --git a/src/plugin-sdk/directory-runtime.ts b/src/plugin-sdk/directory-runtime.ts index caa21657810..31209a89561 100644 --- a/src/plugin-sdk/directory-runtime.ts +++ b/src/plugin-sdk/directory-runtime.ts @@ -1,6 +1,16 @@ /** Shared directory listing helpers for plugins that derive users/groups from config maps. */ export type { DirectoryConfigParams } from "../channels/plugins/directory-types.js"; +export type { + ChannelDirectoryEntry, + ChannelDirectoryEntryKind, +} from "../channels/plugins/types.js"; export type { ReadOnlyInspectedAccount } from "../channels/read-only-account-inspect.js"; +export { + createChannelDirectoryAdapter, + createEmptyChannelDirectoryAdapter, + emptyChannelDirectoryList, + nullChannelDirectorySelf, +} from "../channels/plugins/directory-adapters.js"; export { applyDirectoryQueryAndLimit, collectNormalizedDirectoryIds, @@ -15,4 +25,5 @@ export { listDirectoryUserEntriesFromAllowFromAndMapKeys, toDirectoryEntries, } from "../channels/plugins/directory-config-helpers.js"; +export { createRuntimeDirectoryLiveAdapter } from "../channels/plugins/runtime-forwarders.js"; export { inspectReadOnlyChannelAccount } from "../channels/read-only-account-inspect.js"; diff --git a/src/plugin-sdk/extension-shared.ts b/src/plugin-sdk/extension-shared.ts index 43c11f7c09d..a0c5a12faa1 100644 --- a/src/plugin-sdk/extension-shared.ts +++ b/src/plugin-sdk/extension-shared.ts @@ -1,5 +1,5 @@ import type { z } from "zod"; -import { runPassiveAccountLifecycle } from "./channel-runtime.js"; +import { runPassiveAccountLifecycle } from "./channel-lifecycle.js"; import { createLoggerBackedRuntime } from "./runtime.js"; type PassiveChannelStatusSnapshot = { diff --git a/src/plugin-sdk/infra-runtime.ts b/src/plugin-sdk/infra-runtime.ts index 0339ca1f307..dfc21eb753b 100644 --- a/src/plugin-sdk/infra-runtime.ts +++ b/src/plugin-sdk/infra-runtime.ts @@ -27,6 +27,7 @@ export * from "../infra/net/proxy-env.js"; export * from "../infra/net/proxy-fetch.js"; export * from "../infra/net/ssrf.js"; export * from "../infra/outbound/identity.js"; +export * from "../infra/outbound/send-deps.js"; export * from "../infra/retry.js"; export * from "../infra/retry-policy.js"; export * from "../infra/scp-host.ts"; @@ -37,4 +38,5 @@ export * from "../infra/system-message.ts"; export * from "../infra/tmp-openclaw-dir.js"; export * from "../infra/transport-ready.js"; export * from "../infra/wsl.ts"; +export { createRuntimeOutboundDelegates } from "../channels/plugins/runtime-forwarders.js"; export * from "./ssrf-policy.js"; diff --git a/src/plugin-sdk/line.ts b/src/plugin-sdk/line.ts index 16a6c235ac3..e2196996397 100644 --- a/src/plugin-sdk/line.ts +++ b/src/plugin-sdk/line.ts @@ -32,7 +32,6 @@ export { resolveDefaultLineAccountId, resolveLineAccount, } from "../line/accounts.js"; -export { lineSetupAdapter, lineSetupWizard } from "../../extensions/line/setup-api.js"; export { LineConfigSchema } from "../line/config-schema.js"; export type { LineChannelData, LineConfig, ResolvedLineAccount } from "../line/types.js"; export { diff --git a/src/plugin-sdk/matrix.ts b/src/plugin-sdk/matrix.ts index 3d6ff402d59..22bba927e64 100644 --- a/src/plugin-sdk/matrix.ts +++ b/src/plugin-sdk/matrix.ts @@ -1 +1,178 @@ -export * from "../plugins/runtime/runtime-matrix-contract.js"; +// Private helper surface for the bundled matrix plugin. +// Keep this list additive and scoped to symbols used under extensions/matrix. + +import { createOptionalChannelSetupSurface } from "./channel-setup.js"; + +export { + createActionGate, + jsonResult, + readNumberParam, + readReactionParams, + readStringArrayParam, + readStringParam, +} from "../agents/tools/common.js"; +export type { ReplyPayload } from "../auto-reply/types.js"; +export { resolveAckReaction } from "../agents/identity.js"; +export { + compileAllowlist, + resolveCompiledAllowlistMatch, + resolveAllowlistCandidates, + resolveAllowlistMatchByCandidates, +} from "../channels/allowlist-match.js"; +export { + addAllowlistUserEntriesFromConfigEntry, + buildAllowlistResolutionSummary, + canonicalizeAllowlistWithResolvedIds, + mergeAllowlist, + patchAllowlistUsersInConfigEntries, + summarizeMapping, +} from "../channels/allowlists/resolve-utils.js"; +export { ensureConfiguredAcpBindingReady } from "../acp/persistent-bindings.lifecycle.js"; +export { resolveConfiguredAcpBindingRecord } from "../acp/persistent-bindings.resolve.js"; +export { resolveControlCommandGate } from "../channels/command-gating.js"; +export type { NormalizedLocation } from "../channels/location.js"; +export { formatLocationText, toLocationContext } from "../channels/location.js"; +export { logInboundDrop, logTypingFailure } from "../channels/logging.js"; +export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js"; +export { formatAllowlistMatchMeta } from "../channels/plugins/allowlist-match.js"; +export { + buildChannelKeyCandidates, + resolveChannelEntryMatch, +} from "../channels/plugins/channel-config.js"; +export { createAccountListHelpers } from "../channels/plugins/account-helpers.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../channels/plugins/config-helpers.js"; +export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; +export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; +export { + buildSingleChannelSecretPromptState, + addWildcardAllowFrom, + mergeAllowFromEntries, + promptAccountId, + promptSingleChannelSecretInput, + setTopLevelChannelGroupPolicy, +} from "../channels/plugins/setup-wizard-helpers.js"; +export { promptChannelAccessConfig } from "../channels/plugins/setup-group-access.js"; +export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js"; +export { + applyAccountNameToChannelSection, + moveSingleAccountChannelSectionToDefaultAccount, +} from "../channels/plugins/setup-helpers.js"; +export type { + BaseProbeResult, + ChannelDirectoryEntry, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelMessageActionContext, + ChannelMessageActionName, + ChannelMessageToolDiscovery, + ChannelMessageToolSchemaContribution, + ChannelOutboundAdapter, + ChannelResolveKind, + ChannelResolveResult, + ChannelSetupInput, + ChannelToolSend, +} from "../channels/plugins/types.js"; +export type { ChannelPlugin } from "../channels/plugins/types.plugin.js"; +export { createReplyPrefixOptions } from "../channels/reply-prefix.js"; +export { resolveThreadBindingFarewellText } from "../channels/thread-bindings-messages.js"; +export { + resolveThreadBindingIdleTimeoutMsForChannel, + resolveThreadBindingMaxAgeMsForChannel, +} from "../channels/thread-bindings-policy.js"; +export { + setMatrixThreadBindingIdleTimeoutBySessionKey, + setMatrixThreadBindingMaxAgeBySessionKey, +} from "../../extensions/matrix/thread-bindings-runtime.js"; +export { createTypingCallbacks } from "../channels/typing.js"; +export { createChannelReplyPipeline } from "./channel-reply-pipeline.js"; +export type { OpenClawConfig } from "../config/config.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../config/runtime-group-policy.js"; +export type { + DmPolicy, + GroupPolicy, + GroupToolPolicyConfig, + MarkdownTableMode, +} from "../config/types.js"; +export type { SecretInput } from "./secret-input.js"; +export { + buildSecretInputSchema, + hasConfiguredSecretInput, + normalizeResolvedSecretInputString, + normalizeSecretInputString, +} from "./secret-input.js"; +export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js"; +export { MarkdownConfigSchema } from "../config/zod-schema.core.js"; +export { formatZonedTimestamp } from "../infra/format-time/format-datetime.js"; +export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js"; +export { maybeCreateMatrixMigrationSnapshot } from "../infra/matrix-migration-snapshot.js"; +export { + getSessionBindingService, + registerSessionBindingAdapter, + unregisterSessionBindingAdapter, +} from "../infra/outbound/session-binding-service.js"; +export { resolveOutboundSendDep } from "../infra/outbound/send-deps.js"; +export type { + BindingTargetKind, + SessionBindingRecord, +} from "../infra/outbound/session-binding-service.js"; +export { isPrivateOrLoopbackHost } from "../gateway/net.js"; +export { getAgentScopedMediaLocalRoots } from "../media/local-roots.js"; +export { emptyPluginConfigSchema } from "../plugins/config-schema.js"; +export type { PluginRuntime, RuntimeLogger } from "../plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../plugins/types.js"; +export type { PollInput } from "../polls.js"; +export { normalizePollInput } from "../polls.js"; +export { + DEFAULT_ACCOUNT_ID, + normalizeAccountId, + normalizeOptionalAccountId, + resolveAgentIdFromSessionKey, +} from "../routing/session-key.js"; +export type { RuntimeEnv } from "../runtime.js"; +export { normalizeStringEntries } from "../shared/string-normalization.js"; +export { formatDocsLink } from "../terminal/links.js"; +export { redactSensitiveText } from "../logging/redact.js"; +export type { WizardPrompter } from "../wizard/prompts.js"; +export { + evaluateGroupRouteAccessForPolicy, + resolveSenderScopedGroupPolicy, +} from "./group-access.js"; +export { createChannelPairingController } from "./channel-pairing.js"; +export { readJsonFileWithFallback, writeJsonFileAtomically } from "./json-store.js"; +export { formatResolvedUnresolvedNote } from "./resolution-notes.js"; +export { runPluginCommandWithTimeout } from "./run-command.js"; +export { createLoggerBackedRuntime, resolveRuntimeEnv } from "./runtime.js"; +export { dispatchReplyFromConfigWithSettledDispatcher } from "./inbound-reply-dispatch.js"; +export { + buildProbeChannelStatusSummary, + collectStatusIssuesFromLastError, +} from "./status-helpers.js"; +export { + resolveMatrixAccountStorageRoot, + resolveMatrixCredentialsDir, + resolveMatrixCredentialsPath, + resolveMatrixLegacyFlatStoragePaths, +} from "../../extensions/matrix/helper-api.js"; +export { getMatrixScopedEnvVarNames } from "../../extensions/matrix/helper-api.js"; +export { + requiresExplicitMatrixDefaultAccount, + resolveMatrixDefaultOrOnlyAccountId, +} from "../../extensions/matrix/helper-api.js"; + +const matrixSetup = createOptionalChannelSetupSurface({ + channel: "matrix", + label: "Matrix", + npmSpec: "@openclaw/matrix", + docsPath: "/channels/matrix", +}); + +export const matrixSetupWizard = matrixSetup.setupWizard; +export const matrixSetupAdapter = matrixSetup.setupAdapter; diff --git a/src/plugin-sdk/media-runtime.ts b/src/plugin-sdk/media-runtime.ts index f824246ed51..8563c4513a6 100644 --- a/src/plugin-sdk/media-runtime.ts +++ b/src/plugin-sdk/media-runtime.ts @@ -14,9 +14,15 @@ export * from "../media/outbound-attachment.js"; export * from "../media/png-encode.ts"; export * from "../media/store.js"; export * from "../media/temp-files.js"; +export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; export * from "./agent-media-payload.js"; export * from "../media-understanding/audio-preflight.ts"; export * from "../media-understanding/defaults.js"; export * from "../media-understanding/providers/image-runtime.ts"; export * from "../media-understanding/runner.js"; export * from "../polls.js"; +export { + createDirectTextMediaOutbound, + createScopedChannelMediaMaxBytesResolver, + resolveScopedChannelMediaMaxBytes, +} from "../channels/plugins/outbound/direct-text-media.js"; diff --git a/src/plugin-sdk/provider-auth.ts b/src/plugin-sdk/provider-auth.ts index bdc73f50793..b5de7026f0e 100644 --- a/src/plugin-sdk/provider-auth.ts +++ b/src/plugin-sdk/provider-auth.ts @@ -47,3 +47,5 @@ export { listKnownProviderAuthEnvVarNames, omitEnvKeysCaseInsensitive, } from "../secrets/provider-env-vars.js"; +export { buildOauthProviderAuthResult } from "./provider-auth-result.js"; +export { generatePkceVerifierChallenge, toFormUrlEncoded } from "./oauth-utils.js"; diff --git a/src/plugin-sdk/provider-oauth.ts b/src/plugin-sdk/provider-oauth.ts deleted file mode 100644 index 8e183c55954..00000000000 --- a/src/plugin-sdk/provider-oauth.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Focused OAuth helpers for provider plugins. - -export { buildOauthProviderAuthResult } from "./provider-auth-result.js"; -export { generatePkceVerifierChallenge, toFormUrlEncoded } from "./oauth-utils.js"; diff --git a/src/plugin-sdk/reply-payload.ts b/src/plugin-sdk/reply-payload.ts index 52cc878c83d..98df862d748 100644 --- a/src/plugin-sdk/reply-payload.ts +++ b/src/plugin-sdk/reply-payload.ts @@ -1,3 +1,8 @@ +import type { ChannelOutboundAdapter } from "../channels/plugins/types.js"; + +export type { MediaPayload, MediaPayloadInput } from "../channels/plugins/media-payload.js"; +export { buildMediaPayload } from "../channels/plugins/media-payload.js"; + export type OutboundReplyPayload = { text?: string; mediaUrls?: string[]; @@ -15,6 +20,13 @@ export type SendableOutboundReplyParts = { hasContent: boolean; }; +type SendPayloadContext = Parameters>[0]; +type SendPayloadResult = Awaited>>; +type SendPayloadAdapter = Pick< + ChannelOutboundAdapter, + "sendMedia" | "sendText" | "chunker" | "textChunkLimit" +>; + /** Extract the supported outbound reply fields from loose tool or agent payload objects. */ export function normalizeOutboundReplyPayload( payload: Record, @@ -62,6 +74,11 @@ export function resolveOutboundMediaUrls(payload: { return []; } +/** Resolve media URLs from a channel sendPayload context after legacy fallback normalization. */ +export function resolvePayloadMediaUrls(payload: SendPayloadContext["payload"]): string[] { + return resolveOutboundMediaUrls(payload); +} + /** Count outbound media items after legacy single-media fallback normalization. */ export function countOutboundMedia(payload: { mediaUrls?: string[]; mediaUrl?: string }): number { return resolveOutboundMediaUrls(payload).length; @@ -163,6 +180,99 @@ export async function sendPayloadWithChunkedTextAndMedia< return lastResult!; } +export async function sendPayloadMediaSequence(params: { + text: string; + mediaUrls: readonly string[]; + send: (input: { + text: string; + mediaUrl: string; + index: number; + isFirst: boolean; + }) => Promise; +}): Promise { + let lastResult: TResult | undefined; + for (let i = 0; i < params.mediaUrls.length; i += 1) { + const mediaUrl = params.mediaUrls[i]; + if (!mediaUrl) { + continue; + } + lastResult = await params.send({ + text: i === 0 ? params.text : "", + mediaUrl, + index: i, + isFirst: i === 0, + }); + } + return lastResult; +} + +export async function sendPayloadMediaSequenceOrFallback(params: { + text: string; + mediaUrls: readonly string[]; + send: (input: { + text: string; + mediaUrl: string; + index: number; + isFirst: boolean; + }) => Promise; + fallbackResult: TResult; + sendNoMedia?: () => Promise; +}): Promise { + if (params.mediaUrls.length === 0) { + return params.sendNoMedia ? await params.sendNoMedia() : params.fallbackResult; + } + return (await sendPayloadMediaSequence(params)) ?? params.fallbackResult; +} + +export async function sendPayloadMediaSequenceAndFinalize(params: { + text: string; + mediaUrls: readonly string[]; + send: (input: { + text: string; + mediaUrl: string; + index: number; + isFirst: boolean; + }) => Promise; + finalize: () => Promise; +}): Promise { + if (params.mediaUrls.length > 0) { + await sendPayloadMediaSequence(params); + } + return await params.finalize(); +} + +export async function sendTextMediaPayload(params: { + channel: string; + ctx: SendPayloadContext; + adapter: SendPayloadAdapter; +}): Promise { + const text = params.ctx.payload.text ?? ""; + const urls = resolvePayloadMediaUrls(params.ctx.payload); + if (!text && urls.length === 0) { + return { channel: params.channel, messageId: "" }; + } + if (urls.length > 0) { + const lastResult = await sendPayloadMediaSequence({ + text, + mediaUrls: urls, + send: async ({ text, mediaUrl }) => + await params.adapter.sendMedia!({ + ...params.ctx, + text, + mediaUrl, + }), + }); + return lastResult ?? { channel: params.channel, messageId: "" }; + } + const limit = params.adapter.textChunkLimit; + const chunks = limit && params.adapter.chunker ? params.adapter.chunker(text, limit) : [text]; + let lastResult: Awaited>>; + for (const chunk of chunks) { + lastResult = await params.adapter.sendText!({ ...params.ctx, text: chunk }); + } + return lastResult!; +} + /** Detect numeric-looking target ids for channels that distinguish ids from handles. */ export function isNumericTargetId(raw: string): boolean { const trimmed = raw.trim(); diff --git a/src/plugin-sdk/reply-runtime.ts b/src/plugin-sdk/reply-runtime.ts index 689cf4cdba7..386ecae10ad 100644 --- a/src/plugin-sdk/reply-runtime.ts +++ b/src/plugin-sdk/reply-runtime.ts @@ -1,31 +1,49 @@ // Shared agent/reply runtime helpers for channel plugins. Keep channel plugins // off direct src/auto-reply imports by routing common reply primitives here. -export * from "../auto-reply/chunk.js"; -export * from "../auto-reply/command-auth.js"; -export * from "../auto-reply/command-detection.js"; -export * from "../auto-reply/commands-registry.js"; -export * from "../auto-reply/dispatch.js"; -export * from "../auto-reply/group-activation.js"; -export * from "../auto-reply/heartbeat.js"; -export * from "../auto-reply/heartbeat-reply-payload.js"; -export * from "../auto-reply/inbound-debounce.js"; -export * from "../auto-reply/reply.js"; -export * from "../auto-reply/tokens.js"; -export * from "../auto-reply/envelope.js"; -export * from "../auto-reply/reply/history.js"; -export * from "../auto-reply/reply/abort.js"; -export * from "../auto-reply/reply/btw-command.js"; -export * from "../auto-reply/reply/commands-models.js"; -export * from "../auto-reply/reply/inbound-dedupe.js"; -export * from "../auto-reply/reply/inbound-context.js"; -export * from "../auto-reply/reply/mentions.js"; -export * from "../auto-reply/reply/reply-dispatcher.js"; -export * from "../auto-reply/reply/reply-reference.js"; -export * from "../auto-reply/reply/provider-dispatcher.js"; -export * from "../auto-reply/reply/model-selection.js"; -export * from "../auto-reply/reply/commands-info.js"; -export * from "../auto-reply/skill-commands.js"; -export * from "../auto-reply/status.js"; -export type { ReplyPayload } from "../auto-reply/types.js"; +export { + chunkMarkdownTextWithMode, + chunkText, + chunkTextWithMode, + resolveChunkMode, + resolveTextChunkLimit, +} from "../auto-reply/chunk.js"; +export type { ChunkMode } from "../auto-reply/chunk.js"; +export { + dispatchInboundMessage, + dispatchInboundMessageWithBufferedDispatcher, + dispatchInboundMessageWithDispatcher, +} from "../auto-reply/dispatch.js"; +export { + normalizeGroupActivation, + parseActivationCommand, +} from "../auto-reply/group-activation.js"; +export { + HEARTBEAT_PROMPT, + DEFAULT_HEARTBEAT_ACK_MAX_CHARS, + resolveHeartbeatPrompt, + stripHeartbeatToken, +} from "../auto-reply/heartbeat.js"; +export { resolveHeartbeatReplyPayload } from "../auto-reply/heartbeat-reply-payload.js"; +export { getReplyFromConfig } from "../auto-reply/reply.js"; +export { HEARTBEAT_TOKEN, isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; +export { isAbortRequestText } from "../auto-reply/reply/abort.js"; +export { isBtwRequestText } from "../auto-reply/reply/btw-command.js"; +export { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js"; +export { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js"; +export { + dispatchReplyWithBufferedBlockDispatcher, + dispatchReplyWithDispatcher, +} from "../auto-reply/reply/provider-dispatcher.js"; +export { + createReplyDispatcher, + createReplyDispatcherWithTyping, +} from "../auto-reply/reply/reply-dispatcher.js"; +export type { + ReplyDispatcher, + ReplyDispatcherOptions, + ReplyDispatcherWithTypingOptions, +} from "../auto-reply/reply/reply-dispatcher.js"; +export { createReplyReferencePlanner } from "../auto-reply/reply/reply-reference.js"; +export type { GetReplyOptions, ReplyPayload } from "../auto-reply/types.js"; export type { FinalizedMsgContext, MsgContext } from "../auto-reply/templating.js"; diff --git a/src/plugin-sdk/routing.ts b/src/plugin-sdk/routing.ts index 144304a607c..6bf7917170b 100644 --- a/src/plugin-sdk/routing.ts +++ b/src/plugin-sdk/routing.ts @@ -29,3 +29,6 @@ export { formatSetExplicitDefaultInstruction, formatSetExplicitDefaultToConfiguredInstruction, } from "../routing/default-account-warnings.js"; +export { buildOutboundBaseSessionKey } from "../infra/outbound/base-session-key.js"; +export { normalizeOutboundThreadId } from "../infra/outbound/thread-id.js"; +export { normalizeMessageChannel, resolveGatewayMessageChannel } from "../utils/message-channel.js"; diff --git a/src/plugin-sdk/runtime-api-guardrails.test.ts b/src/plugin-sdk/runtime-api-guardrails.test.ts index afa32af0b7f..0468f9b55a0 100644 --- a/src/plugin-sdk/runtime-api-guardrails.test.ts +++ b/src/plugin-sdk/runtime-api-guardrails.test.ts @@ -27,21 +27,27 @@ const RUNTIME_API_EXPORT_GUARDS: Record = { 'export * from "./src/send.js";', ], "extensions/imessage/runtime-api.ts": [ - 'export { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE, buildChannelConfigSchema, collectStatusIssuesFromLastError, formatTrimmedAllowFromEntries, getChatChannelMeta, looksLikeIMessageTargetId, normalizeIMessageMessagingTarget, resolveChannelMediaMaxBytes, resolveIMessageConfigAllowFrom, resolveIMessageConfigDefaultTo, IMessageConfigSchema, type ChannelPlugin, type IMessageAccountConfig } from "openclaw/plugin-sdk/imessage";', + 'export { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE, buildChannelConfigSchema, collectStatusIssuesFromLastError, formatTrimmedAllowFromEntries, getChatChannelMeta, looksLikeIMessageTargetId, normalizeIMessageMessagingTarget, resolveChannelMediaMaxBytes, resolveIMessageConfigAllowFrom, resolveIMessageConfigDefaultTo, IMessageConfigSchema, type ChannelPlugin, type IMessageAccountConfig } from "../../src/plugin-sdk/imessage.js";', 'export { resolveIMessageGroupRequireMention, resolveIMessageGroupToolPolicy } from "./src/group-policy.js";', 'export { monitorIMessageProvider } from "./src/monitor.js";', 'export type { MonitorIMessageOpts } from "./src/monitor.js";', 'export { probeIMessage } from "./src/probe.js";', 'export { sendMessageIMessage } from "./src/send.js";', ], - "extensions/googlechat/runtime-api.ts": ['export * from "openclaw/plugin-sdk/googlechat";'], + "extensions/googlechat/runtime-api.ts": ['export * from "../../src/plugin-sdk/googlechat.js";'], "extensions/matrix/runtime-api.ts": [ 'export * from "./src/auth-precedence.js";', 'export * from "./helper-api.js";', - 'export * from "./thread-bindings-runtime.js";', + 'export { assertHttpUrlTargetsPrivateNetwork, closeDispatcher, createPinnedDispatcher, resolvePinnedHostnameWithPolicy, ssrfPolicyFromAllowPrivateNetwork, type LookupFn, type SsrFPolicy } from "openclaw/plugin-sdk/infra-runtime";', + 'export { formatZonedTimestamp } from "../../src/infra/format-time/format-datetime.js";', + 'export { setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey } from "./thread-bindings-runtime.js";', + 'export { writeJsonFileAtomically } from "../../src/plugin-sdk/json-store.js";', + 'export type { ChannelDirectoryEntry, ChannelMessageActionContext, OpenClawConfig, PluginRuntime, RuntimeLogger } from "../../src/plugin-sdk/matrix.js";', + 'export type { RuntimeEnv } from "../../src/runtime.js";', + 'export type { WizardPrompter } from "../../src/wizard/prompts.js";', ], "extensions/nextcloud-talk/runtime-api.ts": [ - 'export * from "openclaw/plugin-sdk/nextcloud-talk";', + 'export * from "../../src/plugin-sdk/nextcloud-talk.js";', ], "extensions/signal/runtime-api.ts": ['export * from "./src/runtime-api.js";'], "extensions/slack/runtime-api.ts": [ @@ -52,12 +58,12 @@ const RUNTIME_API_EXPORT_GUARDS: Record = { 'export * from "./src/resolve-users.js";', ], "extensions/telegram/runtime-api.ts": [ - 'export type { ChannelMessageActionAdapter, ChannelPlugin, OpenClawConfig, OpenClawPluginApi, PluginRuntime, TelegramAccountConfig, TelegramActionConfig, TelegramNetworkConfig } from "openclaw/plugin-sdk/telegram";', + 'export type { ChannelMessageActionAdapter, ChannelPlugin, OpenClawConfig, OpenClawPluginApi, PluginRuntime, TelegramAccountConfig, TelegramActionConfig, TelegramNetworkConfig } from "../../src/plugin-sdk/telegram.js";', 'export type { OpenClawPluginService, OpenClawPluginServiceContext, PluginLogger } from "openclaw/plugin-sdk/core";', 'export type { AcpRuntime, AcpRuntimeCapabilities, AcpRuntimeDoctorReport, AcpRuntimeEnsureInput, AcpRuntimeEvent, AcpRuntimeHandle, AcpRuntimeStatus, AcpRuntimeTurnInput, AcpRuntimeErrorCode, AcpSessionUpdateTag } from "openclaw/plugin-sdk/acp-runtime";', 'export { AcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";', - 'export { buildTokenChannelStatusSummary, clearAccountEntryFields, DEFAULT_ACCOUNT_ID, normalizeAccountId, PAIRING_APPROVED_MESSAGE, parseTelegramTopicConversation, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, resolveTelegramPollVisibility } from "openclaw/plugin-sdk/telegram";', - 'export { buildChannelConfigSchema, getChatChannelMeta, jsonResult, readNumberParam, readReactionParams, readStringArrayParam, readStringOrNumberParam, readStringParam, resolvePollMaxSelections, TelegramConfigSchema } from "openclaw/plugin-sdk/telegram-core";', + 'export { buildTokenChannelStatusSummary, clearAccountEntryFields, DEFAULT_ACCOUNT_ID, normalizeAccountId, PAIRING_APPROVED_MESSAGE, parseTelegramTopicConversation, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, resolveTelegramPollVisibility } from "../../src/plugin-sdk/telegram.js";', + 'export { buildChannelConfigSchema, getChatChannelMeta, jsonResult, readNumberParam, readReactionParams, readStringArrayParam, readStringOrNumberParam, readStringParam, resolvePollMaxSelections, TelegramConfigSchema } from "../../src/plugin-sdk/telegram-core.js";', 'export type { TelegramProbe } from "./src/probe.js";', 'export { auditTelegramGroupMembership, collectTelegramUnmentionedGroupIds } from "./src/audit.js";', 'export { telegramMessageActions } from "./src/channel-actions.js";', diff --git a/src/plugin-sdk/status-helpers.ts b/src/plugin-sdk/status-helpers.ts index 231c438b8ef..7ae74b14ed6 100644 --- a/src/plugin-sdk/status-helpers.ts +++ b/src/plugin-sdk/status-helpers.ts @@ -1,4 +1,12 @@ import type { ChannelStatusIssue } from "../channels/plugins/types.js"; +export { isRecord } from "../channels/plugins/status-issues/shared.js"; +export { + appendMatchMetadata, + asString, + collectIssuesForEnabledAccounts, + formatMatchMetadata, + resolveEnabledConfiguredAccountId, +} from "../channels/plugins/status-issues/shared.js"; type RuntimeLifecycleSnapshot = { running?: boolean | null; diff --git a/src/plugin-sdk/subpaths.test.ts b/src/plugin-sdk/subpaths.test.ts index 566dc6645e1..79a6bfbaab0 100644 --- a/src/plugin-sdk/subpaths.test.ts +++ b/src/plugin-sdk/subpaths.test.ts @@ -1,9 +1,32 @@ -import * as bluebubblesSdk from "openclaw/plugin-sdk/bluebubbles"; +import * as allowFromSdk from "openclaw/plugin-sdk/allow-from"; +import * as channelActionsSdk from "openclaw/plugin-sdk/channel-actions"; +import * as channelConfigHelpersSdk from "openclaw/plugin-sdk/channel-config-helpers"; +import type { + BaseProbeResult as ContractBaseProbeResult, + BaseTokenResolution as ContractBaseTokenResolution, + ChannelAgentTool as ContractChannelAgentTool, + ChannelAccountSnapshot as ContractChannelAccountSnapshot, + ChannelGroupContext as ContractChannelGroupContext, + ChannelMessageActionAdapter as ContractChannelMessageActionAdapter, + ChannelMessageActionContext as ContractChannelMessageActionContext, + ChannelMessageActionName as ContractChannelMessageActionName, + ChannelMessageToolDiscovery as ContractChannelMessageToolDiscovery, + ChannelStatusIssue as ContractChannelStatusIssue, + ChannelThreadingContext as ContractChannelThreadingContext, + ChannelThreadingToolContext as ContractChannelThreadingToolContext, +} from "openclaw/plugin-sdk/channel-contract"; +import * as channelFeedbackSdk from "openclaw/plugin-sdk/channel-feedback"; +import * as channelInboundSdk from "openclaw/plugin-sdk/channel-inbound"; +import * as channelLifecycleSdk from "openclaw/plugin-sdk/channel-lifecycle"; import * as channelPairingSdk from "openclaw/plugin-sdk/channel-pairing"; import * as channelReplyPipelineSdk from "openclaw/plugin-sdk/channel-reply-pipeline"; import * as channelRuntimeSdk from "openclaw/plugin-sdk/channel-runtime"; import * as channelSendResultSdk from "openclaw/plugin-sdk/channel-send-result"; import * as channelSetupSdk from "openclaw/plugin-sdk/channel-setup"; +import * as channelTargetsSdk from "openclaw/plugin-sdk/channel-targets"; +import * as commandAuthSdk from "openclaw/plugin-sdk/command-auth"; +import * as configRuntimeSdk from "openclaw/plugin-sdk/config-runtime"; +import * as conversationRuntimeSdk from "openclaw/plugin-sdk/conversation-runtime"; import * as coreSdk from "openclaw/plugin-sdk/core"; import type { ChannelMessageActionContext as CoreChannelMessageActionContext, @@ -11,31 +34,39 @@ import type { PluginRuntime as CorePluginRuntime, } from "openclaw/plugin-sdk/core"; import * as directoryRuntimeSdk from "openclaw/plugin-sdk/directory-runtime"; -import * as discordSdk from "openclaw/plugin-sdk/discord"; -import * as imessageSdk from "openclaw/plugin-sdk/imessage"; -import * as imessageCoreSdk from "openclaw/plugin-sdk/imessage-core"; +import * as infraRuntimeSdk from "openclaw/plugin-sdk/infra-runtime"; import * as lazyRuntimeSdk from "openclaw/plugin-sdk/lazy-runtime"; +import * as mediaRuntimeSdk from "openclaw/plugin-sdk/media-runtime"; import * as ollamaSetupSdk from "openclaw/plugin-sdk/ollama-setup"; import * as providerAuthSdk from "openclaw/plugin-sdk/provider-auth"; import * as providerModelsSdk from "openclaw/plugin-sdk/provider-models"; -import * as providerOauthSdk from "openclaw/plugin-sdk/provider-oauth"; import * as providerSetupSdk from "openclaw/plugin-sdk/provider-setup"; +import * as replyHistorySdk from "openclaw/plugin-sdk/reply-history"; import * as replyPayloadSdk from "openclaw/plugin-sdk/reply-payload"; +import * as replyRuntimeSdk from "openclaw/plugin-sdk/reply-runtime"; import * as routingSdk from "openclaw/plugin-sdk/routing"; import * as runtimeSdk from "openclaw/plugin-sdk/runtime"; import * as sandboxSdk from "openclaw/plugin-sdk/sandbox"; import * as secretInputSdk from "openclaw/plugin-sdk/secret-input"; import * as selfHostedProviderSetupSdk from "openclaw/plugin-sdk/self-hosted-provider-setup"; import * as setupSdk from "openclaw/plugin-sdk/setup"; -import * as slackSdk from "openclaw/plugin-sdk/slack"; -import * as telegramSdk from "openclaw/plugin-sdk/telegram"; import * as testingSdk from "openclaw/plugin-sdk/testing"; import * as webhookIngressSdk from "openclaw/plugin-sdk/webhook-ingress"; -import * as whatsappSdk from "openclaw/plugin-sdk/whatsapp"; -import * as whatsappActionRuntimeSdk from "openclaw/plugin-sdk/whatsapp-action-runtime"; -import * as whatsappLoginQrSdk from "openclaw/plugin-sdk/whatsapp-login-qr"; import { describe, expect, expectTypeOf, it } from "vitest"; import type { ChannelMessageActionContext } from "../channels/plugins/types.js"; +import type { + BaseProbeResult, + BaseTokenResolution, + ChannelAgentTool, + ChannelAccountSnapshot, + ChannelGroupContext, + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelMessageToolDiscovery, + ChannelStatusIssue, + ChannelThreadingContext, + ChannelThreadingToolContext, +} from "../channels/plugins/types.js"; import type { PluginRuntime } from "../plugins/runtime/types.js"; import type { OpenClawPluginApi } from "../plugins/types.js"; import type { @@ -55,21 +86,53 @@ const bundledExtensionSubpathLoaders = pluginSdkSubpaths.map((id: string) => ({ const asExports = (mod: object) => mod as Record; const accountHelpersSdk = await import("openclaw/plugin-sdk/account-helpers"); const allowlistEditSdk = await import("openclaw/plugin-sdk/allowlist-config-edit"); +const statusHelpersSdk = await import("openclaw/plugin-sdk/status-helpers"); describe("plugin-sdk subpath exports", () => { it("keeps the curated public list free of internal implementation subpaths", () => { expect(pluginSdkSubpaths).not.toContain("acpx"); + expect(pluginSdkSubpaths).not.toContain("bluebubbles"); expect(pluginSdkSubpaths).not.toContain("compat"); expect(pluginSdkSubpaths).not.toContain("device-pair"); + expect(pluginSdkSubpaths).not.toContain("discord"); + expect(pluginSdkSubpaths).not.toContain("feishu"); expect(pluginSdkSubpaths).not.toContain("google"); + expect(pluginSdkSubpaths).not.toContain("googlechat"); + expect(pluginSdkSubpaths).not.toContain("imessage"); + expect(pluginSdkSubpaths).not.toContain("irc"); + expect(pluginSdkSubpaths).not.toContain("imessage-core"); + expect(pluginSdkSubpaths).not.toContain("line"); + expect(pluginSdkSubpaths).not.toContain("line-core"); expect(pluginSdkSubpaths).not.toContain("lobster"); + expect(pluginSdkSubpaths).not.toContain("mattermost"); + expect(pluginSdkSubpaths).not.toContain("matrix"); + expect(pluginSdkSubpaths).not.toContain("msteams"); + expect(pluginSdkSubpaths).not.toContain("nextcloud-talk"); + expect(pluginSdkSubpaths).not.toContain("nostr"); expect(pluginSdkSubpaths).not.toContain("pairing-access"); expect(pluginSdkSubpaths).not.toContain("qwen-portal-auth"); expect(pluginSdkSubpaths).not.toContain("reply-prefix"); expect(pluginSdkSubpaths).not.toContain("signal-core"); + expect(pluginSdkSubpaths).not.toContain("slack"); expect(pluginSdkSubpaths).not.toContain("synology-chat"); + expect(pluginSdkSubpaths).not.toContain("telegram"); + expect(pluginSdkSubpaths).not.toContain("telegram-core"); + expect(pluginSdkSubpaths).not.toContain("tlon"); + expect(pluginSdkSubpaths).not.toContain("twitch"); expect(pluginSdkSubpaths).not.toContain("typing"); + expect(pluginSdkSubpaths).not.toContain("voice-call"); + expect(pluginSdkSubpaths).not.toContain("whatsapp"); + expect(pluginSdkSubpaths).not.toContain("whatsapp-action-runtime"); + expect(pluginSdkSubpaths).not.toContain("whatsapp-core"); + expect(pluginSdkSubpaths).not.toContain("whatsapp-login-qr"); + expect(pluginSdkSubpaths).not.toContain("whatsapp-shared"); + expect(pluginSdkSubpaths).not.toContain("secret-input-runtime"); + expect(pluginSdkSubpaths).not.toContain("secret-input-schema"); + expect(pluginSdkSubpaths).not.toContain("zalo"); expect(pluginSdkSubpaths).not.toContain("zai"); + expect(pluginSdkSubpaths).not.toContain("zalouser"); + expect(pluginSdkSubpaths).not.toContain("discord-core"); + expect(pluginSdkSubpaths).not.toContain("slack-core"); expect(pluginSdkSubpaths).not.toContain("provider-model-definitions"); }); @@ -92,11 +155,31 @@ describe("plugin-sdk subpath exports", () => { }); it("exports reply payload helpers from the dedicated subpath", () => { + expect(typeof replyPayloadSdk.buildMediaPayload).toBe("function"); expect(typeof replyPayloadSdk.deliverTextOrMediaReply).toBe("function"); expect(typeof replyPayloadSdk.resolveOutboundMediaUrls).toBe("function"); + expect(typeof replyPayloadSdk.resolvePayloadMediaUrls).toBe("function"); + expect(typeof replyPayloadSdk.sendPayloadMediaSequenceAndFinalize).toBe("function"); + expect(typeof replyPayloadSdk.sendPayloadMediaSequenceOrFallback).toBe("function"); + expect(typeof replyPayloadSdk.sendTextMediaPayload).toBe("function"); expect(typeof replyPayloadSdk.sendPayloadWithChunkedTextAndMedia).toBe("function"); }); + it("exports media runtime helpers from the dedicated subpath", () => { + expect(typeof mediaRuntimeSdk.createDirectTextMediaOutbound).toBe("function"); + expect(typeof mediaRuntimeSdk.createScopedChannelMediaMaxBytesResolver).toBe("function"); + }); + + it("exports reply history helpers from the dedicated subpath", () => { + expect(typeof replyHistorySdk.buildPendingHistoryContextFromMap).toBe("function"); + expect(typeof replyHistorySdk.clearHistoryEntriesIfEnabled).toBe("function"); + expect(typeof replyHistorySdk.recordPendingHistoryEntryIfEnabled).toBe("function"); + expect("buildPendingHistoryContextFromMap" in asExports(replyRuntimeSdk)).toBe(false); + expect("clearHistoryEntriesIfEnabled" in asExports(replyRuntimeSdk)).toBe(false); + expect("recordPendingHistoryEntryIfEnabled" in asExports(replyRuntimeSdk)).toBe(false); + expect("DEFAULT_GROUP_HISTORY_LIMIT" in asExports(replyRuntimeSdk)).toBe(false); + }); + it("exports account helper builders from the dedicated subpath", () => { expect(typeof accountHelpersSdk.createAccountListHelpers).toBe("function"); }); @@ -113,19 +196,181 @@ describe("plugin-sdk subpath exports", () => { expect(typeof allowlistEditSdk.createNestedAllowlistOverrideResolver).toBe("function"); }); + it("exports allowlist resolution helpers from the dedicated subpath", () => { + expect(typeof allowFromSdk.addAllowlistUserEntriesFromConfigEntry).toBe("function"); + expect(typeof allowFromSdk.buildAllowlistResolutionSummary).toBe("function"); + expect(typeof allowFromSdk.canonicalizeAllowlistWithResolvedIds).toBe("function"); + expect(typeof allowFromSdk.mapAllowlistResolutionInputs).toBe("function"); + expect(typeof allowFromSdk.mergeAllowlist).toBe("function"); + expect(typeof allowFromSdk.patchAllowlistUsersInConfigEntries).toBe("function"); + expect(typeof allowFromSdk.summarizeMapping).toBe("function"); + }); + + it("exports allow-from matching helpers from the dedicated subpath", () => { + expect(typeof allowFromSdk.compileAllowlist).toBe("function"); + expect(typeof allowFromSdk.firstDefined).toBe("function"); + expect(typeof allowFromSdk.formatAllowlistMatchMeta).toBe("function"); + expect(typeof allowFromSdk.isSenderIdAllowed).toBe("function"); + expect(typeof allowFromSdk.mergeDmAllowFromSources).toBe("function"); + expect(typeof allowFromSdk.resolveAllowlistMatchSimple).toBe("function"); + }); + it("exports runtime helpers from the dedicated subpath", () => { expect(typeof runtimeSdk.createLoggerBackedRuntime).toBe("function"); }); + it("exports channel identity and session helpers from stronger existing homes", () => { + expect(typeof routingSdk.normalizeMessageChannel).toBe("function"); + expect(typeof routingSdk.resolveGatewayMessageChannel).toBe("function"); + expect(typeof conversationRuntimeSdk.recordInboundSession).toBe("function"); + expect(typeof conversationRuntimeSdk.recordInboundSessionMetaSafe).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveConversationLabel).toBe("function"); + }); + it("exports directory runtime helpers from the dedicated subpath", () => { + expect(typeof directoryRuntimeSdk.createChannelDirectoryAdapter).toBe("function"); + expect(typeof directoryRuntimeSdk.createRuntimeDirectoryLiveAdapter).toBe("function"); expect(typeof directoryRuntimeSdk.listDirectoryEntriesFromSources).toBe("function"); expect(typeof directoryRuntimeSdk.listResolvedDirectoryEntriesFromSources).toBe("function"); }); + it("exports infra runtime helpers from the dedicated subpath", () => { + expect(typeof infraRuntimeSdk.createRuntimeOutboundDelegates).toBe("function"); + expect(typeof infraRuntimeSdk.resolveOutboundSendDep).toBe("function"); + }); + it("exports channel runtime helpers from the dedicated subpath", () => { - expect(typeof channelRuntimeSdk.createChannelDirectoryAdapter).toBe("function"); - expect(typeof channelRuntimeSdk.createRuntimeOutboundDelegates).toBe("function"); - expect(typeof channelRuntimeSdk.sendPayloadMediaSequenceOrFallback).toBe("function"); + expect("applyChannelMatchMeta" in asExports(channelRuntimeSdk)).toBe(false); + expect("createChannelDirectoryAdapter" in asExports(channelRuntimeSdk)).toBe(false); + expect("createEmptyChannelDirectoryAdapter" in asExports(channelRuntimeSdk)).toBe(false); + expect("createArmableStallWatchdog" in asExports(channelRuntimeSdk)).toBe(false); + expect("createDraftStreamLoop" in asExports(channelRuntimeSdk)).toBe(false); + expect("createLoggedPairingApprovalNotifier" in asExports(channelRuntimeSdk)).toBe(false); + expect("createPairingPrefixStripper" in asExports(channelRuntimeSdk)).toBe(false); + expect("createRunStateMachine" in asExports(channelRuntimeSdk)).toBe(false); + expect("createRuntimeDirectoryLiveAdapter" in asExports(channelRuntimeSdk)).toBe(false); + expect("createRuntimeOutboundDelegates" in asExports(channelRuntimeSdk)).toBe(false); + expect("createStatusReactionController" in asExports(channelRuntimeSdk)).toBe(false); + expect("createTextPairingAdapter" in asExports(channelRuntimeSdk)).toBe(false); + expect("createFinalizableDraftLifecycle" in asExports(channelRuntimeSdk)).toBe(false); + expect("DEFAULT_EMOJIS" in asExports(channelRuntimeSdk)).toBe(false); + expect("logAckFailure" in asExports(channelRuntimeSdk)).toBe(false); + expect("logTypingFailure" in asExports(channelRuntimeSdk)).toBe(false); + expect("logInboundDrop" in asExports(channelRuntimeSdk)).toBe(false); + expect("normalizeMessageChannel" in asExports(channelRuntimeSdk)).toBe(false); + expect("removeAckReactionAfterReply" in asExports(channelRuntimeSdk)).toBe(false); + expect("recordInboundSession" in asExports(channelRuntimeSdk)).toBe(false); + expect("recordInboundSessionMetaSafe" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveInboundSessionEnvelopeContext" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveMentionGating" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveMentionGatingWithBypass" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveOutboundSendDep" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveConversationLabel" in asExports(channelRuntimeSdk)).toBe(false); + expect("shouldDebounceTextInbound" in asExports(channelRuntimeSdk)).toBe(false); + expect("shouldAckReaction" in asExports(channelRuntimeSdk)).toBe(false); + expect("shouldAckReactionForWhatsApp" in asExports(channelRuntimeSdk)).toBe(false); + expect("toLocationContext" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingConversationIdFromBindingId" in asExports(channelRuntimeSdk)).toBe( + false, + ); + expect("resolveThreadBindingEffectiveExpiresAt" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingFarewellText" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingIdleTimeoutMs" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingIdleTimeoutMsForChannel" in asExports(channelRuntimeSdk)).toBe( + false, + ); + expect("resolveThreadBindingIntroText" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingLifecycle" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingMaxAgeMs" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingMaxAgeMsForChannel" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingSpawnPolicy" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingThreadName" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveThreadBindingsEnabled" in asExports(channelRuntimeSdk)).toBe(false); + expect("formatThreadBindingDisabledError" in asExports(channelRuntimeSdk)).toBe(false); + expect("DISCORD_THREAD_BINDING_CHANNEL" in asExports(channelRuntimeSdk)).toBe(false); + expect("MATRIX_THREAD_BINDING_CHANNEL" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveControlCommandGate" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveCommandAuthorizedFromAuthorizers" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveDualTextControlCommandGate" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveNativeCommandSessionTargets" in asExports(channelRuntimeSdk)).toBe(false); + expect("attachChannelToResult" in asExports(channelRuntimeSdk)).toBe(false); + expect("buildComputedAccountStatusSnapshot" in asExports(channelRuntimeSdk)).toBe(false); + expect("buildMediaPayload" in asExports(channelRuntimeSdk)).toBe(false); + expect("createActionGate" in asExports(channelRuntimeSdk)).toBe(false); + expect("jsonResult" in asExports(channelRuntimeSdk)).toBe(false); + expect("normalizeInteractiveReply" in asExports(channelRuntimeSdk)).toBe(false); + expect("PAIRING_APPROVED_MESSAGE" in asExports(channelRuntimeSdk)).toBe(false); + expect("projectCredentialSnapshotFields" in asExports(channelRuntimeSdk)).toBe(false); + expect("readStringParam" in asExports(channelRuntimeSdk)).toBe(false); + expect("compileAllowlist" in asExports(channelRuntimeSdk)).toBe(false); + expect("formatAllowlistMatchMeta" in asExports(channelRuntimeSdk)).toBe(false); + expect("firstDefined" in asExports(channelRuntimeSdk)).toBe(false); + expect("isSenderIdAllowed" in asExports(channelRuntimeSdk)).toBe(false); + expect("mergeDmAllowFromSources" in asExports(channelRuntimeSdk)).toBe(false); + expect("addAllowlistUserEntriesFromConfigEntry" in asExports(channelRuntimeSdk)).toBe(false); + expect("buildAllowlistResolutionSummary" in asExports(channelRuntimeSdk)).toBe(false); + expect("canonicalizeAllowlistWithResolvedIds" in asExports(channelRuntimeSdk)).toBe(false); + expect("mergeAllowlist" in asExports(channelRuntimeSdk)).toBe(false); + expect("patchAllowlistUsersInConfigEntries" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveChannelConfigWrites" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolvePayloadMediaUrls" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveScopedChannelMediaMaxBytes" in asExports(channelRuntimeSdk)).toBe(false); + expect("sendPayloadMediaSequenceAndFinalize" in asExports(channelRuntimeSdk)).toBe(false); + expect("sendPayloadMediaSequenceOrFallback" in asExports(channelRuntimeSdk)).toBe(false); + expect("sendTextMediaPayload" in asExports(channelRuntimeSdk)).toBe(false); + expect("createScopedChannelMediaMaxBytesResolver" in asExports(channelRuntimeSdk)).toBe(false); + expect("runPassiveAccountLifecycle" in asExports(channelRuntimeSdk)).toBe(false); + expect("buildChannelKeyCandidates" in asExports(channelRuntimeSdk)).toBe(false); + expect("buildMessagingTarget" in asExports(channelRuntimeSdk)).toBe(false); + expect("createDirectTextMediaOutbound" in asExports(channelRuntimeSdk)).toBe(false); + expect("createMessageToolButtonsSchema" in asExports(channelRuntimeSdk)).toBe(false); + expect("createMessageToolCardSchema" in asExports(channelRuntimeSdk)).toBe(false); + expect("createScopedAccountReplyToModeResolver" in asExports(channelRuntimeSdk)).toBe(false); + expect("createStaticReplyToModeResolver" in asExports(channelRuntimeSdk)).toBe(false); + expect("createTopLevelChannelReplyToModeResolver" in asExports(channelRuntimeSdk)).toBe(false); + expect("createUnionActionGate" in asExports(channelRuntimeSdk)).toBe(false); + expect("ensureTargetId" in asExports(channelRuntimeSdk)).toBe(false); + expect("listTokenSourcedAccounts" in asExports(channelRuntimeSdk)).toBe(false); + expect("parseMentionPrefixOrAtUserTarget" in asExports(channelRuntimeSdk)).toBe(false); + expect("requireTargetKind" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveChannelEntryMatchWithFallback" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveChannelMatchConfig" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveReactionMessageId" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveTargetsWithOptionalToken" in asExports(channelRuntimeSdk)).toBe(false); + expect("appendMatchMetadata" in asExports(channelRuntimeSdk)).toBe(false); + expect("asString" in asExports(channelRuntimeSdk)).toBe(false); + expect("collectIssuesForEnabledAccounts" in asExports(channelRuntimeSdk)).toBe(false); + expect("isRecord" in asExports(channelRuntimeSdk)).toBe(false); + expect("resolveEnabledConfiguredAccountId" in asExports(channelRuntimeSdk)).toBe(false); + }); + + it("exports inbound channel helpers from the dedicated subpath", () => { + expect(typeof channelInboundSdk.buildMentionRegexes).toBe("function"); + expect(typeof channelInboundSdk.createChannelInboundDebouncer).toBe("function"); + expect(typeof channelInboundSdk.createInboundDebouncer).toBe("function"); + expect(typeof channelInboundSdk.formatInboundEnvelope).toBe("function"); + expect(typeof channelInboundSdk.formatInboundFromLabel).toBe("function"); + expect(typeof channelInboundSdk.formatLocationText).toBe("function"); + expect(typeof channelInboundSdk.logInboundDrop).toBe("function"); + expect(typeof channelInboundSdk.matchesMentionPatterns).toBe("function"); + expect(typeof channelInboundSdk.matchesMentionWithExplicit).toBe("function"); + expect(typeof channelInboundSdk.normalizeMentionText).toBe("function"); + expect(typeof channelInboundSdk.resolveInboundDebounceMs).toBe("function"); + expect(typeof channelInboundSdk.resolveEnvelopeFormatOptions).toBe("function"); + expect(typeof channelInboundSdk.resolveInboundSessionEnvelopeContext).toBe("function"); + expect(typeof channelInboundSdk.resolveMentionGating).toBe("function"); + expect(typeof channelInboundSdk.resolveMentionGatingWithBypass).toBe("function"); + expect(typeof channelInboundSdk.shouldDebounceTextInbound).toBe("function"); + expect(typeof channelInboundSdk.toLocationContext).toBe("function"); + expect("buildMentionRegexes" in asExports(replyRuntimeSdk)).toBe(false); + expect("createInboundDebouncer" in asExports(replyRuntimeSdk)).toBe(false); + expect("formatInboundEnvelope" in asExports(replyRuntimeSdk)).toBe(false); + expect("formatInboundFromLabel" in asExports(replyRuntimeSdk)).toBe(false); + expect("matchesMentionPatterns" in asExports(replyRuntimeSdk)).toBe(false); + expect("matchesMentionWithExplicit" in asExports(replyRuntimeSdk)).toBe(false); + expect("normalizeMentionText" in asExports(replyRuntimeSdk)).toBe(false); + expect("resolveEnvelopeFormatOptions" in asExports(replyRuntimeSdk)).toBe(false); + expect("resolveInboundDebounceMs" in asExports(replyRuntimeSdk)).toBe(false); }); it("exports channel setup helpers from the dedicated subpath", () => { @@ -133,9 +378,83 @@ describe("plugin-sdk subpath exports", () => { expect(typeof channelSetupSdk.createTopLevelChannelDmPolicy).toBe("function"); }); + it("exports channel action helpers from the dedicated subpath", () => { + expect(typeof channelActionsSdk.createUnionActionGate).toBe("function"); + expect(typeof channelActionsSdk.listTokenSourcedAccounts).toBe("function"); + expect(typeof channelActionsSdk.resolveReactionMessageId).toBe("function"); + }); + + it("exports channel target helpers from the dedicated subpath", () => { + expect(typeof channelTargetsSdk.applyChannelMatchMeta).toBe("function"); + expect(typeof channelTargetsSdk.buildChannelKeyCandidates).toBe("function"); + expect(typeof channelTargetsSdk.buildMessagingTarget).toBe("function"); + expect(typeof channelTargetsSdk.ensureTargetId).toBe("function"); + expect(typeof channelTargetsSdk.parseMentionPrefixOrAtUserTarget).toBe("function"); + expect(typeof channelTargetsSdk.requireTargetKind).toBe("function"); + expect(typeof channelTargetsSdk.resolveChannelEntryMatchWithFallback).toBe("function"); + expect(typeof channelTargetsSdk.resolveChannelMatchConfig).toBe("function"); + expect(typeof channelTargetsSdk.resolveTargetsWithOptionalToken).toBe("function"); + }); + + it("exports channel config write helpers from the dedicated subpath", () => { + expect(typeof channelConfigHelpersSdk.authorizeConfigWrite).toBe("function"); + expect(typeof channelConfigHelpersSdk.canBypassConfigWritePolicy).toBe("function"); + expect(typeof channelConfigHelpersSdk.formatConfigWriteDeniedMessage).toBe("function"); + expect(typeof channelConfigHelpersSdk.resolveChannelConfigWrites).toBe("function"); + }); + + it("keeps channel contract types on the dedicated subpath", () => { + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + expectTypeOf().toMatchTypeOf(); + }); + + it("exports channel lifecycle helpers from the dedicated subpath", () => { + expect(typeof channelLifecycleSdk.createDraftStreamLoop).toBe("function"); + expect(typeof channelLifecycleSdk.createFinalizableDraftLifecycle).toBe("function"); + expect(typeof channelLifecycleSdk.runPassiveAccountLifecycle).toBe("function"); + expect(typeof channelLifecycleSdk.createRunStateMachine).toBe("function"); + expect(typeof channelLifecycleSdk.createArmableStallWatchdog).toBe("function"); + }); + + it("exports channel feedback helpers from the dedicated subpath", () => { + expect(typeof channelFeedbackSdk.createStatusReactionController).toBe("function"); + expect(typeof channelFeedbackSdk.logAckFailure).toBe("function"); + expect(typeof channelFeedbackSdk.logTypingFailure).toBe("function"); + expect(typeof channelFeedbackSdk.removeAckReactionAfterReply).toBe("function"); + expect(typeof channelFeedbackSdk.shouldAckReaction).toBe("function"); + expect(typeof channelFeedbackSdk.shouldAckReactionForWhatsApp).toBe("function"); + expect(typeof channelFeedbackSdk.DEFAULT_EMOJIS).toBe("object"); + }); + + it("exports status helper utilities from the dedicated subpath", () => { + expect(typeof statusHelpersSdk.appendMatchMetadata).toBe("function"); + expect(typeof statusHelpersSdk.asString).toBe("function"); + expect(typeof statusHelpersSdk.collectIssuesForEnabledAccounts).toBe("function"); + expect(typeof statusHelpersSdk.isRecord).toBe("function"); + expect(typeof statusHelpersSdk.resolveEnabledConfiguredAccountId).toBe("function"); + }); + + it("exports message tool schema helpers from the dedicated subpath", () => { + expect(typeof channelActionsSdk.createMessageToolButtonsSchema).toBe("function"); + expect(typeof channelActionsSdk.createMessageToolCardSchema).toBe("function"); + }); + it("exports channel pairing helpers from the dedicated subpath", () => { expect(typeof channelPairingSdk.createChannelPairingController).toBe("function"); expect(typeof channelPairingSdk.createChannelPairingChallengeIssuer).toBe("function"); + expect(typeof channelPairingSdk.createLoggedPairingApprovalNotifier).toBe("function"); + expect(typeof channelPairingSdk.createPairingPrefixStripper).toBe("function"); + expect(typeof channelPairingSdk.createTextPairingAdapter).toBe("function"); expect("createScopedPairingAccess" in asExports(channelPairingSdk)).toBe(false); }); @@ -146,22 +465,76 @@ describe("plugin-sdk subpath exports", () => { expect("createReplyPrefixOptions" in asExports(channelReplyPipelineSdk)).toBe(false); }); + it("exports command auth helpers from the dedicated subpath", () => { + expect(typeof commandAuthSdk.buildCommandTextFromArgs).toBe("function"); + expect(typeof commandAuthSdk.buildCommandsPaginationKeyboard).toBe("function"); + expect(typeof commandAuthSdk.buildModelsProviderData).toBe("function"); + expect(typeof commandAuthSdk.hasControlCommand).toBe("function"); + expect(typeof commandAuthSdk.listNativeCommandSpecsForConfig).toBe("function"); + expect(typeof commandAuthSdk.listSkillCommandsForAgents).toBe("function"); + expect(typeof commandAuthSdk.normalizeCommandBody).toBe("function"); + expect(typeof commandAuthSdk.resolveCommandAuthorization).toBe("function"); + expect(typeof commandAuthSdk.resolveCommandAuthorizedFromAuthorizers).toBe("function"); + expect(typeof commandAuthSdk.resolveControlCommandGate).toBe("function"); + expect(typeof commandAuthSdk.resolveDualTextControlCommandGate).toBe("function"); + expect(typeof commandAuthSdk.resolveNativeCommandSessionTargets).toBe("function"); + expect(typeof commandAuthSdk.resolveStoredModelOverride).toBe("function"); + expect(typeof commandAuthSdk.shouldComputeCommandAuthorized).toBe("function"); + expect(typeof commandAuthSdk.shouldHandleTextCommands).toBe("function"); + expect("hasControlCommand" in asExports(replyRuntimeSdk)).toBe(false); + expect("buildCommandTextFromArgs" in asExports(replyRuntimeSdk)).toBe(false); + expect("buildCommandsPaginationKeyboard" in asExports(replyRuntimeSdk)).toBe(false); + expect("buildModelsProviderData" in asExports(replyRuntimeSdk)).toBe(false); + expect("listNativeCommandSpecsForConfig" in asExports(replyRuntimeSdk)).toBe(false); + expect("listSkillCommandsForAgents" in asExports(replyRuntimeSdk)).toBe(false); + expect("normalizeCommandBody" in asExports(replyRuntimeSdk)).toBe(false); + expect("resolveCommandAuthorization" in asExports(replyRuntimeSdk)).toBe(false); + expect("resolveStoredModelOverride" in asExports(replyRuntimeSdk)).toBe(false); + expect("shouldComputeCommandAuthorized" in asExports(replyRuntimeSdk)).toBe(false); + expect("shouldHandleTextCommands" in asExports(replyRuntimeSdk)).toBe(false); + }); + it("exports channel send-result helpers from the dedicated subpath", () => { expect(typeof channelSendResultSdk.attachChannelToResult).toBe("function"); expect(typeof channelSendResultSdk.buildChannelSendResult).toBe("function"); }); + it("exports binding lifecycle helpers from the conversation-runtime subpath", () => { + expect(typeof conversationRuntimeSdk.DISCORD_THREAD_BINDING_CHANNEL).toBe("string"); + expect(typeof conversationRuntimeSdk.MATRIX_THREAD_BINDING_CHANNEL).toBe("string"); + expect(typeof conversationRuntimeSdk.formatThreadBindingDisabledError).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingFarewellText).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingConversationIdFromBindingId).toBe( + "function", + ); + expect(typeof conversationRuntimeSdk.resolveThreadBindingEffectiveExpiresAt).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingIdleTimeoutMs).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingIdleTimeoutMsForChannel).toBe( + "function", + ); + expect(typeof conversationRuntimeSdk.resolveThreadBindingIntroText).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingLifecycle).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingMaxAgeMs).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingMaxAgeMsForChannel).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingSpawnPolicy).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingThreadName).toBe("function"); + expect(typeof conversationRuntimeSdk.resolveThreadBindingsEnabled).toBe("function"); + expect(typeof conversationRuntimeSdk.formatThreadBindingDurationLabel).toBe("function"); + expect(typeof conversationRuntimeSdk.createScopedAccountReplyToModeResolver).toBe("function"); + expect(typeof conversationRuntimeSdk.createStaticReplyToModeResolver).toBe("function"); + expect(typeof conversationRuntimeSdk.createTopLevelChannelReplyToModeResolver).toBe("function"); + }); + it("exports provider setup helpers from the dedicated subpath", () => { expect(typeof providerSetupSdk.buildVllmProvider).toBe("function"); expect(typeof providerSetupSdk.discoverOpenAICompatibleSelfHostedProvider).toBe("function"); }); - it("exports oauth helpers from the dedicated provider oauth subpath", () => { - expect(typeof providerOauthSdk.buildOauthProviderAuthResult).toBe("function"); - expect(typeof providerOauthSdk.generatePkceVerifierChallenge).toBe("function"); - expect(typeof providerOauthSdk.toFormUrlEncoded).toBe("function"); + it("exports oauth helpers from provider-auth", () => { + expect(typeof providerAuthSdk.buildOauthProviderAuthResult).toBe("function"); + expect(typeof providerAuthSdk.generatePkceVerifierChallenge).toBe("function"); + expect(typeof providerAuthSdk.toFormUrlEncoded).toBe("function"); expect("buildOauthProviderAuthResult" in asExports(coreSdk)).toBe(false); - expect("buildOauthProviderAuthResult" in asExports(providerAuthSdk)).toBe(false); }); it("keeps provider models focused on shared provider primitives", () => { @@ -209,6 +582,9 @@ describe("plugin-sdk subpath exports", () => { expect(typeof secretInputSdk.buildSecretInputSchema).toBe("function"); expect(typeof secretInputSdk.buildOptionalSecretInputSchema).toBe("function"); expect(typeof secretInputSdk.normalizeSecretInputString).toBe("function"); + expect("hasConfiguredSecretInput" in asExports(configRuntimeSdk)).toBe(false); + expect("normalizeResolvedSecretInputString" in asExports(configRuntimeSdk)).toBe(false); + expect("normalizeSecretInputString" in asExports(configRuntimeSdk)).toBe(false); }); it("exports webhook ingress helpers from the dedicated subpath", () => { @@ -220,7 +596,7 @@ describe("plugin-sdk subpath exports", () => { expect(typeof webhookIngressSdk.withResolvedWebhookRequestPipeline).toBe("function"); }); - it("exports shared core types used by bundled channels", () => { + it("exports shared core types used by bundled extensions", () => { expectTypeOf().toMatchTypeOf(); expectTypeOf().toMatchTypeOf(); expectTypeOf().toMatchTypeOf(); @@ -237,62 +613,6 @@ describe("plugin-sdk subpath exports", () => { expectTypeOf().toMatchTypeOf(); }); - it("exports Discord helpers", () => { - expect(typeof discordSdk.buildChannelConfigSchema).toBe("function"); - expect(typeof discordSdk.DiscordConfigSchema).toBe("object"); - expect(typeof discordSdk.projectCredentialSnapshotFields).toBe("function"); - expect("resolveDiscordAccount" in asExports(discordSdk)).toBe(false); - }); - - it("exports Slack helpers", () => { - expect(typeof slackSdk.buildChannelConfigSchema).toBe("function"); - expect(typeof slackSdk.SlackConfigSchema).toBe("object"); - expect(typeof slackSdk.looksLikeSlackTargetId).toBe("function"); - expect("resolveSlackAccount" in asExports(slackSdk)).toBe(false); - }); - - it("exports Telegram helpers", () => { - expect(typeof telegramSdk.buildChannelConfigSchema).toBe("function"); - expect(typeof telegramSdk.TelegramConfigSchema).toBe("object"); - expect(typeof telegramSdk.projectCredentialSnapshotFields).toBe("function"); - expect("resolveTelegramAccount" in asExports(telegramSdk)).toBe(false); - }); - - it("exports iMessage helpers", () => { - expect(typeof imessageSdk.IMessageConfigSchema).toBe("object"); - expect(typeof imessageSdk.resolveIMessageConfigAllowFrom).toBe("function"); - expect(typeof imessageSdk.looksLikeIMessageTargetId).toBe("function"); - expect("resolveIMessageAccount" in asExports(imessageSdk)).toBe(false); - }); - - it("exports iMessage core helpers", () => { - expect(typeof imessageCoreSdk.buildChannelConfigSchema).toBe("function"); - expect(typeof imessageCoreSdk.parseChatTargetPrefixesOrThrow).toBe("function"); - expect(typeof imessageCoreSdk.resolveServicePrefixedTarget).toBe("function"); - expect(typeof imessageCoreSdk.IMessageConfigSchema).toBe("object"); - }); - - it("exports WhatsApp helpers", () => { - expect(typeof whatsappSdk.WhatsAppConfigSchema).toBe("object"); - expect(typeof whatsappSdk.resolveWhatsAppOutboundTarget).toBe("function"); - expect(typeof whatsappSdk.resolveWhatsAppMentionStripRegexes).toBe("function"); - expect(typeof whatsappSdk.sendMessageWhatsApp).toBe("function"); - expect(typeof whatsappSdk.loadWebMedia).toBe("function"); - }); - - it("exports WhatsApp QR login helpers from the dedicated subpath", () => { - expect(typeof whatsappLoginQrSdk.startWebLoginWithQr).toBe("function"); - expect(typeof whatsappLoginQrSdk.waitForWebLogin).toBe("function"); - }); - - it("exports WhatsApp action runtime helpers from the dedicated subpath", () => { - expect(typeof whatsappActionRuntimeSdk.handleWhatsAppAction).toBe("function"); - }); - - it("keeps the remaining bundled helper surface narrow", () => { - expect(typeof bluebubblesSdk.parseFiniteNumber).toBe("function"); - }); - it("resolves every curated public subpath", async () => { for (const { id, load } of bundledExtensionSubpathLoaders) { const mod = await load(); diff --git a/src/plugin-sdk/tool-send.ts b/src/plugin-sdk/tool-send.ts index 61ee56fa9ac..7bd3c91acc1 100644 --- a/src/plugin-sdk/tool-send.ts +++ b/src/plugin-sdk/tool-send.ts @@ -1,3 +1,5 @@ +export type { ChannelToolSend } from "../channels/plugins/types.js"; + /** Extract the canonical send target fields from tool arguments when the action matches. */ export function extractToolSend( args: Record, diff --git a/src/plugins/loader.git-path-regression.test.ts b/src/plugins/loader.git-path-regression.test.ts index fac5e22657c..6f74b508c3d 100644 --- a/src/plugins/loader.git-path-regression.test.ts +++ b/src/plugins/loader.git-path-regression.test.ts @@ -23,7 +23,7 @@ afterEach(() => { }); describe("plugin loader git path regression", () => { - it("loads git-style package extension entries when they import plugin-sdk channel-runtime (#49806)", async () => { + it("loads git-style package extension entries when they import plugin-sdk infra-runtime (#49806)", async () => { const copiedExtensionRoot = path.join(makeTempDir(), "extensions", "imessage"); const copiedSourceDir = path.join(copiedExtensionRoot, "src"); const copiedPluginSdkDir = path.join(copiedExtensionRoot, "plugin-sdk"); @@ -33,7 +33,7 @@ describe("plugin loader git path regression", () => { fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8"); fs.writeFileSync( path.join(copiedSourceDir, "channel.runtime.ts"), - `import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; + `import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; import { PAIRING_APPROVED_MESSAGE } from "../runtime-api.js"; export const copiedRuntimeMarker = { @@ -49,7 +49,7 @@ export const copiedRuntimeMarker = { `, "utf-8", ); - const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "channel-runtime.ts"); + const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts"); fs.writeFileSync( copiedChannelRuntimeShim, `export function resolveOutboundSendDep() { @@ -77,7 +77,7 @@ export const copiedRuntimeMarker = { tryNative: false, extensions: [".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".js", ".mjs", ".cjs", ".json"], alias: { - "openclaw/plugin-sdk/channel-runtime": ${JSON.stringify(copiedChannelRuntimeShim)}, + "openclaw/plugin-sdk/infra-runtime": ${JSON.stringify(copiedChannelRuntimeShim)}, }, }); const mod = withAlias(${JSON.stringify(copiedChannelRuntime)}); diff --git a/src/plugins/loader.test.ts b/src/plugins/loader.test.ts index 90e1ae452bc..8af6cf927d4 100644 --- a/src/plugins/loader.test.ts +++ b/src/plugins/loader.test.ts @@ -3683,7 +3683,7 @@ module.exports = { fs.writeFileSync(jitiBaseFile, "export {};\n", "utf-8"); fs.writeFileSync( path.join(copiedSourceDir, "channel.runtime.ts"), - `import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime"; + `import { resolveOutboundSendDep } from "openclaw/plugin-sdk/infra-runtime"; export const syntheticRuntimeMarker = { resolveOutboundSendDep, @@ -3691,7 +3691,7 @@ export const syntheticRuntimeMarker = { `, "utf-8", ); - const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "channel-runtime.ts"); + const copiedChannelRuntimeShim = path.join(copiedPluginSdkDir, "infra-runtime.ts"); fs.writeFileSync( copiedChannelRuntimeShim, `export function resolveOutboundSendDep() { @@ -3714,7 +3714,7 @@ export const syntheticRuntimeMarker = { const withAlias = createJiti(jitiBaseUrl, { ...__testing.buildPluginLoaderJitiOptions({ - "openclaw/plugin-sdk/channel-runtime": copiedChannelRuntimeShim, + "openclaw/plugin-sdk/infra-runtime": copiedChannelRuntimeShim, }), tryNative: false, }); diff --git a/src/plugins/runtime/runtime-discord-ops.runtime.ts b/src/plugins/runtime/runtime-discord-ops.runtime.ts index 02a4cc22eb0..3e96771094a 100644 --- a/src/plugins/runtime/runtime-discord-ops.runtime.ts +++ b/src/plugins/runtime/runtime-discord-ops.runtime.ts @@ -1,12 +1,12 @@ -import { auditDiscordChannelPermissions as auditDiscordChannelPermissionsImpl } from "openclaw/plugin-sdk/discord"; import { + auditDiscordChannelPermissions as auditDiscordChannelPermissionsImpl, listDiscordDirectoryGroupsLive as listDiscordDirectoryGroupsLiveImpl, listDiscordDirectoryPeersLive as listDiscordDirectoryPeersLiveImpl, -} from "openclaw/plugin-sdk/discord"; -import { monitorDiscordProvider as monitorDiscordProviderImpl } from "openclaw/plugin-sdk/discord"; -import { probeDiscord as probeDiscordImpl } from "openclaw/plugin-sdk/discord"; -import { resolveDiscordChannelAllowlist as resolveDiscordChannelAllowlistImpl } from "openclaw/plugin-sdk/discord"; -import { resolveDiscordUserAllowlist as resolveDiscordUserAllowlistImpl } from "openclaw/plugin-sdk/discord"; + monitorDiscordProvider as monitorDiscordProviderImpl, + probeDiscord as probeDiscordImpl, + resolveDiscordChannelAllowlist as resolveDiscordChannelAllowlistImpl, + resolveDiscordUserAllowlist as resolveDiscordUserAllowlistImpl, +} from "../../../extensions/discord/runtime-api.js"; import { createThreadDiscord as createThreadDiscordImpl, deleteMessageDiscord as deleteMessageDiscordImpl, @@ -18,7 +18,7 @@ import { sendPollDiscord as sendPollDiscordImpl, sendTypingDiscord as sendTypingDiscordImpl, unpinMessageDiscord as unpinMessageDiscordImpl, -} from "openclaw/plugin-sdk/discord"; +} from "../../../extensions/discord/runtime-api.js"; import type { PluginRuntimeChannel } from "./types-channel.js"; type RuntimeDiscordOps = Pick< diff --git a/src/plugins/runtime/runtime-discord.ts b/src/plugins/runtime/runtime-discord.ts index 354d205a66d..27535bf602c 100644 --- a/src/plugins/runtime/runtime-discord.ts +++ b/src/plugins/runtime/runtime-discord.ts @@ -1,5 +1,5 @@ -import { discordMessageActions } from "openclaw/plugin-sdk/discord"; import { + discordMessageActions, getThreadBindingManager, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, @@ -8,7 +8,7 @@ import { setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, unbindThreadBindingsBySessionKey, -} from "openclaw/plugin-sdk/discord"; +} from "../../../extensions/discord/runtime-api.js"; import { createLazyRuntimeMethodBinder, createLazyRuntimeSurface, diff --git a/src/plugins/runtime/runtime-imessage.ts b/src/plugins/runtime/runtime-imessage.ts index 7740b6bdfa3..56136197626 100644 --- a/src/plugins/runtime/runtime-imessage.ts +++ b/src/plugins/runtime/runtime-imessage.ts @@ -2,7 +2,7 @@ import { monitorIMessageProvider, probeIMessage, sendMessageIMessage, -} from "openclaw/plugin-sdk/imessage"; +} from "../../../extensions/imessage/runtime-api.js"; import type { PluginRuntimeChannel } from "./types-channel.js"; export function createRuntimeIMessage(): PluginRuntimeChannel["imessage"] { diff --git a/src/plugins/runtime/runtime-matrix.ts b/src/plugins/runtime/runtime-matrix.ts index d97734397c0..abcb0cdf375 100644 --- a/src/plugins/runtime/runtime-matrix.ts +++ b/src/plugins/runtime/runtime-matrix.ts @@ -1,7 +1,7 @@ import { setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey, -} from "openclaw/plugin-sdk/matrix"; +} from "../../../extensions/matrix/runtime-api.js"; import type { PluginRuntimeChannel } from "./types-channel.js"; export function createRuntimeMatrix(): PluginRuntimeChannel["matrix"] { diff --git a/src/plugins/runtime/runtime-slack-ops.runtime.ts b/src/plugins/runtime/runtime-slack-ops.runtime.ts index 89411fafc00..ec534c0b224 100644 --- a/src/plugins/runtime/runtime-slack-ops.runtime.ts +++ b/src/plugins/runtime/runtime-slack-ops.runtime.ts @@ -1,13 +1,13 @@ import { listSlackDirectoryGroupsLive as listSlackDirectoryGroupsLiveImpl, listSlackDirectoryPeersLive as listSlackDirectoryPeersLiveImpl, -} from "openclaw/plugin-sdk/slack"; -import { monitorSlackProvider as monitorSlackProviderImpl } from "openclaw/plugin-sdk/slack"; -import { probeSlack as probeSlackImpl } from "openclaw/plugin-sdk/slack"; -import { resolveSlackChannelAllowlist as resolveSlackChannelAllowlistImpl } from "openclaw/plugin-sdk/slack"; -import { resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl } from "openclaw/plugin-sdk/slack"; -import { sendMessageSlack as sendMessageSlackImpl } from "openclaw/plugin-sdk/slack"; -import { handleSlackAction as handleSlackActionImpl } from "openclaw/plugin-sdk/slack"; + monitorSlackProvider as monitorSlackProviderImpl, + probeSlack as probeSlackImpl, + resolveSlackChannelAllowlist as resolveSlackChannelAllowlistImpl, + resolveSlackUserAllowlist as resolveSlackUserAllowlistImpl, + sendMessageSlack as sendMessageSlackImpl, + handleSlackAction as handleSlackActionImpl, +} from "../../../extensions/slack/runtime-api.js"; import type { PluginRuntimeChannel } from "./types-channel.js"; type RuntimeSlackOps = Pick< diff --git a/src/plugins/runtime/runtime-telegram-ops.runtime.ts b/src/plugins/runtime/runtime-telegram-ops.runtime.ts index 5b49e854651..8f236d5e2b6 100644 --- a/src/plugins/runtime/runtime-telegram-ops.runtime.ts +++ b/src/plugins/runtime/runtime-telegram-ops.runtime.ts @@ -1,6 +1,8 @@ -import { auditTelegramGroupMembership as auditTelegramGroupMembershipImpl } from "openclaw/plugin-sdk/telegram"; -import { monitorTelegramProvider as monitorTelegramProviderImpl } from "openclaw/plugin-sdk/telegram"; -import { probeTelegram as probeTelegramImpl } from "openclaw/plugin-sdk/telegram"; +import { + auditTelegramGroupMembership as auditTelegramGroupMembershipImpl, + monitorTelegramProvider as monitorTelegramProviderImpl, + probeTelegram as probeTelegramImpl, +} from "../../../extensions/telegram/runtime-api.js"; import { deleteMessageTelegram as deleteMessageTelegramImpl, editMessageReplyMarkupTelegram as editMessageReplyMarkupTelegramImpl, @@ -11,7 +13,7 @@ import { sendPollTelegram as sendPollTelegramImpl, sendTypingTelegram as sendTypingTelegramImpl, unpinMessageTelegram as unpinMessageTelegramImpl, -} from "openclaw/plugin-sdk/telegram"; +} from "../../../extensions/telegram/runtime-api.js"; import type { PluginRuntimeChannel } from "./types-channel.js"; type RuntimeTelegramOps = Pick< diff --git a/src/plugins/runtime/runtime-telegram.ts b/src/plugins/runtime/runtime-telegram.ts index fd01f964f2a..5754066cd8a 100644 --- a/src/plugins/runtime/runtime-telegram.ts +++ b/src/plugins/runtime/runtime-telegram.ts @@ -1,10 +1,10 @@ -import { collectTelegramUnmentionedGroupIds } from "openclaw/plugin-sdk/telegram"; -import { telegramMessageActions } from "openclaw/plugin-sdk/telegram"; import { + collectTelegramUnmentionedGroupIds, + resolveTelegramToken, setTelegramThreadBindingIdleTimeoutBySessionKey, setTelegramThreadBindingMaxAgeBySessionKey, -} from "openclaw/plugin-sdk/telegram"; -import { resolveTelegramToken } from "openclaw/plugin-sdk/telegram"; + telegramMessageActions, +} from "../../../extensions/telegram/runtime-api.js"; import { createLazyRuntimeMethodBinder, createLazyRuntimeSurface, diff --git a/src/security/audit-channel.runtime.ts b/src/security/audit-channel.runtime.ts index e53c1c19391..d19be6bf441 100644 --- a/src/security/audit-channel.runtime.ts +++ b/src/security/audit-channel.runtime.ts @@ -1,7 +1,7 @@ import { isNumericTelegramUserId, normalizeTelegramAllowFromEntry, -} from "openclaw/plugin-sdk/telegram"; +} from "../../extensions/telegram/api.js"; import { readChannelAllowFromStore } from "../pairing/pairing-store.js"; import { isDiscordMutableAllowEntry, diff --git a/test/helpers/extensions/discord-provider.test-support.ts b/test/helpers/extensions/discord-provider.test-support.ts index 3c66b4d6743..538e00ae9fa 100644 --- a/test/helpers/extensions/discord-provider.test-support.ts +++ b/test/helpers/extensions/discord-provider.test-support.ts @@ -1,7 +1,7 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/discord"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import type { Mock } from "vitest"; import { expect, vi } from "vitest"; +import type { OpenClawConfig } from "../../../extensions/discord/src/runtime-api.js"; export type NativeCommandSpecMock = { name: string; @@ -319,6 +319,16 @@ vi.mock("openclaw/plugin-sdk/acp-runtime", async () => { }; }); +vi.mock("openclaw/plugin-sdk/command-auth", async () => { + const actual = await vi.importActual( + "openclaw/plugin-sdk/command-auth", + ); + return { + ...actual, + listNativeCommandSpecsForConfig: listNativeCommandSpecsForConfigMock, + listSkillCommandsForAgents: listSkillCommandsForAgentsMock, + }; +}); vi.mock("openclaw/plugin-sdk/reply-runtime", async () => { const actual = await vi.importActual( "openclaw/plugin-sdk/reply-runtime", @@ -326,8 +336,6 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", async () => { return { ...actual, resolveTextChunkLimit: () => 2000, - listNativeCommandSpecsForConfig: listNativeCommandSpecsForConfigMock, - listSkillCommandsForAgents: listSkillCommandsForAgentsMock, }; });