mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:20:43 +00:00
* feat: add migration providers * feat: offer Hermes migration during onboarding * feat(hermes): map imported config surfaces * feat(onboard): require fresh migration imports * docs(cli): clarify Hermes import coverage * chore(migrations): rename Hermes importer package * chore(migrations): rewire Hermes importer id * fix(migrations): redact migration JSON details * fix(hermes): use provider runtime for config imports * test(hermes): cover missing source planning --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
31 lines
973 B
TypeScript
31 lines
973 B
TypeScript
import path from "node:path";
|
|
import {
|
|
resolveAgentConfig,
|
|
resolveAgentWorkspaceDir,
|
|
resolveDefaultAgentId,
|
|
} from "openclaw/plugin-sdk/agent-runtime";
|
|
import type { MigrationProviderContext } from "openclaw/plugin-sdk/plugin-entry";
|
|
import { resolveHomePath } from "./helpers.js";
|
|
|
|
export type PlannedTargets = {
|
|
workspaceDir: string;
|
|
stateDir: string;
|
|
agentDir: string;
|
|
};
|
|
|
|
export function resolveTargets(ctx: MigrationProviderContext): PlannedTargets {
|
|
const cfg = ctx.config;
|
|
const agentId = resolveDefaultAgentId(cfg);
|
|
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
const configuredAgentDir = resolveAgentConfig(cfg, agentId)?.agentDir?.trim();
|
|
const agentDir =
|
|
ctx.runtime?.agent?.resolveAgentDir(cfg, agentId) ??
|
|
(configuredAgentDir ? resolveHomePath(configuredAgentDir) : undefined) ??
|
|
path.join(ctx.stateDir, "agents", agentId, "agent");
|
|
return {
|
|
workspaceDir,
|
|
stateDir: ctx.stateDir,
|
|
agentDir,
|
|
};
|
|
}
|