builtin

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package builtin holds Ether's built-in agent tools (SPEC §5.10, WS5). Every tool ends in an existing service behind a narrow interface, is bounded, and never mutates before approval: write tools return a tools.Proposal, and the one credential (a Stremio add-on URL) goes through a tools.SecretRequest so it never reaches a transcript.

Index

Constants

This section is empty.

Variables

View Source
var ErrApprovalNotFound = errors.New("no such approval")

ErrApprovalNotFound reports an unknown approval id.

Functions

func All

func All(d Deps) []tools.Tool

All returns every built-in tool. It panics on a nil required service, which is a wiring bug caught at startup.

Types

type ApprovalInfo

type ApprovalInfo struct {
	ID          string
	Tool        string
	Category    string
	Description string
	Status      string // pending, approved, rejected, failed
	Note        string
	CreatedAt   time.Time
	DecidedAt   *time.Time
}

ApprovalInfo is one proposed write as approval_status reports it. The app adapts WS4's agent.Store (internal/agent) to ApprovalReader.

type ApprovalReader

type ApprovalReader interface {
	Approval(ctx context.Context, id string) (ApprovalInfo, error)
}

ApprovalReader reads approval records.

type CatalogService

type CatalogService interface {
	Search(ctx context.Context, query string, types []core.MediaType, limit int) ([]core.Title, error)
	Get(ctx context.Context, key core.RatingKey) (*core.Title, error)
}

type CollectionService

type CollectionService interface {
	SnapshotList(ctx context.Context, offset, limit int) ([]core.Collection, error)
	SnapshotItems(ctx context.Context, key core.RatingKey, offset, limit int) (core.Page, error)
	Generate(ctx context.Context, prompt, mediaType string) (*core.CollectionSpec, string, error)
	CreateSpec(ctx context.Context, sp core.CollectionSpec) (*core.CollectionSpec, error)
	// Draft cleans and validates a model-written spec without saving it.
	Draft(ctx context.Context, raw, mediaType string) (*core.CollectionSpec, []string, error)
	// Preview runs an unsaved spec against the catalogue.
	Preview(ctx context.Context, sp core.CollectionSpec, n int) (*core.CollectionPreview, error)
}

type Deps

type Deps struct {
	Status      StatusService
	Playback    PlaybackService
	Resolver    ResolverService
	Logs        LogService
	Catalog     CatalogService
	Collections CollectionService
	LiveTV      LiveTVService
	Sources     SourceService
	Plugins     PluginService // optional (WS7)
	Approvals   ApprovalReader
	Profiles    ProfileService
	Frontends   FrontendService
	Server      ServerService
	OwnerUser   func(ctx context.Context) (*core.User, error)
	Routes      func() []RouteInfo
	Now         func() time.Time
}

Deps are the services the built-in tools call. The app adapts its real services to these interfaces; tests use fakes. Plugins and Approvals may be nil until WS7 and WS4 land.

type FrontendInfo

type FrontendInfo struct {
	ID      string
	Name    string
	Enabled bool
}

FrontendInfo is one client protocol frontend.

type FrontendService

type FrontendService interface {
	Frontends(ctx context.Context) ([]FrontendInfo, error)
	SetFrontendEnabled(ctx context.Context, id string, enabled bool) error
}

type HealthCheck

type HealthCheck struct {
	Name   string
	Status string
	Detail string
}

HealthCheck is one health_details row. Status is ok, attention or error.

type LiveTVService

type LiveTVService interface {
	Channels(ctx context.Context) ([]livetv.Channel, error)
	StreamSourceStatuses(ctx context.Context, channelID string) ([]livetv.StreamSourceStatus, error)
	ImportSource(ctx context.Context, src livetv.Source) (livetv.Source, error)
}

type LogLine

type LogLine struct {
	Time    time.Time
	Level   string
	Message string
	Attrs   map[string]string
}

LogLine is one redacted log line.

type LogService

type LogService interface {
	Tail(limit int, level, query string) []LogLine
}

type PlaybackService

type PlaybackService interface {
	History(ctx context.Context, viewerID int64, since time.Time, limit int) ([]core.HistoryEntry, error)
}

type PluginInfo

type PluginInfo struct {
	ID      string
	Name    string
	Version string
	Kind    string
	Enabled bool
	Health  string
	Detail  string
}

PluginInfo is one installed plugin (WS7).

type PluginService

type PluginService interface {
	Plugins(ctx context.Context) ([]PluginInfo, error)
	PluginHealth(ctx context.Context, id string) (PluginInfo, error)
	SetPluginEnabled(ctx context.Context, id string, enabled bool) error
}

type ProfileInfo

type ProfileInfo struct {
	Name    string
	Ranking []string
	Rules   []core.ReleaseRule
}

ProfileInfo is one quality profile with its ranking and rules.

type ProfileService

type ProfileService interface {
	Profiles(ctx context.Context) ([]ProfileInfo, error)
	SetRanking(ctx context.Context, profile string, ranking []string) error
	AddRule(ctx context.Context, profile string, rule core.ReleaseRule) error
}

type ReleaseHealth

type ReleaseHealth struct {
	Known     bool // among recent search results
	Blocked   bool
	Pinned    bool
	Status    string // last recorded status, when known
	Reason    string
	CheckedAt time.Time
}

ReleaseHealth is the last known health of one release, read without probing: a fresh check spends indexer budget and can blocklist, so it stays a console action, not a read tool.

type ResolverService

type ResolverService interface {
	History(ctx context.Context, f resolver.HistoryFilter) ([]resolver.HistoryRecord, int, error)
	HistoryEntry(ctx context.Context, id int64) (resolver.HistoryRecord, error)
	ReleaseHealth(ctx context.Context, releaseID string, titleKey core.RatingKey) (ReleaseHealth, error)
	LookupRelease(id string) (core.Release, bool)
	Block(ctx context.Context, req resolver.BlockRequest, reason string) (resolver.BlockEntry, error)
	PinRelease(ctx context.Context, titleKey core.RatingKey, releaseID, note string) error
}

ResolverService is satisfied by resolver.Service except ReleaseHealth and PinRelease, which the app composes from its exported reads.

type RouteInfo

type RouteInfo struct {
	Route string
	Label string
}

RouteInfo is one console destination for navigate.

type ServerService

type ServerService interface {
	Restart(ctx context.Context, whenIdle bool) error
}

type ServerStatus

type ServerStatus struct {
	Version         string
	ServerName      string
	StartedAt       time.Time
	SetupComplete   bool
	ActiveSessions  int
	IndexersEnabled int
	IndexersTotal   int
	LiveChannels    int
}

ServerStatus is the server_status snapshot.

type SourceInfo

type SourceInfo struct {
	Name    string
	Kind    string // newznab, stremio, cardigann, usenet provider, debrid, budget…
	Class   string
	Enabled bool
	Host    string
	Health  string // ok, attention, error or a short usage note
	Detail  string
}

SourceInfo is one sources_list row. Host is a bare host name; full URLs can carry keys and are never sent to a model.

type SourceService

type SourceService interface {
	Sources(ctx context.Context) ([]SourceInfo, error)
	// AddStremio stores a Stremio add-on install URL and enables it. The
	// URL can carry keys: callers must treat it as a secret.
	AddStremio(ctx context.Context, addonURL string) (SourceInfo, error)
}

type StatusService

type StatusService interface {
	ServerStatus(ctx context.Context) (ServerStatus, error)
	Health(ctx context.Context) ([]HealthCheck, error)
}

Jump to

Keyboard shortcuts

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