diff --git a/src/auto-reply/reply/session.test.ts b/src/auto-reply/reply/session.test.ts index 7dc7adc1213..c43667e29e4 100644 --- a/src/auto-reply/reply/session.test.ts +++ b/src/auto-reply/reply/session.test.ts @@ -2036,8 +2036,6 @@ describe("initSessionState reset triggers in WhatsApp groups", () => { const storePath = await createStorePath("openclaw-group-activation-backfill-"); await writeSessionStoreFast(storePath, { [sessionKey]: { - sessionId: "activation-only", - updatedAt: 0, groupActivation: "always", }, }); diff --git a/src/channels/plugins/bundled.shape-guard.test.ts b/src/channels/plugins/bundled.shape-guard.test.ts index fd442efb6f0..31637bebde1 100644 --- a/src/channels/plugins/bundled.shape-guard.test.ts +++ b/src/channels/plugins/bundled.shape-guard.test.ts @@ -187,7 +187,6 @@ afterEach(() => { vi.doUnmock("../../plugins/manifest-registry.js"); vi.doUnmock("../../plugins/channel-catalog-registry.js"); vi.doUnmock("../../infra/boundary-file-read.js"); - vi.doUnmock("./bundled-root.js"); vi.doUnmock("jiti"); }); @@ -576,63 +575,6 @@ describe("bundled channel entry shape guards", () => { } }); - it("uses dist-runtime as the boundary root for packaged setup entries", async () => { - const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-bundled-runtime-root-")); - const pluginDir = path.join(root, "dist-runtime", "extensions", "alpha"); - fs.mkdirSync(pluginDir, { recursive: true }); - fs.writeFileSync( - path.join(pluginDir, "setup-entry.js"), - [ - "export default {", - " kind: 'bundled-channel-setup-entry',", - " loadSetupPlugin() {", - " return {", - " id: 'alpha',", - " meta: { id: 'alpha', label: 'Setup dist-runtime' },", - " capabilities: {},", - " config: {},", - " };", - " },", - "};", - "", - ].join("\n"), - "utf8", - ); - - vi.doMock("./bundled-root.js", () => ({ - resolveBundledChannelRootScope: () => ({ - packageRoot: root, - cacheKey: `${root}:dist-runtime`, - }), - })); - vi.doMock("../../plugins/bundled-channel-runtime.js", () => ({ - listBundledChannelPluginMetadata: () => [alphaChannelMetadata({ includeSetup: true })], - resolveBundledChannelGeneratedPath: ( - rootDir: string, - entry: BundledEntrySource | undefined, - pluginDirName?: string, - ) => - path.join( - rootDir, - "dist-runtime", - "extensions", - pluginDirName ?? "alpha", - (entry?.built ?? entry?.source ?? "./index.js").replace(/^\.\//u, ""), - ), - })); - - try { - const bundled = await importFreshModule( - import.meta.url, - "./bundled.js?scope=bundled-dist-runtime-boundary", - ); - - expect(bundled.getBundledChannelSetupPlugin("alpha")?.meta.label).toBe("Setup dist-runtime"); - } finally { - fs.rmSync(root, { recursive: true, force: true }); - } - }); - it("loads setup-entry feature plugins without loading the main channel entry", async () => { const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-bundled-setup-only-")); const previousBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; diff --git a/src/channels/plugins/bundled.ts b/src/channels/plugins/bundled.ts index 0858f762121..4d7f3a10447 100644 --- a/src/channels/plugins/bundled.ts +++ b/src/channels/plugins/bundled.ts @@ -1,7 +1,6 @@ import path from "node:path"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { formatErrorMessage } from "../../infra/errors.js"; -import { isPathInside } from "../../infra/path-guards.js"; import { createSubsystemLogger } from "../../logging/subsystem.js"; import type { BundledChannelLegacySessionSurface, @@ -161,26 +160,20 @@ function resolveBundledChannelBoundaryRoot(params: { metadata: BundledChannelPluginMetadata; modulePath: string; }): string { - const isModuleUnderRoot = (root: string) => isPathInside(path.resolve(root), params.modulePath); const overrideRoot = params.pluginsDir ? path.resolve(params.pluginsDir, params.metadata.dirName) : null; - if (overrideRoot && isModuleUnderRoot(overrideRoot)) { + if ( + overrideRoot && + (params.modulePath === overrideRoot || + params.modulePath.startsWith(`${overrideRoot}${path.sep}`)) + ) { return overrideRoot; } const distRoot = path.resolve(params.packageRoot, "dist", "extensions", params.metadata.dirName); - if (isModuleUnderRoot(distRoot)) { + if (params.modulePath === distRoot || params.modulePath.startsWith(`${distRoot}${path.sep}`)) { return distRoot; } - const distRuntimeRoot = path.resolve( - params.packageRoot, - "dist-runtime", - "extensions", - params.metadata.dirName, - ); - if (isModuleUnderRoot(distRuntimeRoot)) { - return distRuntimeRoot; - } return path.resolve(params.packageRoot, "extensions", params.metadata.dirName); } diff --git a/src/commands/doctor-heartbeat-session-target.test.ts b/src/commands/doctor-heartbeat-session-target.test.ts index f310aecb873..79e0863b6f5 100644 --- a/src/commands/doctor-heartbeat-session-target.test.ts +++ b/src/commands/doctor-heartbeat-session-target.test.ts @@ -68,7 +68,7 @@ describe("describeHeartbeatSessionTargetIssues", () => { const cfg = cfgWithSession("agent:ops:main"); writeStore(cfg, { "agent:ops:work": { - sessionId: "agent-ops-work", + sessionId: "agent:ops:work", updatedAt: Date.now(), }, }); diff --git a/src/plugins/bundled-plugin-metadata.test.ts b/src/plugins/bundled-plugin-metadata.test.ts index 6e947aef992..b7e43f067f3 100644 --- a/src/plugins/bundled-plugin-metadata.test.ts +++ b/src/plugins/bundled-plugin-metadata.test.ts @@ -631,22 +631,6 @@ describe("bundled plugin metadata", () => { expectGeneratedPathResolution(tempRoot, path.join("dist", "extensions", "plugin", "index.js")); }); - it("uses dist-runtime generated paths before source fallback when packaged dist is absent", () => { - const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-runtime-metadata-"); - const pluginRoot = path.join(tempRoot, "extensions", "plugin"); - const runtimePluginRoot = path.join(tempRoot, "dist-runtime", "extensions", "plugin"); - - fs.mkdirSync(pluginRoot, { recursive: true }); - fs.mkdirSync(runtimePluginRoot, { recursive: true }); - fs.writeFileSync(path.join(pluginRoot, "index.ts"), "export {};\n", "utf8"); - fs.writeFileSync(path.join(runtimePluginRoot, "index.js"), "export {};\n", "utf8"); - - expectGeneratedPathResolution( - tempRoot, - path.join("dist-runtime", "extensions", "plugin", "index.js"), - ); - }); - it("resolves plugin-local generated entry paths when the plugin dir is provided", () => { const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-metadata-local-"); const pluginRoot = path.join(tempRoot, "extensions", "alpha"); diff --git a/src/plugins/bundled-plugin-metadata.ts b/src/plugins/bundled-plugin-metadata.ts index a84f19a7d03..9cc4c625d9d 100644 --- a/src/plugins/bundled-plugin-metadata.ts +++ b/src/plugins/bundled-plugin-metadata.ts @@ -231,7 +231,6 @@ function listBundledPluginEntryBaseDirs(params: { const baseDirs = [ ...(params.scanDir ? [path.resolve(params.scanDir, params.pluginDirName ?? "")] : []), path.resolve(params.rootDir, "dist", "extensions", params.pluginDirName ?? ""), - path.resolve(params.rootDir, "dist-runtime", "extensions", params.pluginDirName ?? ""), path.resolve(params.rootDir, "extensions", params.pluginDirName ?? ""), ]; return baseDirs.filter((entry, index, all) => all.indexOf(entry) === index);