taskmaster

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package taskmaster provides an unstable reusable async message scheduler.

The runtime coordinates local node inboxes and external dispatch targets around one public Message type. Nodes receive one message, can emit many addressed messages while running, and return one terminal Outcome.

Index

Constants

View Source
const (
	MessageKindJob          = "job"
	MessageKindProgress     = "progress"
	MessageKindNotification = "notification"
	MessageKindResult       = "result"
	MessageKindError        = "error"

	OutcomeStatusCompleted = "completed"
	OutcomeStatusFailed    = "failed"
	OutcomeStatusStopped   = "stopped"
)
View Source
const (
	LocatorClassAgent       = "agent"
	LocatorClassAlias       = "alias"
	LocatorClassHuman       = "human"
	LocatorClassIntegration = "integration"

	LocatorTransportCLI      = "cli"
	LocatorTransportFakeChat = "fakechat"
	LocatorTransportLocal    = "local"
	LocatorTransportTelegram = "telegram"
	LocatorTransportTimer    = "timer"
	LocatorTransportWhatsApp = "whatsapp"

	CLIInputKey     = "input"
	CLILogKey       = "log"
	DefaultTimerKey = "default"
)

Variables

View Source
var ErrUnsupported = errors.New("unsupported locator operation")

Functions

This section is empty.

Types

type CLILogTarget

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

func (CLILogTarget) DispatchMessage

func (t CLILogTarget) DispatchMessage(_ context.Context, msg Message) error

func (CLILogTarget) Supports

func (t CLILogTarget) Supports(locator Locator) bool

type Config

type Config struct {
	Logger        *zerolog.Logger
	RootNodeID    string
	Nodes         map[string]Node
	Targets       []Target
	OutcomeRouter OutcomeRouter
}

type EmitFunc

type EmitFunc func(ctx context.Context, msg Message) error

type Locator

type Locator struct {
	Class     string         `json:"class"`
	Transport string         `json:"transport"`
	Key       string         `json:"key"`
	Address   map[string]any `json:"address,omitempty"`
}

func NewAgentLocator

func NewAgentLocator(id string) Locator

func NewCLIInputLocator

func NewCLIInputLocator() Locator

func NewCLILogLocator

func NewCLILogLocator() Locator

func NewFakeChatHumanLocator

func NewFakeChatHumanLocator(chatID string) Locator

func NewLocator

func NewLocator(locatorClass string, transport string, key string) Locator

func NewTelegramHumanLocator

func NewTelegramHumanLocator(chatID int64, topicID int) Locator

func NewTimerSourceLocator

func NewTimerSourceLocator() Locator

func NewWhatsAppHumanLocator

func NewWhatsAppHumanLocator(phoneNumberID string) Locator

func NormalizeLocator

func NormalizeLocator(locator Locator) (Locator, error)

func (Locator) String

func (l Locator) String() string

type Message

type Message struct {
	ID        string         `json:"id"`
	SessionID string         `json:"session_id"`
	Kind      string         `json:"kind"`
	From      Locator        `json:"from"`
	To        Locator        `json:"to"`
	ParentID  string         `json:"parent_id,omitempty"`
	Content   string         `json:"content"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

func NormalizeMessage

func NormalizeMessage(msg Message) (Message, error)

type Node

type Node interface {
	Run(ctx context.Context, msg Message, emit EmitFunc) Outcome
}

type Outcome

type Outcome struct {
	Status   string
	Content  string
	Metadata map[string]any
	Err      error
}

type OutcomeRouter

type OutcomeRouter func(msg Message, outcome Outcome) []Message

type Runtime

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

func New

func New(cfg Config) (*Runtime, error)

func (*Runtime) Done

func (r *Runtime) Done() <-chan struct{}

func (*Runtime) Enqueue

func (r *Runtime) Enqueue(msg Message) error

func (*Runtime) Err

func (r *Runtime) Err() error

func (*Runtime) Start

func (r *Runtime) Start(ctx context.Context) error

func (*Runtime) Stop

func (r *Runtime) Stop(ctx context.Context) error

type Target

type Target interface {
	Supports(locator Locator) bool
	DispatchMessage(ctx context.Context, msg Message) error
}

func NewCLILogTarget

func NewCLILogTarget(logger zerolog.Logger) Target

Directories

Path Synopsis
Package adk wraps an already-built ADK agent for Taskmaster local execution.
Package adk wraps an already-built ADK agent for Taskmaster local execution.

Jump to

Keyboard shortcuts

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