profile

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package profile manages saved AgentRoute profiles: named sets of per-tier OpenRouter model choices (the generic "heavy"/"balanced"/"fast" roles described in the architecture plan), persisted as JSON files under the AgentRoute state directory.

Index

Constants

View Source
const (
	TierHeavy    = "heavy"
	TierBalanced = "balanced"
	TierFast     = "fast"
)

Tier names AgentRoute exposes to every platform adapter. A given platform may use a subset (see internal/platform.Role).

Variables

View Source
var ErrInvalidName = fmt.Errorf("profile: invalid name")

ErrInvalidName is returned when a profile name would not round-trip safely as a filename (empty, or containing a path separator).

View Source
var ErrNotFound = fmt.Errorf("profile: not found")

ErrNotFound is returned by Load when no profile with the given name exists.

Functions

func Alias

func Alias(tier string) string

Alias returns the stable AgentRoute model alias for a tier, e.g. "balanced" -> "agentroute-balanced". This is the exact string platform adapters configure their tool to send as the model, and the exact string ModelRouter.Resolve is called with.

func Delete

func Delete(name string) error

Delete removes a saved profile. Deleting a profile that does not exist is a no-op (returns nil), matching idempotent CLI semantics.

func Exists

func Exists(name string) (bool, error)

Exists reports whether a profile with the given name has been saved.

func Save

func Save(p Profile) error

Save persists p atomically. If p.Created is zero, it is set to now.

Types

type Profile

type Profile struct {
	Name    string            `json:"name"`
	Port    int               `json:"port"`
	Models  map[string]string `json:"models"` // tier -> "openrouter/<id>"
	Created time.Time         `json:"created"`
}

Profile is a named, saved set of per-tier OpenRouter model choices.

func List

func List() ([]Profile, error)

List returns all saved profiles, sorted by name.

func Load

func Load(name string) (Profile, error)

Load reads a single profile by name.

func (Profile) Aliases

func (p Profile) Aliases() map[string]string

Aliases returns p's tier->model mappings keyed by AgentRoute alias (see Alias) instead of bare tier name. The result is directly assignable to a gateway.MapRouter (map[string]string with the same underlying type).

func (Profile) RoleAliases

func (p Profile) RoleAliases() map[string]string

RoleAliases returns p's tier->alias mapping (e.g. "heavy" -> "agentroute-heavy"), independent of which upstream model each alias currently resolves to. This is what platform.LinkInput.RoleAliases expects: a platform adapter configures its tool to request an alias for each tier; resolving that alias to a concrete model is the gateway's ModelRouter's job (see Aliases for that mapping), not the adapter's.

Jump to

Keyboard shortcuts

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