Documentation
¶
Overview ¶
Package backup packs what the user set up in magpie into one file, sealed with a passphrase, to carry to another machine: the providers (their keys too, unless left out), the pictures picked for them, the settings, the profiles, every agent's model and the library (the instructions, MCP servers and skills magpie gives the agents). Subscriptions are not in it: each is the sign-in of an agent on this machine, so each machine signs in on its own.
The file is JSON: a header naming how it is sealed, and the bundle encrypted with AES-256-GCM under a key derived from the passphrase with PBKDF2-SHA256. Nothing in it can be read without the passphrase.
Index ¶
Constants ¶
const Ext = ".magpie-backup"
Ext is the extension backups are saved with.
Variables ¶
All is every part.
var ErrPassphrase = errors.New("wrong passphrase, or the file was changed")
ErrPassphrase is a passphrase that does not open the backup.
Functions ¶
Types ¶
type Bundle ¶
type Bundle struct {
Version int `json:"version"`
Created time.Time `json:"created"`
App string `json:"app,omitempty"` // the magpie that made it
Keys bool `json:"keys"` // whether the providers carry their keys
Providers []provider.Provider `json:"providers"`
Icons map[string][]byte `json:"icons,omitempty"` // pictures picked for providers, by file name
Groups []provider.Group `json:"groups,omitempty"` // the user's model groups
Settings *settings.Settings `json:"settings,omitempty"`
Profiles map[string]profile.Profile `json:"profiles,omitempty"`
Agents map[string]string `json:"agents,omitempty"` // every agent's fields as they are now
Library *library.Bundle `json:"library,omitempty"` // nil from a magpie before it, or with none
}
Bundle is what a backup holds.
type Parts ¶
type Parts struct {
Providers, Settings, Profiles, Agents, Library bool
}
Parts picks what a restore puts back.
type Result ¶
type Result struct {
Added, Replaced int // providers
NeedKey []string // providers that came without a key and have none here
Settings bool
Profiles int
Agents int // agent fields changed
Skipped []string // agent fields left alone: the agent is not on this machine, or the value failed
Library bool // the library was put in
LibraryProblems []library.Problem `json:",omitempty"` // what of it couldn't be given to an agent
}
Result says what a restore did.