executions

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package executions coordinates async execution requests and user selections.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("execution already exists")

ErrAlreadyExists is returned when correlation id already exists.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	// URL is the webhook callback URL.
	URL string `json:"url"`
}

Callback defines async callback settings.

type Execution

type Execution struct {
	Request      Request
	CreatedAt    time.Time
	MessageID    int
	MessageText  string
	AwaitingText bool
}

Execution stores state for a single execution request.

type Registry

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

Registry stores active execution requests.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new execution registry.

func (*Registry) Add

func (r *Registry) Add(req Request) (*Execution, error)

Add registers a new execution request.

func (*Registry) ClearPrompt

func (r *Registry) ClearPrompt(correlationID string) int

ClearPrompt removes active custom-input prompt if correlation id matches.

func (*Registry) CurrentPrompt

func (r *Registry) CurrentPrompt() (*Execution, int)

CurrentPrompt returns execution awaiting custom input and prompt message id.

func (*Registry) Get

func (r *Registry) Get(correlationID string) *Execution

Get returns execution by correlation id.

func (*Registry) Resolve

func (r *Registry) Resolve(correlationID string) (*Execution, int, bool)

Resolve removes execution and clears prompt if needed.

func (*Registry) SetMessage

func (r *Registry) SetMessage(correlationID string, messageID int, messageText string)

SetMessage stores Telegram message metadata for execution.

func (*Registry) SetPromptMessage

func (r *Registry) SetPromptMessage(correlationID string, messageID int)

SetPromptMessage stores active custom-input prompt message id.

func (*Registry) StartCustomInput

func (r *Registry) StartCustomInput(correlationID string) (int, bool)

StartCustomInput marks execution as waiting for custom text and returns previous prompt to delete.

type Request

type Request struct {
	CorrelationID string
	Tool          Tool
	Arguments     map[string]any
	Spec          map[string]any
	Question      string
	Context       string
	Options       []string
	AllowCustom   bool
	CustomLabel   string
	Lang          string
	Markup        string
	Callback      Callback
}

Request holds data required for execution.

type Result

type Result struct {
	Status Status
	Output any
	Note   string
}

Result represents the execution result.

type Status

type Status string

Status describes execution status.

const (
	// StatusSuccess means execution finished successfully.
	StatusSuccess Status = "success"
	// StatusError means execution failed.
	StatusError Status = "error"
	// StatusPending means execution is queued for async completion.
	StatusPending Status = "pending"
)

type Tool

type Tool struct {
	Name         string         `json:"name"`
	Title        string         `json:"title,omitempty"`
	Description  string         `json:"description,omitempty"`
	InputSchema  map[string]any `json:"input_schema,omitempty"`
	OutputSchema map[string]any `json:"output_schema,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
	Tags         []string       `json:"tags,omitempty"`
}

Tool describes tool metadata from yaml-mcp-server.

Jump to

Keyboard shortcuts

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