migrate

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 39 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package migrate brings a user's setup over from another personal-assistant agent (Hermes, OpenClaw, nanobot, …): providers and keys, persona files, memory, skills, MCP servers, schedules and chat channels. Chat history is deliberately not migrated.

The flow is detect → plan → apply. Detect is cheap and read-only. Plan reads the source and describes every item it would bring over, without writing anything. Apply writes the items the user kept, after a backup. Contract: docs/plans/2026-10-03-migrate-contract.md.

Index

Constants

View Source
const HermesMemorySeparator = "\n§\n"

HermesMemorySeparator is the delimiter Hermes writes between entries in memories/MEMORY.md and memories/USER.md (tools/memory_tool.py, ENTRY_DELIMITER = "\n§\n").

View Source
const ManifestVersion = 1

ManifestVersion is bumped when the manifest layout changes.

Variables

View Source
var CatalogueProviderIDs = []string{
	"openrouter", "anthropic", "openai", "gemini", "zai", "opencode", "ollama",
	"lmstudio", "azure", "bedrock", "vertex", "copilot", "codex", "custom",
}

CatalogueProviderIDs are the built-in provider ids of the setup catalogue (internal/server/handlers_setup.go setupProviderCatalogue). A custom provider must not take one. Duplicated here because migrate cannot import server; a server test asserts the two lists match.

View Source
var ErrNoSecret = errors.New("no such keychain entry")

ErrNoSecret means the keychain has no such entry.

View Source
var ErrNotFound = errors.New("not installed")

ErrNotFound is what Detect returns when the agent is not installed at the default locations (or at root). DetectAll also treats any other error, or a Detection with an empty Root, as "not installed".

View Source
var HomeDir = func() string {
	h, _ := os.UserHomeDir()
	return h
}

HomeDir is the user's home directory; tests may override it.

View Source
var PIDAlive = func(pid int) bool {
	if pid <= 0 || runtime.GOOS == "windows" {
		return false
	}
	p, err := os.FindProcess(pid)
	if err != nil {
		return false
	}
	return p.Signal(syscall.Signal(0)) == nil
}

PIDAlive reports whether pid is a live process (never on Windows, where signal 0 is not available). Sources use it for PID/lock files; tests replace it.

View Source
var RunningCheck = func(processPatterns, launchdLabels []string) bool {
	if runtime.GOOS == "darwin" {
		for _, l := range launchdLabels {
			if out, err := exec.Command("launchctl", "list", l).Output(); err == nil && bytes.Contains(out, []byte(`"PID"`)) {
				return true
			}
		}
	}
	if runtime.GOOS == "windows" {
		return false
	}
	for _, p := range processPatterns {
		if err := exec.Command("pgrep", "-f", p).Run(); err == nil {
			return true
		}
	}
	return false
}

RunningCheck reports whether any of the named processes (matched against the full command line) or launchd labels (macOS) is running. Sources call it from Detect; tests replace it.

View Source
var SupportedPlatforms = []string{"telegram", "discord", "slack", "matrix", "signal", "whatsapp", "feishu"}

SupportedPlatforms are the gateway.<platform> blocks Antares has.

Functions

func BackupsDir

func BackupsDir() string

BackupsDir is where migration backups live.

func ContentHash

func ContentHash(s string) string

ContentHash is a short stable hash of normalised text, used for memory ids and dedupe.

func CronJobID

func CronJobID(sourceID, itemID string) string

CronJobID is the deterministic id of an imported schedule.

func CustomProviderID

func CustomProviderID(taken func(id string) bool, name string) string

CustomProviderID mints a config id for a user-named OpenAI-compatible provider, with the same rules as server.CustomProviderID: slug of the name, "custom-provider" when the slug is empty or "custom", never a catalogue id, and "-2", "-3"… until taken reports false.

func EverySchedule

func EverySchedule(d time.Duration) string

EverySchedule renders an interval as an Antares "@every" schedule ("@every 30m", "@every 2h", "@every 1h30m").

func ExpandHome

func ExpandHome(p string) string

ExpandHome turns a leading "~" into the user's home directory.

func ExpandVars

func ExpandVars(s string, env map[string]string) (string, bool)

ExpandVars replaces ${VAR} and $VAR references with values from env, then from the process environment. ok is false when a referenced variable is unset anywhere (the caller then marks the item needs_input).

func IsDir

func IsDir(path string) bool

IsDir reports whether path exists and is a directory.

func IsFile

func IsFile(path string) bool

IsFile reports whether path exists and is a regular file.

func IsLocalURL

func IsLocalURL(u string) bool

IsLocalURL reports whether an endpoint is on this machine (no key needed).

func ItemID

func ItemID(cat Category, key string) string

ItemID is "<category>:<key>".

func JSON5ToJSON

func JSON5ToJSON(src []byte) ([]byte, error)

JSON5ToJSON rewrites JSON5 text as strict JSON. It handles the JSON5 that config files actually use: // and /* */ comments, trailing commas, unquoted identifier keys, single-quoted strings, backslash line continuations, hexadecimal integers, leading '+' and bare leading/trailing decimal points. Infinity and NaN have no JSON form and become null.

func LooksSecret

func LooksSecret(text string) bool

LooksSecret reports whether text appears to contain a credential.

func MemoryID

func MemoryID(sourceID, content string) string

MemoryID is the deterministic store id of an imported memory, so a second import of the same entry is a no-op.

func NextFreeName

func NextFreeName(name string, taken func(string) bool) string

NextFreeName returns name if free, else name-2, name-3… (the rename resolution).

func NormalizeTransport

func NormalizeTransport(t, url string) string

NormalizeTransport maps a source's MCP transport name to Antares' "stdio" or "http" (sse, streamable_http, streamable-http and http → http; empty → http when a URL is set, else stdio).

func PlatformLabel

func PlatformLabel(p string) string

PlatformLabel is a display name for a channel platform.

func RAGCollection

func RAGCollection(sourceID string) string

RAGCollection is the RAG collection a source's knowledge goes into.

func ReadDotEnv

func ReadDotEnv(path string) map[string]string

ReadDotEnv parses a KEY=VALUE file (blank lines and # comments ignored, optional "export " prefix, single/double quotes stripped, inline " #" comments dropped from unquoted values). A missing file yields an empty map.

func ReadJSON

func ReadJSON(path string, v any) error

ReadJSON decodes a JSON file into v.

func ReadJSON5

func ReadJSON5(path string, v any) error

ReadJSON5 decodes a JSON5 file (comments, trailing commas, unquoted keys, single-quoted strings, hex numbers) into v via JSON5ToJSON.

func ReadText

func ReadText(path string) string

ReadText returns a file's contents trimmed, or "" when it is missing, unreadable or larger than 8 MB.

func ReadYAML

func ReadYAML(path string, v any) error

ReadYAML decodes a YAML file into v.

func Redact

func Redact(s string) string

Redact masks a secret for display: "••••" plus the last 4 characters when the value is long enough to keep them anonymous, else just "••••".

func RedactSecrets

func RedactSecrets(text string) string

RedactSecrets masks credential-looking values in text meant for display.

func Register

func Register(s Source)

Register adds a source; called from each source file's init.

func RenderPlan

func RenderPlan(p Plan) string

RenderPlan prints a plan as stable text — one line per item plus its payload with every secret redacted. Used for golden tests and the CLI's --dry-run --verbose output.

func ResolveBackup

func ResolveBackup(name string) (string, error)

ResolveBackup turns a backup directory name ("migrate-hermes-20261003T101500Z") into its absolute path under the backups dir. Only a bare name is accepted: anything with a path separator or "..", or not starting with "migrate-", is refused.

func RoleDirs

func RoleDirs(cfg *config.Config) []string

RoleDirs are the configured role directories, expanded; the first is where imported roles are written. Falls back to <home>/roles.

func SkillDirs

func SkillDirs(cfg *config.Config) []string

SkillDirs are the configured user skill directories, expanded; the first is where imports are written. Falls back to <home>/skills.

func Slug

func Slug(name string) string

Slug reduces a name to lowercase kebab-case ASCII (the form Antares uses for skill, role, MCP and provider ids).

func Summarize

func Summarize(items []Item) string

Summarize renders the picker's count line ("2 providers · 14 skills · Telegram") from a plan's items; channels are named, the rest counted.

func SupportedPlatform

func SupportedPlatform(p string) bool

SupportedPlatform reports whether Antares has a gateway for platform.

func TextPath

func TextPath(cat Category) string

TextPath is the Antares file a text category writes.

func Truncate

func Truncate(s string, n int) string

Truncate shortens s to n runes with an ellipsis.

func Undo

func Undo(ctx context.Context, backup string, deps Deps) error

Undo reverses one Apply: files it changed are restored from the backup, files/folders it created are removed, and the memories, cron jobs and RAG documents it added are deleted. The backup dir is kept, marked undone; a second Undo is an error. The caller reloads the server afterwards.

func ValidSchedule

func ValidSchedule(expr string) error

ValidSchedule reports whether Antares' scheduler accepts expr.

Types

type BackupEntry

type BackupEntry struct {
	Path   string `json:"path"`
	Backup string `json:"backup"`
}

BackupEntry maps a live path to its copy in the backup dir.

type BackupInfo

type BackupInfo struct {
	Name      string    `json:"name"` // dir name under backups/, the undo handle
	Source    string    `json:"source"`
	Profile   string    `json:"profile,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	Applied   int       `json:"applied"`
	Undone    bool      `json:"undone"`
}

BackupInfo describes one past migration, for the Settings list.

func ListBackups

func ListBackups() []BackupInfo

ListBackups returns the migration backups, newest first.

type Category

type Category string

Category groups plan items; the UI shows one section per category and the CLI's --only flag filters by it.

const (
	CatProvider  Category = "provider"  // an LLM provider with its key
	CatModel     Category = "model"     // the default model (+ fallbacks)
	CatSoul      Category = "soul"      // persona → ~/.antares/SOUL.md
	CatAgentsMD  Category = "agents_md" // global instructions → ~/.antares/AGENTS.md
	CatUserMD    Category = "user_md"   // facts about the user → ~/.antares/USER.md
	CatMemory    Category = "memory"    // one memory entry → store.Memory
	CatKnowledge Category = "knowledge" // a note/daily file → RAG collection
	CatSkill     Category = "skill"     // a SKILL.md folder → ~/.antares/skills/<name>/
	CatMCP       Category = "mcp"       // an MCP server → config mcp.servers
	CatCron      Category = "cron"      // a schedule → store.CronJob
	CatChannel   Category = "channel"   // a chat channel → config gateway.<platform>
	CatRole      Category = "role"      // a sub-agent/agent profile → ~/.antares/roles/<name>.md
)

type ChannelPayload

type ChannelPayload struct {
	Platform string // telegram | discord | slack | matrix | signal | whatsapp | feishu
	// Fields holds the gateway.<platform> keys to set, by their YAML name
	// (bot_token, app_token, allowed_users, allowed_chats, …).
	Fields map[string]any
}

type Choice

type Choice struct {
	ID         string     `json:"id"`
	Resolution Resolution `json:"resolution,omitempty"` // for conflicts
	// Input supplies a needs_input value (e.g. the API key).
	Input string `json:"input,omitempty"`
}

Choice is what the user decided for one item.

type CronPayload

type CronPayload struct {
	Name     string
	Schedule string // already converted to an Antares schedule (cron, @every, @daily…)
	Prompt   string
	Timezone string
	Enabled  bool
}

type DefaultModelChecker

type DefaultModelChecker interface {
	HasDefaultModel() bool
}

DefaultModelChecker reports whether Antares already has a working default model (a model plus a provider that can answer).

type Deps

type Deps struct {
	// Store receives memories and cron jobs; required when the plan has any.
	Store store.Store
	// RAG indexes knowledge items; nil means RAG is off (items are skipped).
	RAG tools.RAGProvider
	// Now is the clock (UTC timestamps for backup dirs); nil = time.Now.
	Now func() time.Time
}

Deps are the live services Apply and Undo write through.

type Detection

type Detection struct {
	Source  string `json:"source"` // Source.ID()
	Name    string `json:"name"`   // Source.Name()
	Root    string `json:"root"`   // the agent's home dir, e.g. ~/.hermes
	Version string `json:"version,omitempty"`
	// Profile distinguishes several installs of one agent (Hermes profiles,
	// OpenClaw extra agents); empty for the default.
	Profile string `json:"profile,omitempty"`
	// Running is true when the agent's process/service appears to be running
	// (its bots would fight Antares' bots over the same tokens).
	Running bool `json:"running"`
	// Summary is a short count line for the picker, e.g.
	// "2 providers · 14 skills · Telegram".
	Summary string `json:"summary"`
}

Detection is one installation found on disk.

type Env

type Env interface {
	ProviderExists(id string) bool
	SkillExists(name string) bool
	MCPServerExists(name string) bool
	RoleExists(name string) bool
	// ChannelConfigured reports whether gateway.<platform> already has a
	// token set ("telegram", "discord", "slack", "matrix", "signal",
	// "whatsapp", "feishu").
	ChannelConfigured(platform string) bool
	// TextFileState returns "missing", "default" (the shipped placeholder)
	// or "custom" for SOUL.md / AGENTS.md / USER.md.
	TextFileState(cat Category) string
}

Env is what a source may consult while planning: the current Antares state (to mark conflicts) without importing the server.

type Item

type Item struct {
	// ID is stable for a given source state: "<category>:<key>", e.g.
	// "provider:openrouter", "skill:web-research", "memory:7".
	ID       string   `json:"id"`
	Category Category `json:"category"`
	// Title is the one-line label ("OpenRouter", "Telegram bot @mybot").
	Title string `json:"title"`
	// Detail is an optional second line ("3 models · key from .env").
	Detail string `json:"detail,omitempty"`
	Status Status `json:"status"`
	// Reason explains a conflict, a needed input or why it is unsupported.
	Reason string `json:"reason,omitempty"`
	// Input, for StatusNeedsInput, names the field the user must fill
	// ("api_key"); the UI renders a password field for keys.
	Input string `json:"input,omitempty"`
	// Secret marks an item carrying a credential; the API never returns the
	// value, only that one exists.
	Secret bool `json:"secret,omitempty"`
	// Default selection in the UI: true for ready items, false otherwise.
	Selected bool `json:"selected"`

	// Payload is the data Apply writes; one of these is set, by category.
	// Never serialised to clients (secrets live here).
	Payload Payload `json:"-"`
}

Item is one thing to migrate.

func ChannelItem

func ChannelItem(env Env, platform, title string, fields map[string]any, missingInput string) Item

ChannelItem builds a chat-channel item. Unsupported platforms get a reason; a missing required field (missingInput, e.g. "bot_token") is needs_input; a platform Antares already has a token for is a conflict.

func CronItem

func CronItem(key string, c CronPayload, sourceEnabled bool) Item

CronItem builds a schedule item. The schedule must already be in Antares form; one cron.Parse rejects becomes unsupported. Imported jobs are always disabled (Enabled=false), whatever the source said.

func KnowledgeItem

func KnowledgeItem(env Env, relPath, content string) (Item, bool)

KnowledgeItem builds a RAG document item; unsupported when RAG is off.

func MCPItem

func MCPItem(env Env, m MCPPayload) Item

MCPItem builds an MCP server item; transport is normalised; a conflict when the name exists. Env/header values count as secrets.

func MemoryItems

func MemoryItems(entries []MemoryEntry, scope string, tags ...string) []Item

MemoryItems turns entries into memory items, deduped by content hash. tags are added to every entry (an entry's Heading is added as a tag too).

func ModelItem

func ModelItem(env Env, m ModelPayload) Item

ModelItem builds the default-model item; a conflict when Antares already has a working default (as reported by a DefaultModelChecker Env).

func OAuthProviderItem

func OAuthProviderItem(key, label string) Item

OAuthProviderItem lists a subscription login that must be redone in Antares.

func ProviderItem

func ProviderItem(env Env, p ProviderPayload, detail string) Item

ProviderItem builds a provider item. A missing key (for a kind that needs one and a non-local endpoint) is needs_input "api_key"; an existing id is a conflict unless the Env reports identical base URL and key (then ready, and Apply makes it a no-op).

func RoleItem

func RoleItem(env Env, r RolePayload) Item

RoleItem builds a role item; a conflict when the name exists (including a built-in role of the same name).

func SkillItem

func SkillItem(env Env, s SkillDir) Item

SkillItem builds a skill item; a conflict when Antares has the name.

func TextItem

func TextItem(env Env, cat Category, content, from string) (Item, bool)

TextItem builds a soul / agents_md / user_md item; a conflict when the current Antares file is custom. Empty content yields ok=false.

func UnsupportedItem

func UnsupportedItem(cat Category, key, title, reason string) Item

UnsupportedItem is an item that is listed but never applied.

type ItemFailure

type ItemFailure struct {
	ID    string `json:"id"`
	Error string `json:"error"`
}

type Keychain

type Keychain interface {
	Get(service, account string) (string, error)
}

Keychain reads a secret another agent keeps in the OS keychain (macOS Keychain, Windows Credential Manager, Secret Service on Linux). Reading may show the OS's own access prompt; that prompt is the user's consent.

var DefaultKeychain Keychain = OSKeychain{}

DefaultKeychain is the keychain sources read when planning. Tests replace it.

type KnowledgePayload

type KnowledgePayload struct {
	Path    string // source path, for the RAG doc id and meta
	Content string
}

type MCPPayload

type MCPPayload struct {
	Name      string
	Transport string // "stdio" or "http"
	Command   string
	Args      []string
	Env       map[string]string
	URL       string
	Headers   map[string]string
}

type Manifest

type Manifest struct {
	Version   int       `json:"version"`
	Source    string    `json:"source"`
	Profile   string    `json:"profile,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	Undone    bool      `json:"undone,omitempty"`
	Applied   []string  `json:"applied"`
	// Restore lists files/dirs Apply modified that existed before; each has a
	// copy under the backup dir (Backup is relative to it).
	Restore []BackupEntry `json:"restore,omitempty"`
	// CreatedPaths are files/dirs Apply created; Undo removes them.
	CreatedPaths []string `json:"created_paths,omitempty"`
	Memories     []string `json:"memories,omitempty"`
	CronJobs     []string `json:"cron_jobs,omitempty"`
	RAGDocs      []RAGRef `json:"rag_docs,omitempty"`
}

Manifest records what one Apply changed, so Undo can reverse it. It never holds secret values: only ids, paths and names.

type MemoryEntry

type MemoryEntry struct {
	Content string
	// Heading is the nearest Markdown heading above the entry, if any; useful
	// as a tag.
	Heading string
}

MemoryEntry is one fact split out of a memory file.

func SplitBySeparator

func SplitBySeparator(text, sep string) []MemoryEntry

SplitBySeparator splits text on sep, trimming entries and dropping empty ones. Line endings are normalised to \n first.

func SplitMarkdownEntries

func SplitMarkdownEntries(text string) []MemoryEntry

SplitMarkdownEntries splits a Markdown memory file into entries:

  • each top-level bullet ("- ", "* ", "+ ", "1. ") with its indented continuation lines is one entry, and each plain paragraph (blank-line separated) is one entry;
  • a lead line ending with ":" or ":" ("Key rules:") is grouped with the bullets and code blocks that follow it into one entry;
  • fenced code blocks are kept whole;
  • headings are not entries; they become the Heading of the entries beneath them. Front matter and HTML comments are skipped;
  • entries that are only a code fence, a lone label, or have fewer than ~12 meaningful characters (letters and digits; CJK counts 1.5) are dropped.

func SplitMemory

func SplitMemory(text, sep string) []MemoryEntry

SplitMemory splits memory text by sep when non-empty, else by Markdown bullets/paragraphs (SplitMarkdownEntries).

type MemoryPayload

type MemoryPayload struct {
	Scope   string // "global" or "user"
	Key     string
	Content string
	Tags    []string
}

type ModelPayload

type ModelPayload struct {
	Provider string // Antares provider id (after rename resolution)
	Model    string
	Fallback []string
}

type MultiDetector

type MultiDetector interface {
	DetectAll(ctx context.Context, root string) ([]Detection, error)
}

MultiDetector is an optional Source extension for agents that can have several installs side by side (Hermes profiles, OpenClaw agents). DetectAll prefers it over Detect; each Detection's Profile tells them apart, and Plan receives the chosen one.

type OSKeychain

type OSKeychain struct{}

OSKeychain is the real keychain. Sources take a Keychain so tests can pass a fake; DefaultKeychain is what the API and CLI use.

func (OSKeychain) Get

func (OSKeychain) Get(service, account string) (string, error)

type Payload

type Payload struct {
	Provider  *ProviderPayload
	Model     *ModelPayload
	Text      *TextPayload // soul, agents_md, user_md
	Memory    *MemoryPayload
	Knowledge *KnowledgePayload
	Skill     *SkillPayload
	MCP       *MCPPayload
	Cron      *CronPayload
	Channel   *ChannelPayload
	Role      *RolePayload
}

Payload carries the concrete values for an item.

type Plan

type Plan struct {
	Detection Detection `json:"detection"`
	Items     []Item    `json:"items"`
	// Warnings that are not about one item (e.g. "Hermes is running — stop
	// it before importing its Telegram token").
	Warnings []string `json:"warnings,omitempty"`
}

Plan is everything a source would bring over.

func BuildPlan

func BuildPlan(ctx context.Context, id, root, profile string, env Env) (Plan, error)

BuildPlan detects source id (at root, or its default locations) and plans the install matching profile ("" = the default/first one).

type ProviderMatcher

type ProviderMatcher interface {
	ProviderMatches(id, baseURL, apiKey string) bool
}

ProviderMatcher reports whether provider id already holds exactly this base URL and key, so re-importing it is a no-op rather than a conflict.

type ProviderPayload

type ProviderPayload struct {
	ID      string // proposed Antares provider id
	Label   string
	Kind    string // an Antares provider kind (openai-compatible, anthropic, gemini, codex, openai, …)
	BaseURL string
	APIKey  string
	Headers map[string]string
	Models  []string
}

type RAGChecker

type RAGChecker interface {
	RAGEnabled() bool
}

RAGChecker reports whether RAG is enabled, so knowledge items can be marked unsupported ("RAG is off") at plan time.

type RAGRef

type RAGRef struct {
	Collection string `json:"collection"`
	DocID      string `json:"doc_id"`
}

RAGRef is one imported RAG document.

type Report

type Report struct {
	Source  string        `json:"source"`
	Backup  string        `json:"backup"` // backup dir, for undo
	Applied []string      `json:"applied"`
	Skipped []string      `json:"skipped"`
	Failed  []ItemFailure `json:"failed,omitempty"`
	// NeedsRestart is true when the gateway or MCP changed and a reload is
	// needed for them to take effect (the server applies it itself).
	NeedsRestart bool `json:"needs_restart"`
}

Report is the outcome of Apply.

func Apply

func Apply(ctx context.Context, plan Plan, choices []Choice, deps Deps) (Report, error)

Apply writes the chosen items of plan into Antares, after backing up what it will change. Only items named in choices are considered; unsupported items, conflicts without a resolution (or with "skip") and needs_input items without input are skipped. The config file is written once at the end. The caller reloads the server afterwards.

type Resolution

type Resolution string

Resolution chooses what Apply does with a conflicting item.

const (
	ResolveSkip    Resolution = "skip"    // keep what Antares has (default)
	ResolveReplace Resolution = "replace" // overwrite it
	ResolveRename  Resolution = "rename"  // add beside it under a new id/name (providers, skills, MCP, roles)
	ResolveAppend  Resolution = "append"  // text files only: add the imported text under a heading
)

type RolePayload

type RolePayload struct {
	Name    string
	Title   string
	Summary string
	Prompt  string
	Model   string
}

type SkillDir

type SkillDir struct {
	Name        string // from front matter "name", else the folder name; sanitised
	Description string
	Dir         string // absolute folder path
	Category    string // parent folder relative to the scan root ("" at top level)
}

SkillDir is one folder holding a SKILL.md.

func ScanSkills

func ScanSkills(root string, maxDepth int) []SkillDir

ScanSkills finds SKILL.md folders under root, up to maxDepth levels deep (Hermes uses skills/<category>/<name>/SKILL.md, so 2; flat layouts need 1). Hidden folders and node_modules are skipped, and a skill folder's own subfolders are not searched. On a name clash the first found (sorted by path) wins. Missing root yields nil.

type SkillPayload

type SkillPayload struct {
	Name string
	Dir  string // the source SKILL.md folder, copied whole
}

type Source

type Source interface {
	// ID is the stable identifier used in the API and CLI: "hermes",
	// "openclaw", "nanobot", "picoclaw", "cowagent", "qwenpaw", "letta",
	// "zeroclaw", "nanoclaw", "openhuman".
	ID() string
	// Name is the display name ("Hermes Agent").
	Name() string
	// Detect looks for the agent's data under the default locations (or at
	// root when non-empty) and returns what it found. It only stats and
	// reads small config files; it never decrypts or prompts.
	Detect(ctx context.Context, root string) (Detection, error)
	// Plan reads the source at det.Root and returns every item it would
	// migrate. It may decrypt secrets (which can trigger an OS keychain
	// prompt — that prompt is the user's consent); it never writes.
	Plan(ctx context.Context, det Detection, env Env) (Plan, error)
}

Source is one agent Antares can migrate from. Implementations live in source_<id>.go and register themselves in init via Register.

func Lookup

func Lookup(id string) (Source, bool)

Lookup finds a source by id.

func Sources

func Sources() []Source

Sources returns the registered sources in registration order.

type SourceInfo

type SourceInfo struct {
	ID       string      `json:"id"`
	Name     string      `json:"name"`
	Detected []Detection `json:"detected"`
}

SourceInfo is one registered source with what was found on disk.

func DetectAll

func DetectAll(ctx context.Context) []SourceInfo

DetectAll runs every registered source's detection at its default locations. A source that is not installed (ErrNotFound, any other error, or an empty Root) gets an empty Detected list; detection never fails the whole listing.

type StateEnv

type StateEnv struct {
	// contains filtered or unexported fields
}

StateEnv is the real Env: it answers from the Antares config, the skill and role directories and the persona files under the Antares home. Build it with NewEnv right before planning so conflicts reflect the current state.

func NewEnv

func NewEnv(cfg *config.Config) *StateEnv

NewEnv snapshots the Antares state from cfg (nil means load it).

func (*StateEnv) ChannelConfigured

func (e *StateEnv) ChannelConfigured(platform string) bool

func (*StateEnv) HasDefaultModel

func (e *StateEnv) HasDefaultModel() bool

HasDefaultModel implements DefaultModelChecker: a default model whose provider has a key, is local, or takes credentials from the environment.

func (*StateEnv) MCPServerExists

func (e *StateEnv) MCPServerExists(name string) bool

func (*StateEnv) ProviderExists

func (e *StateEnv) ProviderExists(id string) bool

ProviderExists reports a configured provider. A keyless placeholder entry (the defaults ship catalogue providers without keys) does not count: the import simply fills it in.

func (*StateEnv) ProviderMatches

func (e *StateEnv) ProviderMatches(id, baseURL, apiKey string) bool

ProviderMatches implements ProviderMatcher.

func (*StateEnv) RAGEnabled

func (e *StateEnv) RAGEnabled() bool

RAGEnabled implements RAGChecker.

func (*StateEnv) RoleExists

func (e *StateEnv) RoleExists(name string) bool

func (*StateEnv) SkillExists

func (e *StateEnv) SkillExists(name string) bool

func (*StateEnv) TextFileState

func (e *StateEnv) TextFileState(cat Category) string

type Status

type Status string

Status says whether an item can be applied as is.

const (
	// StatusReady applies without further input.
	StatusReady Status = "ready"
	// StatusConflict means Antares already has something in this place (a
	// provider with this id, a skill with this name, a configured Telegram
	// bot, a non-default SOUL.md). Apply needs a Resolution for it.
	StatusConflict Status = "conflict"
	// StatusNeedsInput means a value is missing and the user must supply it
	// (Input), e.g. a key that could not be read or decrypted.
	StatusNeedsInput Status = "needs_input"
	// StatusUnsupported cannot be migrated (a channel Antares has no gateway
	// for, an OAuth login, a one-shot schedule). Shown with the reason; never
	// applied.
	StatusUnsupported Status = "unsupported"
)

type TextPayload

type TextPayload struct {
	Content string
	// From names the source file(s) for the heading used on append.
	From string
}

type VendorInfo

type VendorInfo struct {
	ID      string // Antares provider id (a catalogue id where one exists)
	Label   string
	Kind    string // Antares provider kind
	BaseURL string // default endpoint; empty means the kind's own default
	// OAuth marks a subscription/OAuth login that cannot be migrated as a key.
	OAuth bool
}

VendorInfo is the Antares provider a source vendor name maps to.

func Vendor

func Vendor(name string) (VendorInfo, bool)

Vendor maps a source's provider/vendor name (case-insensitive; "_" and " " treated as "-") to an Antares provider.

func VendorByBaseURL

func VendorByBaseURL(baseURL string) (VendorInfo, bool)

VendorByBaseURL guesses the vendor from an endpoint's host, for sources that only store a base URL.

Jump to

Keyboard shortcuts

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