runtime

package
v0.33.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentVersion = "dev"
View Source
var ErrAlreadyRunning = errors.New("agenvoy daemon already running")

Functions

func AddSystemCron added in v0.27.10

func AddSystemCron(spec string, fn func()) error

func AppendCron added in v0.22.0

func AppendCron(c CronEntry) error

func AppendTask added in v0.22.0

func AppendTask(t TaskEntry) error

func AskUser added in v0.26.0

func AskUser(req Request, onResolve func(Reply)) (string, error)

func Clear added in v0.21.0

func Clear() error

func ConfirmOptions added in v0.24.0

func ConfirmOptions() []string

func CronKey added in v0.22.0

func CronKey(c CronEntry) string

func EntryExists added in v0.26.0

func EntryExists(id string) bool

func Fire added in v0.28.24

func Fire(sessionID, skillName string) (string, error)

func FormatToolArgs added in v0.24.0

func FormatToolArgs(name, raw string) (formatted string, multiline bool)

func HasListener added in v0.23.0

func HasListener(sessionID string) bool

func HasTaskForSkill added in v0.23.3

func HasTaskForSkill(skill string) (bool, error)

func IsAlive

func IsAlive(pid int) bool

func IsCurrent

func IsCurrent() bool

func IsDev added in v0.32.12

func IsDev() bool

func MatchSkill added in v0.24.2

func MatchSkill(scanner *SkillScanner, input string, excludeSkills ...string) (*skill.Skill, string)

func NewScheduler added in v0.22.0

func NewScheduler() error

func PatchCron added in v0.22.0

func PatchCron(skillName, newExpression string) (int, error)

func PatchTask added in v0.22.0

func PatchTask(skillName string, newAt time.Time) (int, error)

func RegisterListener added in v0.23.0

func RegisterListener(prefix string) (<-chan struct{}, func())

func RegisterResumeHandler added in v0.26.0

func RegisterResumeHandler(prefix string, fn func(string, string, []any))

func RemoveCron added in v0.22.0

func RemoveCron(name string) (int, error)

func RemoveTask added in v0.22.0

func RemoveTask(name string) (int, error)

func RemoveTaskByTimeSkill added in v0.23.3

func RemoveTaskByTimeSkill(at time.Time, skill string) (int, error)

func Resolve added in v0.23.0

func Resolve(id string, r Reply)

func SaveCrons added in v0.22.0

func SaveCrons(crons []CronEntry) error

func SaveTasks added in v0.22.0

func SaveTasks(tasks []TaskEntry) error

func SchedulerWatcher added in v0.22.0

func SchedulerWatcher(ctx context.Context) func()

func SetCrons added in v0.33.1

func SetCrons(skillName, sessionID string, expressions []string) error

func SetRunner added in v0.22.0

func SetRunner(r Runner)

func SetTasks added in v0.33.1

func SetTasks(skillName, sessionID string, list []time.Time) error

func SkillSource added in v0.28.35

func SkillSource(path string) string

func Stop added in v0.21.0

func Stop(pid int) error

func StopScheduler added in v0.22.0

func StopScheduler()

func TaskKey added in v0.22.0

func TaskKey(t TaskEntry) string

func TriggerResume added in v0.26.0

func TriggerResume(sessionID, taskHash string, answers []any) bool

Types

type CronEntry added in v0.22.0

type CronEntry struct {
	Expression string `json:"expression"`
	SessionID  string `json:"session_id"`
	Skill      string `json:"skill"`
}

func LoadCrons added in v0.22.0

func LoadCrons() ([]CronEntry, error)

type Kind added in v0.23.0

type Kind string
const (
	KindToolConfirm Kind = "tool_confirm"
	KindAskUser     Kind = "ask_user"
)

type Listener added in v0.24.0

type Listener[CID comparable, MID comparable] struct {
	// contains filtered or unexported fields
}

func New added in v0.24.0

func New[CID comparable, MID comparable](
	transport Transport[CID, MID],
	prefix string,
	lookupName func(CID) string,
	deleteMsg func(ctx context.Context, chatID CID, msgID MID) error,
) *Listener[CID, MID]

func (*Listener[CID, MID]) IsAwaitingChat added in v0.24.0

func (l *Listener[CID, MID]) IsAwaitingChat(chatID CID) bool

func (*Listener[CID, MID]) IsAwaitingPrompt added in v0.24.0

func (l *Listener[CID, MID]) IsAwaitingPrompt(chatID CID, msgID MID) bool

func (*Listener[CID, MID]) OnCallback added in v0.24.0

func (l *Listener[CID, MID]) OnCallback(ctx context.Context, chatID CID, msgID MID, data string, picks []string) bool

func (*Listener[CID, MID]) OnText added in v0.24.0

func (l *Listener[CID, MID]) OnText(ctx context.Context, chatID CID, msgID MID, text string) bool

func (*Listener[CID, MID]) Stop added in v0.24.0

func (l *Listener[CID, MID]) Stop()

type Question added in v0.23.0

type Question struct {
	Question    string   `json:"question"`
	Detail      string   `json:"detail,omitempty"`
	Options     []string `json:"options,omitempty"`
	MultiSelect bool     `json:"multi_select,omitempty"`
	Secret      bool     `json:"secret,omitempty"`
}

type QuestionType added in v0.24.0

type QuestionType int
const (
	TypeToolConfirm QuestionType = iota
	TypeAskText
	TypeAskSecret
	TypeAskSingle
	TypeAskMulti
)

type Reply added in v0.23.0

type Reply struct {
	Approve   bool
	Verified  bool
	Skip      bool
	Remember  bool
	AllowTurn bool
	Reason    string
	Answers   []any
	ExitCode  int
	Error     error
}

func Ask added in v0.23.0

func Ask(ctx context.Context, req Request) (Reply, error)

type Request added in v0.23.0

type Request struct {
	ID         string
	Kind       Kind
	SessionID  string
	ToolName   string
	ToolArgs   string
	Restricted []string
	AskUser    *UserPayload
	Ctx        context.Context
	EnqueueAt  time.Time
}

func PickNext added in v0.23.0

func PickNext(prefix string) (id string, req Request, ok bool)

func PickNextMatch added in v0.24.0

func PickNextMatch(prefix string, accept func(Request) bool) (id string, req Request, ok bool)

type Runner added in v0.22.0

type Runner func(ctx context.Context, sessionID, skillName string) (string, error)

type Runtime

type Runtime struct {
	UID       string `json:"uid"`
	PID       int    `json:"pid"`
	StartedAt string `json:"started_at"`
}

func Init

func Init() (*Runtime, error)

func Read

func Read() (*Runtime, error)

type SkillList added in v0.24.2

type SkillList struct {
	ByName map[string]*skill.Skill
	ByPath map[string]*skill.Skill
	Paths  []string
}

type SkillScanner added in v0.24.2

type SkillScanner struct {
	Skills *SkillList
	// contains filtered or unexported fields
}

func NewSkillScanner added in v0.24.2

func NewSkillScanner() *SkillScanner

func (*SkillScanner) List added in v0.24.2

func (s *SkillScanner) List() []string

func (*SkillScanner) Lookup added in v0.24.2

func (s *SkillScanner) Lookup(name string) *skill.Skill

func (*SkillScanner) Scan added in v0.24.2

func (s *SkillScanner) Scan()

type TaskEntry added in v0.22.0

type TaskEntry struct {
	At        time.Time `json:"at"`
	SessionID string    `json:"session_id"`
	Skill     string    `json:"skill"`
}

func LoadTasks added in v0.22.0

func LoadTasks() ([]TaskEntry, error)

type Transport added in v0.24.0

type Transport[CID comparable, MID comparable] interface {
	LookupChatID(sessionID string) (CID, error)
	SendConfirm(ctx context.Context, chatID CID, toolName, toolArgs string, multiline bool) (MID, error)
	SendAskText(ctx context.Context, chatID CID, header string, secret bool) (MID, error)
	SendAskSingle(ctx context.Context, chatID CID, header string, options []string) (MID, error)
	SendAskMulti(ctx context.Context, chatID CID, header string, options []string) (MID, error)
}

type UserPayload added in v0.23.0

type UserPayload struct {
	Questions []Question `json:"questions"`
}

Directories

Path Synopsis
toolAdapter
api

Jump to

Keyboard shortcuts

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