diff --git a/src/channels/plugins/contracts/inbound.contract.test.ts b/src/channels/plugins/contracts/inbound.contract.test.ts index 9fa108bcb72..90c4ff61722 100644 --- a/src/channels/plugins/contracts/inbound.contract.test.ts +++ b/src/channels/plugins/contracts/inbound.contract.test.ts @@ -38,8 +38,8 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => { }; }); -vi.mock("openclaw/plugin-sdk/channel-runtime", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, recordInboundSession: vi.fn(async (params: { ctx: MsgContext }) => { diff --git a/src/cli/command-secret-resolution.coverage.test.ts b/src/cli/command-secret-resolution.coverage.test.ts index 362bd3b0b55..5614d21cbf8 100644 --- a/src/cli/command-secret-resolution.coverage.test.ts +++ b/src/cli/command-secret-resolution.coverage.test.ts @@ -18,6 +18,14 @@ async function readCommandSource(relativePath: string): Promise { const absolutePath = path.join(process.cwd(), relativePath); const source = await fs.readFile(absolutePath, "utf8"); const reexportMatch = source.match(/^export \* from "(?[^"]+)";$/m)?.groups?.target; + const runtimeImportMatch = source.match(/import\("(?\.[^"]+\.runtime\.js)"\)/m)?.groups + ?.target; + if (runtimeImportMatch) { + const resolvedTarget = path.join(path.dirname(absolutePath), runtimeImportMatch); + const tsResolvedTarget = resolvedTarget.replace(/\.js$/u, ".ts"); + const runtimeSource = await fs.readFile(tsResolvedTarget, "utf8"); + return `${source}\n${runtimeSource}`; + } if (!reexportMatch) { return source; } diff --git a/src/cli/update-cli.test.ts b/src/cli/update-cli.test.ts index 0cd409fa1c5..e5351553d6b 100644 --- a/src/cli/update-cli.test.ts +++ b/src/cli/update-cli.test.ts @@ -1,6 +1,6 @@ -import { Command } from "commander"; import fs from "node:fs/promises"; import path from "node:path"; +import { Command } from "commander"; import { beforeEach, describe, expect, it, vi } from "vitest"; import type { OpenClawConfig, ConfigFileSnapshot } from "../config/types.openclaw.js"; import type { UpdateRunResult } from "../infra/update-runner.js"; diff --git a/src/config/sessions/targets.test.ts b/src/config/sessions/targets.test.ts index 43674233a3a..8355c221667 100644 --- a/src/config/sessions/targets.test.ts +++ b/src/config/sessions/targets.test.ts @@ -4,6 +4,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; import { withTempHome } from "../../../test/helpers/temp-home.js"; import type { OpenClawConfig } from "../config.js"; +import { resolveStorePath } from "./paths.js"; import { resolveAllAgentSessionStoreTargets, resolveAllAgentSessionStoreTargetsSync, @@ -91,15 +92,11 @@ describe("resolveSessionStoreTargets", () => { expect(targets).toEqual([ { agentId: "main", - storePath: path.resolve( - path.join(process.env.HOME ?? "", ".openclaw/agents/main/sessions/sessions.json"), - ), + storePath: resolveStorePath(cfg.session?.store, { agentId: "main", env: process.env }), }, { agentId: "work", - storePath: path.resolve( - path.join(process.env.HOME ?? "", ".openclaw/agents/work/sessions/sessions.json"), - ), + storePath: resolveStorePath(cfg.session?.store, { agentId: "work", env: process.env }), }, ]); }); diff --git a/src/plugins/conversation-binding.test.ts b/src/plugins/conversation-binding.test.ts index 594c183d0d8..6bea2d21819 100644 --- a/src/plugins/conversation-binding.test.ts +++ b/src/plugins/conversation-binding.test.ts @@ -34,7 +34,6 @@ function createEmptyPluginRegistry(): PluginRegistry { diagnostics: [], }; } - const sessionBindingState = vi.hoisted(() => { const records = new Map(); let nextId = 1; diff --git a/src/plugins/source-display.test.ts b/src/plugins/source-display.test.ts index 6d1b3da7719..b925fc0f670 100644 --- a/src/plugins/source-display.test.ts +++ b/src/plugins/source-display.test.ts @@ -69,6 +69,7 @@ describe("formatPluginSourceForTable", () => { { OPENCLAW_BUNDLED_PLUGINS_DIR: path.join(ignoredHome, "ignored-bundled"), OPENCLAW_STATE_DIR: path.join(ignoredHome, "ignored-state"), + OPENCLAW_HOME: undefined, HOME: ignoredHome, }, () => @@ -76,6 +77,7 @@ describe("formatPluginSourceForTable", () => { env: { ...process.env, HOME: homeDir, + OPENCLAW_HOME: undefined, OPENCLAW_BUNDLED_PLUGINS_DIR: "~/bundled", OPENCLAW_STATE_DIR: "~/state", },