diff --git a/src/commands/cleanup-command.test-support.ts b/src/commands/cleanup-command.test-support.ts index 50f267965a1..27859039b65 100644 --- a/src/commands/cleanup-command.test-support.ts +++ b/src/commands/cleanup-command.test-support.ts @@ -3,7 +3,7 @@ import { createNonExitingRuntime, type RuntimeEnv } from "../runtime.js"; const resolveCleanupPlanFromDisk = vi.fn(); const removePath = vi.fn(); -const listAgentSessionStatePaths = vi.fn(); +const listAgentRuntimeStatePaths = vi.fn(); const removeStateAndLinkedPaths = vi.fn(); const removeWorkspaceDirs = vi.fn(); @@ -17,7 +17,7 @@ vi.mock("./cleanup-plan.js", () => ({ vi.mock("./cleanup-utils.js", () => ({ removePath, - listAgentSessionStatePaths, + listAgentRuntimeStatePaths, removeStateAndLinkedPaths, removeWorkspaceDirs, })); @@ -37,7 +37,7 @@ export function resetCleanupCommandMocks() { workspaceDirs: ["/tmp/.openclaw/workspace"], }); removePath.mockResolvedValue({ ok: true }); - listAgentSessionStatePaths.mockResolvedValue([ + listAgentRuntimeStatePaths.mockResolvedValue([ "/tmp/.openclaw/agents/main/sessions", "/tmp/.openclaw/agents/main/agent/openclaw-agent.sqlite", ]); diff --git a/src/commands/cleanup-utils.ts b/src/commands/cleanup-utils.ts index cf669c63c68..c23ca2ed270 100644 --- a/src/commands/cleanup-utils.ts +++ b/src/commands/cleanup-utils.ts @@ -140,7 +140,7 @@ export async function removeWorkspaceDirs( } } -export async function listAgentSessionStatePaths(stateDir: string): Promise { +export async function listAgentRuntimeStatePaths(stateDir: string): Promise { const root = path.join(stateDir, "agents"); try { const entries = await fs.readdir(root, { withFileTypes: true }); diff --git a/src/commands/onboard-helpers.ts b/src/commands/onboard-helpers.ts index bc911fcabd2..9e234ca5e52 100644 --- a/src/commands/onboard-helpers.ts +++ b/src/commands/onboard-helpers.ts @@ -22,7 +22,7 @@ import { normalizeOptionalString } from "../shared/string-coerce.js"; import { stylePromptTitle } from "../terminal/prompt-style.js"; import { resolveConfigDir, shortenHomeInString, shortenHomePath, sleep } from "../utils.js"; import { VERSION } from "../version.js"; -import { listAgentSessionStatePaths } from "./cleanup-utils.js"; +import { listAgentRuntimeStatePaths } from "./cleanup-utils.js"; import type { NodeManagerChoice, OnboardMode, ResetScope } from "./onboard-types.js"; export { randomToken } from "./random-token.js"; @@ -212,7 +212,7 @@ export async function handleReset(scope: ResetScope, workspaceDir: string, runti return; } await moveToTrash(path.join(resolveConfigDir(), "credentials"), runtime); - for (const target of await listAgentSessionStatePaths(resolveStateDir())) { + for (const target of await listAgentRuntimeStatePaths(resolveStateDir())) { await moveToTrash(target, runtime); } if (scope === "full") { diff --git a/src/commands/reset.ts b/src/commands/reset.ts index f95fd9f6818..33cf802ab14 100644 --- a/src/commands/reset.ts +++ b/src/commands/reset.ts @@ -7,7 +7,7 @@ import { selectStyled } from "../terminal/prompt-select-styled.js"; import { stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js"; import { resolveCleanupPlanFromDisk } from "./cleanup-plan.js"; import { - listAgentSessionStatePaths, + listAgentRuntimeStatePaths, removePath, removeStateAndLinkedPaths, removeWorkspaceDirs, @@ -130,8 +130,8 @@ export async function resetCommand(runtime: RuntimeEnv, opts: ResetOptions) { if (scope === "config+creds+sessions") { await removePath(configPath, runtime, { dryRun, label: configPath }); await removePath(oauthDir, runtime, { dryRun, label: oauthDir }); - const sessionPaths = await listAgentSessionStatePaths(stateDir); - for (const target of sessionPaths) { + const runtimeStatePaths = await listAgentRuntimeStatePaths(stateDir); + for (const target of runtimeStatePaths) { await removePath(target, runtime, { dryRun, label: target }); } runtime.log(`Next: ${formatCliCommand("openclaw onboard --install-daemon")}`);