Add Channel
Scaffolds a new messaging channel under packages/channels/<name>/.
Steps
- •Ask for the channel name (e.g., "discord", "telegram", "slack")
- •Create the directory structure:
code
packages/channels/<name>/
package.json # @spaceduck/channel-<name>, depends on @spaceduck/core
src/
server.ts # channel server implementation
index.ts # barrel export
__tests__/
server.test.ts # integration tests
- •The channel must implement the
Channelinterface from@spaceduck/core:
typescript
import type { Channel, Lifecycle } from "@spaceduck/core";
export class <Name>Channel implements Channel, Lifecycle {
readonly name = "<name>";
readonly status: "stopped" | "starting" | "running" | "stopping" = "stopped";
async start(): Promise<void> { /* start listening for messages */ }
async stop(): Promise<void> { /* graceful shutdown */ }
// Channel-specific message handling
}
- •The channel receives messages from its platform and forwards them through the gateway's middleware pipeline
- •The channel receives responses from the agent and delivers them back to the user
- •Wire the channel in
@spaceduck/gatewayby adding it to the registry - •Write integration tests that spin up a real server instance