Run Vale over every tracked Go, Markdown and template file and fix the remaining findings: long sentences, repetition, UI verbs, identifiers that should be backticked, and migration narration in comments. AGENTS.md and CLAUDE.md keep their absolute rules; the prompt heuristic against repeated absolutes is disabled for rule files.
52 lines
1.7 KiB
Go
52 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
|
|
// the Reloader 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")
|