channel

package
v0.14.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package channel is a thin adapter over internal/agents/channels. Workflow code uses local types (Channel, TriggerSpec, ActionSpec, Registry) so node executors / MCP / inject stay simple, but the authoritative declarations live on each transport in internal/agents/channels/<name>/. Channels opt in by implementing agentchannels.WorkflowTriggerProvider + WorkflowActionProvider + (optionally) WorkflowSessionOriginator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectImplicitReply

func InjectImplicitReply(w *workflow.Workflow)

InjectImplicitReply scans the workflow and, if the trigger is a channel event without an explicit reply node back to the same channel+thread, appends a synthetic reply node at every terminal edge. ReplySource=false on the trigger opts out.

Behavior:

  • skip if trigger.reply_source explicitly false
  • skip if any existing `type: channel` action node uses op reply_thread/reply/send_message

func ValidateActionInput

func ValidateActionInput(spec ActionSpec, args map[string]any) error

ValidateActionInput checks `args` against a spec's required keys.

Types

type ActionSpec

type ActionSpec struct {
	ID           string         `json:"id"`
	Description  string         `json:"description"`
	Destructive  bool           `json:"destructive,omitempty"`
	InputSchema  map[string]any `json:"input_schema"`
	OutputSchema map[string]any `json:"output_schema,omitempty"`
}

ActionSpec mirrors agentchannels.WorkflowActionSpec.

type Channel

type Channel interface {
	Name() string
	TriggerSpecs() []TriggerSpec
	Actions() []ActionSpec
	Send(ctx context.Context, op string, args map[string]any) (any, error)
	SupportsSession() bool
}

Channel is the workflow-facing surface — a thin alias-style view onto the underlying agentchannels.Channel plus its workflow opt-ins. Local type so existing call sites compile unchanged.

type Info

type Info struct {
	Name            string        `json:"name"`
	Triggers        []TriggerSpec `json:"triggers"`
	Actions         []ActionSpec  `json:"actions"`
	SupportsSession bool          `json:"supports_session"`
}

Info is one row of the introspection response.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is the workflow view of registered channels. It wraps an agentchannels.Registry — channels are registered ONCE in the base registry; the workflow registry just filters those that opt into the workflow surface.

func NewRegistry

func NewRegistry() *Registry

NewRegistry constructs an empty registry (no base wired). Call SetBase or use NewRegistryFromBase once the agentchannels.Registry is constructed in server.go.

func NewRegistryFromBase

func NewRegistryFromBase(base *agentchannels.Registry) *Registry

NewRegistryFromBase wraps an existing agentchannels.Registry.

func (*Registry) Describe

func (r *Registry) Describe() []Info

Describe returns introspection rows for `workflow_channels` MCP op. Only includes channels that opt into the workflow surface.

func (*Registry) Get

func (r *Registry) Get(name string) (Channel, bool)

Get looks up a channel by name. Resolves from the base registry first (filtered to those opting into the workflow surface), then from extras.

func (*Registry) List

func (r *Registry) List() []string

List returns all workflow-visible channel names sorted.

func (*Registry) Register

func (r *Registry) Register(ch Channel)

Register adds a workflow-only test double directly (bypassing the base registry). Production code registers channels via agentchannels.Registry.Add and never calls this.

func (*Registry) SetBase

func (r *Registry) SetBase(base *agentchannels.Registry)

SetBase rewires the underlying base registry. Used by setup composer once the server-side channel registry is built.

type TriggerSpec

type TriggerSpec struct {
	Type          string         `json:"type"`
	Events        []string       `json:"events"`
	Description   string         `json:"description"`
	MatchSchema   map[string]any `json:"match_schema,omitempty"`
	PayloadSchema map[string]any `json:"payload_schema,omitempty"`
}

TriggerSpec mirrors agentchannels.WorkflowTriggerSpec. Kept local so the workflow package never imports agentchannels for value types in generated JSON / MCP payloads.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL