Files
archie/internal/channels/channel.go
T
sam 1ea15462c0
Quality / check (push) Successful in 4m56s
deploy / gate (push) Successful in 6m11s
deploy / archied-image (push) Successful in 2m56s
deploy / agent-image (push) Successful in 10s
deploy / dist-zip (push) Skipped
feat(messaging): run Telegram as an archipelago channel extension (#1399)
The bundled internal/channels/telegram package (17 files) is deleted; the
channel now ships as archipelago/channels/telegram, launched by archiemessaging
through the existing channel-extension machinery. An existing [chat.telegram]
config enables it with the same keys: the token stays a secret reference
(token_ref) the host resolves, allowed_user_ids and show_tool_calls map onto
extension settings. Per-org bots compose the same extension per org from the
org's credential binding. Reload support is now derived from a channels.Reloader
interface instead of a *telegram.Gateway assertion. The five host-only seams
(/update, release announcements, running versions, in-place show_tool_calls,
reload) are dropped from the channel and need a contract home or deletion.
2026-10-31 18:19:21 +11:00

51 lines
1.7 KiB
Go

// Package channels defines the interface every chat channel must satisfy
// to integrate with archie-core's messaging layer. Channels own their
// persistent connection lifecycle; the Gateway handles message dispatch.
package channels
import (
"context"
"encoding/json"
"errors"
"github.com/samcharles93/archie-core/internal/domain/messaging"
)
// Lifecycle receives adapter-owned startup facts.
type Lifecycle = messaging.Lifecycle
// Channel is the contract every chat platform must satisfy.
type Channel interface {
Name() string
Start(ctx context.Context, client messaging.ChatContract, lifecycle Lifecycle) error
Stop(ctx context.Context) error
// ConfigSchema returns the JSON Schema for this channel's required configuration.
ConfigSchema() json.RawMessage
// ValidateConfig checks that the provided configuration is valid for this channel.
ValidateConfig(cfg map[string]any) error
}
// Sender is a channel that can post a message unprompted. Channels that only
// reply to inbound messages do not implement it.
type Sender interface {
Send(ctx context.Context, chatID, text string) error
}
// Reloader is a channel that can re-read its configuration in place. The
// capability a status report declares and the reload action both derive from
// this interface, so a channel cannot advertise one and answer nothing.
type Reloader interface {
Reload() error
}
// ShowToolCallsSetter is a channel that renders completed tool calls in its
// replies when the operator turns chat.show_tool_calls on.
type ShowToolCallsSetter interface {
SetShowToolCalls(show bool)
}
// ErrNotRunning is returned by Send while the channel is stopped.
var ErrNotRunning = errors.New("channel is not running")