Channels
Channels are optional adapters for gateway, outbound, and configuration behavior.
ts
import {
createChannelRegistry,
registerChannel,
type ChannelPlugin,
} from "duclaw-cli/sdk/core";Register a Channel
ts
const channels = createChannelRegistry();
registerChannel(channels, {
id: "custom-channel",
meta: {
id: "custom-channel",
label: "Custom Channel",
blurb: "Receives and sends messages through a custom transport.",
},
config: {
resolveAccount(cfg) {
return cfg;
},
},
outbound: {
async sendText(ctx) {
await sendMessageToTransport(ctx.to, ctx.text);
},
},
gateway: {
async startAccount(ctx) {
await startTransportListener(ctx.accountId, ctx.abortSignal);
},
async stopAccount(ctx) {
await stopTransportListener(ctx.accountId);
},
},
});Pass a ChannelPlugin to AgentConfig.channelPlugin when a runtime needs channel-aware behavior.