importer

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 12 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

MCP server migration. Both Hermes (config.yaml mcp_servers) and OpenClaw (openclaw.json mcp.servers) configure MCP servers with the same essential shape memcode's .mcp.json uses — command/args/env for stdio, url for remote — so they carry straight over into the user scope. Fields memcode doesn't have a home for (cwd, per-server tool include/exclude filters) become notes, never silent drops.

Package importer migrates an existing OpenClaw configuration into memcode's gateway config. OpenClaw is the large incumbent multi-channel gateway; letting a user bring their channels over with one command is how you win a switch without making them reconfigure everything. It reads OpenClaw's plain-JSON openclaw.json (parsed with encoding/json, the same way OpenClaw and Hermes read it), maps each supported channel's credentials to memcode's .env keys and its allow-list to our channels.<name>.allow_from, and reports (never silently drops) anything it can't carry.

Cron-job migration. Hermes persists jobs at ~/.hermes/cron/jobs.json in a documented shape that maps cleanly onto our schedules (its deliver target is literally our deliver_to format). OpenClaw's current versions keep jobs in an internal SQLite database whose schema is not published — guessing at it would produce silently wrong migrations, so those get an explicit recreate note — but its legacy ~/.openclaw/cron/jobs.json is parseable and carried over. Anything that can't be carried (script payloads, skill-injected jobs) becomes a note, never a silent drop.

Tool-policy migration. The engine's policy compiler (internal/agent/tools) natively accepts OpenClaw tool IDs, Hermes toolset names, group: refs, and trailing-* wildcards as aliases for memcode's canonical names — so source entries carry over VERBATIM when they resolve, keeping the user's own vocabulary in their gateway.yaml. Entries that resolve to nothing become notes; profiles and per-sender overrides have no equivalent and are noted, never guessed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HermesMCPServers added in v0.21.0

func HermesMCPServers(configYAML []byte) (map[string]mcp.ServerConfig, []string)

HermesMCPServers reads the mcp_servers block of a Hermes config.yaml.

func HermesSchedules added in v0.20.0

func HermesSchedules(data []byte) ([]gwconfig.Schedule, []string)

HermesSchedules reads a Hermes cron jobs.json and maps each job to a memcode schedule. Completed one-shots are skipped (they already ran); paused/disabled jobs carry over disabled so nothing starts firing that wasn't firing before.

func HermesToolPolicy added in v0.23.0

func HermesToolPolicy(configYAML []byte) (allow, disabled, notes []string)

HermesToolPolicy reads a Hermes config.yaml's tool restrictions: the top-level toolsets: allow-list (its "all" alias means unrestricted) and agent.disabled_toolsets.

func ImportHermesSchedules added in v0.20.0

func ImportHermesSchedules(dir string) ([]gwconfig.Schedule, []string)

ImportHermesSchedules finds Hermes cron jobs under dir (~/.hermes).

func ImportOpenClawSchedules added in v0.20.0

func ImportOpenClawSchedules(dir string) ([]gwconfig.Schedule, []string)

ImportOpenClawSchedules finds OpenClaw cron jobs under dir: the legacy cron/jobs.json is migrated; a jobs database (current versions) can't be read safely, so it becomes an explicit instruction instead of a silent gap.

func OpenClawMCPServers added in v0.21.0

func OpenClawMCPServers(data []byte) (map[string]mcp.ServerConfig, []string)

OpenClawMCPServers reads the mcp.servers block of an openclaw.json.

func OpenClawSchedules added in v0.20.0

func OpenClawSchedules(data []byte) ([]gwconfig.Schedule, []string)

OpenClawSchedules reads a legacy OpenClaw cron jobs.json. Current OpenClaw versions store jobs in an internal database instead; ImportOpenClawSchedules handles detecting that and telling the user what to do.

func OpenClawToolPolicy added in v0.23.0

func OpenClawToolPolicy(data []byte) (allow, disabled, notes []string)

OpenClawToolPolicy reads the global tools.profile/allow/deny of an openclaw.json.

func ParseEnv

func ParseEnv(data []byte) map[string]string

ParseEnv reads a .env file's KEY=VALUE lines into a map, ignoring blanks, comments, and an optional "export " prefix. Used to lift tokens out of a Hermes ~/.hermes/.env for import.

func ProviderKeys

func ProviderKeys(env map[string]string) map[string]string

ProviderKeys returns the subset of env holding a recognized provider API key with a non-empty value — what a migration should copy into memcode's global .env so the agent keeps talking to the same models. Channel bot tokens are NOT here; those come from the channel importer.

Types

type Result

type Result struct {
	Settings gwconfig.Settings
	Secrets  map[string]string
	Notes    []string
}

Result is what an import produced: the non-secret settings to merge into gateway.yaml, the secrets to write to the global .env, and human-readable notes about anything that couldn't be carried automatically.

func FromHermes

func FromHermes(configYAML []byte, env map[string]string) (Result, error)

FromHermes maps a Hermes config.yaml plus its .env (parsed to env) into memcode's gateway config. Hermes and memcode share the same credential variable names, so tokens carry over directly; allowed_users becomes channels.<name>.allow_from.

func FromOpenClaw

func FromOpenClaw(data []byte, getenv func(string) string) (Result, error)

FromOpenClaw parses an OpenClaw config and maps it to memcode's gateway config. getenv resolves env-backed secret references (OpenClaw stores a reference, not the value); pass os.Getenv in production.

Jump to

Keyboard shortcuts

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