System Architecture
The connector subsystem is managed by theConnectorSupervisor, which orchestrates the lifecycle of multiple ConnectorAdapter implementations. It acts as the bridge between the internal GatewayRuntimeState and external APIs.
Interaction Flow: NL Space to Code Entities
The following diagram illustrates how a natural language message from a user (e.g., on Discord) flows into the system and how the system responds. Sources:- crates/palyra-connector-core/src/supervisor.rs#128-134 (
ConnectorRoutertrait) - crates/palyra-connector-core/src/supervisor.rs#137-174 (
ConnectorAdaptertrait) - crates/palyra-connector-core/src/supervisor.rs#194-214 (
ConnectorSupervisordefinition)
Connector Framework
The framework provides the core traits and data structures used by all integrations. It manages theConnectorStore (SQLite-backed persistence for connector state) and handles complex delivery logic like exponential backoff and dead-lettering.
| Component | Responsibility |
|---|---|
ConnectorAdapter | Trait for platform-specific logic (send/poll). |
ConnectorSupervisor | Manages adapter lifecycles and message queuing. |
OutboundMessageRequest | Standardized internal format for outgoing messages. |
DeliveryOutcome | Enum representing Delivered, Retry, or PermanentFailure. |
DeadLetterRecord | Stores messages that failed after maximum retries. |
- crates/palyra-connectors/src/lib.rs#2-12 (Crate exports)
- crates/palyra-connector-core/src/supervisor.rs#25-36 (
ConnectorSupervisorConfig)
Platform Integrations
Palyra supports multiple messaging platforms with varying levels of maturity. TheDiscordConnectorAdapter is the primary reference implementation, supporting rich features like attachment pre-processing and secure DM pairing.
Code Entity Mapping: Integration Components
This diagram maps system concepts to specific code entities within thepalyra-connectors and platform crates.
For details, see Discord and Other Platform Integrations.
Sources:
- crates/palyra-connectors/src/connectors/mod.rs#15-18 (
default_adaptersimplementation) - crates/palyra-connectors/src/connectors/echo.rs#21-24 (
EchoConnectorAdapter) - crates/palyra-connectors/src/connectors/slack.rs#10-13 (
SlackConnectorAdapter)
Webhooks
The Webhook subsystem allows external services to push events into Palyra. It includes aWebhookRegistry for managing endpoint configurations and security features like signature verification and replay protection.
- Registry Management: Handled via
WebhookRegistrywhich persists towebhooks.toml. - Diagnostics: The system provides snapshots via
WebhookDiagnosticsSnapshotto track the health of integrations. - Testing: A dedicated CLI and API surface allows for simulated payload testing.
- crates/palyra-daemon/src/webhooks.rs#107-111 (
WebhookRegistrystruct) - crates/palyra-daemon/src/webhooks.rs#52-72 (
WebhookIntegrationRecord) - crates/palyra-cli/src/commands/webhooks.rs#100-131 (
WebhooksCommand::Testimplementation)
Management and Monitoring
Connectors can be managed via the CLI or the Admin API. The system tracks saturation states (e.g.,rate_limited, backpressure, retrying) to provide operators with visibility into delivery health.
- crates/palyra-daemon/src/transport/http/handlers/admin/channels/mod.rs#29-53 (
build_channel_status_payload) - crates/palyra-cli/src/commands/channels/mod.rs#61-112 (
runcommand for channel lifecycle)