Connector Framework and Supervisor
The core of the integration layer is managed by thepalyra-connectors and palyra-connector-core crates. Central to this is the ConnectorSupervisor, which manages the lifecycle of various ConnectorAdapter implementations crates/palyra-connector-core/src/supervisor.rs#194-199.
The supervisor handles:
- Persistence: Storing connector configurations and outbox messages in a SQLite-backed
ConnectorStorecrates/palyra-connector-core/src/supervisor.rs#195-195. - Reliability: Managing a “Dead Letter” system for messages that fail repeatedly crates/palyra-connector-core/src/supervisor.rs#62-62.
- Lifecycle: Starting, stopping, and monitoring the liveness of connectors like Discord or Echo crates/palyra-connector-core/src/supervisor.rs#115-115.
Echo connector used for testing, see Connector Framework and Supervisor.
Connector Architecture
The following diagram illustrates how theConnectorSupervisor bridges external platform events to the internal ChannelRouter.
Diagram: Connector to Router Flow
Sources: crates/palyra-connector-core/src/supervisor.rs#128-134, crates/palyra-daemon/src/channels.rs#125-132
Message Routing and Policies
Incoming messages are dispatched via theChannelRouter crates/palyra-daemon/src/channel_router.rs#161-192. This component is responsible for enforcing governance policies before a message ever reaches an LLM or Agent.
Key routing features include:
- Broadcast Strategies: Controlling whether an agent can respond to
@everyoneor@herecrates/palyra-daemon/src/channel_router.rs#28-32. - Direct Message (DM) Policies: Managing how agents interact in private conversations, including a “Pairing” system that requires manual approval for new users crates/palyra-daemon/src/channel_router.rs#57-61.
- Session Isolation: Ensuring that conversations from different users or channels remain cryptographically and logically separate crates/palyra-daemon/src/channel_router.rs#169-169.
| Policy | Role | Implementation |
|---|---|---|
DirectMessagePolicy | Controls DM access (Deny, Pairing, Allow) | crates/palyra-daemon/src/channel_router.rs#57-61 |
BroadcastStrategy | Controls mass mentions (@everyone) | crates/palyra-daemon/src/channel_router.rs#28-32 |
ChannelRoutingRule | Per-channel overrides for mentions/filters | crates/palyra-daemon/src/channel_router.rs#161-175 |
Discord Integration
The Discord integration is the most mature connector in Palyra, utilizing a dedicated adapter inpalyra-connector-discord. It supports real-time interaction via the Discord Gateway and complex permission management.
The daemon provides specialized handlers for onboarding Discord bots crates/palyra-daemon/src/transport/http/handlers/console/channels/connectors/discord.rs#126-129, verifying permissions, and managing account-specific token storage in the Vault crates/palyra-daemon/src/transport/http/handlers/console/channels/connectors/discord.rs#142-149.
For details on setting up Discord bots and permission normalization, see Discord Integration.
Sources: crates/palyra-daemon/src/transport/http/handlers/console/channels/connectors/discord.rs#1-165, crates/palyra-daemon/src/channels.rs#160-179
Webhook Ingestion
For platforms that do not use persistent connections (like Slack or GitHub), Palyra provides a robust Webhook system. TheWebhookRegistry manages integration secrets and configuration crates/palyra-daemon/src/webhooks.rs#107-111.
Security features for webhooks include:
- Signature Verification: Ensuring payloads come from trusted sources crates/palyra-daemon/src/webhooks.rs#41-41.
- Replay Protection: Preventing the same webhook from being processed multiple times crates/palyra-daemon/src/webhooks.rs#9-9.
- Payload Limits: Restricting the size of incoming JSON to prevent DoS crates/palyra-daemon/src/webhooks.rs#24-24.
webhooks command group for managing these integrations, including a test command to simulate incoming payloads crates/palyra-cli/src/commands/webhooks.rs#100-132.
For details on schema and verification, see Webhooks.
Sources: crates/palyra-daemon/src/webhooks.rs#1-175, crates/palyra-cli/src/commands/webhooks.rs#1-132