Documentation
¶
Overview ¶
Package person is someone as their database holds them: their life, how they live, their owner's judgment, their skills and their secrets. Only DATABASE_URL and TINIO_KEY are outside it. Files only come in (tinio new, their old self/ folder, tinio self import) and go out (export).
Index ¶
- Variables
- func BySection(files map[string][]byte) map[string][]byte
- func CheckName(name string) error
- func Env(ctx context.Context, st Store, key secret.Key) ([]string, error)
- func ReadFolder(dir string) (map[string][]byte, error)
- func SkillsIn(dir string) ([]agentskill.Skill, []string)
- func Start(ctx context.Context, st Store, key secret.Key, sections map[string][]byte, ...) (string, bool, error)
- type Agent
- type Imported
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrNoOne = errors.New("no one lives here yet: start someone with `tinio new`")
var Files = map[string]string{memory.SectionCharacter: "character.yaml", memory.SectionWork: "work.yaml", memory.SectionJudgment: "judgment.yaml"}
Files are the sections as files, as each character in characters/ has them.
var Known = []string{"TELEGRAM_BOT_TOKEN", "TELEGRAM_OWNER_ID", "OPENAI_API_KEY", "OPENAI_MODEL", "CONSOLE_TOKEN"}
Known are the secrets every person has: what tinio new asks for.
Functions ¶
func BySection ¶
BySection is files, by file name (Files, or the names before v0.4.0), by section; a file of neither name is left out.
func Env ¶
Env puts their secrets in this process's environment where it doesn't already set them, so the config's ${VAR}s and their tools' env find them. It returns those the environment sets too, which win.
func ReadFolder ¶
ReadFolder is the sections in dir, by section; a missing file is left out.
func SkillsIn ¶
func SkillsIn(dir string) ([]agentskill.Skill, []string)
SkillsIn reads every skill folder in dir; a missing dir has none.
func Start ¶
func Start(ctx context.Context, st Store, key secret.Key, sections map[string][]byte, secrets map[string]string, skills []agentskill.Skill, source string, now time.Time) (string, bool, error)
Start makes the database theirs, all at once: sections are their YAML by section (BySection), checked first. It returns false, changing nothing, if someone lives there already.
Types ¶
type Agent ¶
type Agent struct {
Life character.Character // their character
Work []byte // read over the config (config.Load)
Judgment character.Judgment
Skills []agentskill.Skill
// FromEnv are stored secrets the environment sets too: it wins.
FromEnv []string
// Unreadable are stored skills left out, with why.
Unreadable []string
}
type Imported ¶
type Imported struct {
Name string // "" if no one was
Secrets []string
Skills []string
Skipped []string // folders that aren't skills, with why
}
func Import ¶
func Import(ctx context.Context, st Store, key secret.Key, dir string, now time.Time) (Imported, error)
Import moves someone from their folder into their database, once: dir's sections and skills/, and the secrets the environment sets (Known, and those their tools name). Nothing is imported (Name "") if no one lives in dir or someone lives in the database already.
type Store ¶
type Store interface {
Start(ctx context.Context, name string, vs []memory.SelfVersion, secrets map[string][]byte, skills []memory.AgentSkill, at time.Time) (bool, error)
Self(ctx context.Context, section string) (memory.SelfVersion, bool, error)
Secrets(ctx context.Context) (map[string][]byte, error)
AgentSkills(ctx context.Context) ([]memory.AgentSkill, error)
}