Skip to content

Commit 439c21e

Browse files
authored
refactor: remove channel shim directories, point all imports to extensions (#45967)
* refactor: remove channel shim directories, point all imports to extensions Delete the 6 backward-compat shim directories (src/telegram, src/discord, src/slack, src/signal, src/imessage, src/web) that were re-exporting from extensions. Update all 112+ source files to import directly from extensions/{channel}/src/ instead of through the shims. Also: - Move src/channels/telegram/ (allow-from, api) to extensions/telegram/src/ - Fix outbound adapters to use resolveOutboundSendDep (fixes 5 pre-existing TS errors) - Update cross-extension imports (src/web/media.js → extensions/whatsapp/src/media.js) - Update vitest, tsdown, knip, labeler, and script configs for new paths - Update guard test allowlists for extension paths After this, src/ has zero channel-specific implementation code — only the generic plugin framework remains. * fix: update raw-fetch guard allowlist line numbers after shim removal * refactor: document direct extension channel imports * test: mock transcript module in delivery helpers
1 parent 5682ec3 commit 439c21e

File tree

534 files changed

+524
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

534 files changed

+524
-1088
lines changed

.github/labeler.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"channel: discord":
77
- changed-files:
88
- any-glob-to-any-file:
9-
- "src/discord/**"
109
- "extensions/discord/**"
1110
- "docs/channels/discord.md"
1211
"channel: irc":
@@ -28,7 +27,6 @@
2827
"channel: imessage":
2928
- changed-files:
3029
- any-glob-to-any-file:
31-
- "src/imessage/**"
3230
- "extensions/imessage/**"
3331
- "docs/channels/imessage.md"
3432
"channel: line":
@@ -64,19 +62,16 @@
6462
"channel: signal":
6563
- changed-files:
6664
- any-glob-to-any-file:
67-
- "src/signal/**"
6865
- "extensions/signal/**"
6966
- "docs/channels/signal.md"
7067
"channel: slack":
7168
- changed-files:
7269
- any-glob-to-any-file:
73-
- "src/slack/**"
7470
- "extensions/slack/**"
7571
- "docs/channels/slack.md"
7672
"channel: telegram":
7773
- changed-files:
7874
- any-glob-to-any-file:
79-
- "src/telegram/**"
8075
- "extensions/telegram/**"
8176
- "docs/channels/telegram.md"
8277
"channel: tlon":
@@ -96,7 +91,6 @@
9691
"channel: whatsapp-web":
9792
- changed-files:
9893
- any-glob-to-any-file:
99-
- "src/web/**"
10094
- "extensions/whatsapp/**"
10195
- "docs/channels/whatsapp.md"
10296
"channel: zalo":

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Docs: https://docs.openclaw.ai
77
### Changes
88

99
- Placeholder: replace with the first 2026.3.14 user-facing change.
10+
- Refactor/channels: remove the legacy channel shim directories and point channel-specific imports directly at the extension-owned implementations. (#45967) thanks @scoootscooob.
1011

1112
## 2026.3.13
1213

extensions/discord/src/monitor/native-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import { executePluginCommand, matchPluginCommand } from "../../../../src/plugin
5555
import type { ResolvedAgentRoute } from "../../../../src/routing/resolve-route.js";
5656
import { chunkItems } from "../../../../src/utils/chunk-items.js";
5757
import { withTimeout } from "../../../../src/utils/with-timeout.js";
58-
import { loadWebMedia } from "../../../../src/web/media.js";
58+
import { loadWebMedia } from "../../../whatsapp/src/media.js";
5959
import { resolveDiscordMaxLinesPerMessage } from "../accounts.js";
6060
import { chunkDiscordTextWithMode } from "../chunk.js";
6161
import {

extensions/discord/src/outbound-adapter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { sendTextMediaPayload } from "../../../src/channels/plugins/outbound/direct-text-media.js";
22
import type { ChannelOutboundAdapter } from "../../../src/channels/plugins/types.js";
33
import type { OpenClawConfig } from "../../../src/config/config.js";
4+
import { resolveOutboundSendDep } from "../../../src/infra/outbound/deliver.js";
45
import type { OutboundIdentity } from "../../../src/infra/outbound/identity.js";
56
import { getThreadBindingManager, type ThreadBindingRecord } from "./monitor/thread-bindings.js";
67
import { normalizeDiscordOutboundTarget } from "./normalize.js";
@@ -93,7 +94,8 @@ export const discordOutbound: ChannelOutboundAdapter = {
9394
return { channel: "discord", ...webhookResult };
9495
}
9596
}
96-
const send = deps?.sendDiscord ?? sendMessageDiscord;
97+
const send =
98+
resolveOutboundSendDep<typeof sendMessageDiscord>(deps, "discord") ?? sendMessageDiscord;
9799
const target = resolveDiscordOutboundTarget({ to, threadId });
98100
const result = await send(target, text, {
99101
verbose: false,
@@ -116,7 +118,8 @@ export const discordOutbound: ChannelOutboundAdapter = {
116118
threadId,
117119
silent,
118120
}) => {
119-
const send = deps?.sendDiscord ?? sendMessageDiscord;
121+
const send =
122+
resolveOutboundSendDep<typeof sendMessageDiscord>(deps, "discord") ?? sendMessageDiscord;
120123
const target = resolveDiscordOutboundTarget({ to, threadId });
121124
const result = await send(target, text, {
122125
verbose: false,

extensions/discord/src/send.components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { ChannelType, Routes } from "discord-api-types/v10";
88
import { loadConfig, type OpenClawConfig } from "../../../src/config/config.js";
99
import { recordChannelActivity } from "../../../src/infra/channel-activity.js";
10-
import { loadWebMedia } from "../../../src/web/media.js";
10+
import { loadWebMedia } from "../../whatsapp/src/media.js";
1111
import { resolveDiscordAccount } from "./accounts.js";
1212
import { registerDiscordComponentEntries } from "./components-registry.js";
1313
import {

extensions/discord/src/send.emojis-stickers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Routes } from "discord-api-types/v10";
2-
import { loadWebMediaRaw } from "../../../src/web/media.js";
2+
import { loadWebMediaRaw } from "../../whatsapp/src/media.js";
33
import { normalizeEmojiName, resolveDiscordRest } from "./send.shared.js";
44
import type { DiscordEmojiUpload, DiscordReactOpts, DiscordStickerUpload } from "./send.types.js";
55
import { DISCORD_MAX_EMOJI_BYTES, DISCORD_MAX_STICKER_BYTES } from "./send.types.js";

extensions/discord/src/send.outbound.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { maxBytesForKind } from "../../../src/media/constants.js";
1414
import { extensionForMime } from "../../../src/media/mime.js";
1515
import { unlinkIfExists } from "../../../src/media/temp-files.js";
1616
import type { PollInput } from "../../../src/polls.js";
17-
import { loadWebMediaRaw } from "../../../src/web/media.js";
17+
import { loadWebMediaRaw } from "../../whatsapp/src/media.js";
1818
import { resolveDiscordAccount } from "./accounts.js";
1919
import { rewriteDiscordKnownMentions } from "./mentions.js";
2020
import {

extensions/discord/src/send.shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
normalizePollInput,
1919
type PollInput,
2020
} from "../../../src/polls.js";
21-
import { loadWebMedia } from "../../../src/web/media.js";
21+
import { loadWebMedia } from "../../whatsapp/src/media.js";
2222
import { resolveDiscordAccount } from "./accounts.js";
2323
import { chunkDiscordTextWithMode } from "./chunk.js";
2424
import { createDiscordClient, resolveDiscordRest } from "./client.js";

extensions/slack/src/send.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
fetchWithSsrFGuard,
1313
withTrustedEnvProxyGuardedFetchMode,
1414
} from "../../../src/infra/net/fetch-guard.js";
15-
import { loadWebMedia } from "../../../src/web/media.js";
15+
import { loadWebMedia } from "../../whatsapp/src/media.js";
1616
import type { SlackTokenSource } from "./accounts.js";
1717
import { resolveSlackAccount } from "./accounts.js";
1818
import { buildSlackBlocksFallbackText } from "./blocks-fallback.js";
File renamed without changes.

0 commit comments

Comments
 (0)