diff --git a/src/plugin-sdk/channel-import-guardrails.test.ts b/src/channels/plugins/contracts/channel-import-guardrails.test.ts similarity index 99% rename from src/plugin-sdk/channel-import-guardrails.test.ts rename to src/channels/plugins/contracts/channel-import-guardrails.test.ts index d4539fcecee..6b84fa16487 100644 --- a/src/plugin-sdk/channel-import-guardrails.test.ts +++ b/src/channels/plugins/contracts/channel-import-guardrails.test.ts @@ -6,10 +6,10 @@ import { BUNDLED_PLUGIN_PATH_PREFIX, BUNDLED_PLUGIN_ROOT_DIR, bundledPluginFile, -} from "../../test/helpers/bundled-plugin-paths.js"; -import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../plugins/public-artifacts.js"; +} from "../../../../test/helpers/bundled-plugin-paths.js"; +import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../../../plugins/public-artifacts.js"; -const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../../.."); const REPO_ROOT = resolve(ROOT_DIR, ".."); const ALLOWED_EXTENSION_PUBLIC_SURFACES = new Set(GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES); ALLOWED_EXTENSION_PUBLIC_SURFACES.add("test-api.js"); diff --git a/src/plugin-sdk/plugin-entry-guardrails.test.ts b/src/plugins/contracts/plugin-entry-guardrails.test.ts similarity index 97% rename from src/plugin-sdk/plugin-entry-guardrails.test.ts rename to src/plugins/contracts/plugin-entry-guardrails.test.ts index 3866b18a653..5c9a9896ef1 100644 --- a/src/plugin-sdk/plugin-entry-guardrails.test.ts +++ b/src/plugins/contracts/plugin-entry-guardrails.test.ts @@ -5,9 +5,9 @@ import { describe, expect, it } from "vitest"; import { BUNDLED_PLUGIN_ROOT_DIR, bundledPluginFile, -} from "../../test/helpers/bundled-plugin-paths.js"; +} from "../../../test/helpers/bundled-plugin-paths.js"; -const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); const REPO_ROOT = resolve(ROOT_DIR, ".."); const EXTENSIONS_DIR = resolve(REPO_ROOT, BUNDLED_PLUGIN_ROOT_DIR); const CORE_PLUGIN_ENTRY_IMPORT_RE = diff --git a/src/plugins/contracts/plugin-sdk-index.bundle.test.ts b/src/plugins/contracts/plugin-sdk-index.bundle.test.ts index 7a9309f309e..acf5e00ff84 100644 --- a/src/plugins/contracts/plugin-sdk-index.bundle.test.ts +++ b/src/plugins/contracts/plugin-sdk-index.bundle.test.ts @@ -55,7 +55,7 @@ describe("plugin-sdk bundled exports", () => { neverBundle: ["@lancedb/lancedb", "@matrix-org/matrix-sdk-crypto-nodejs", "matrix-js-sdk"], }, // Full plugin-sdk coverage belongs to `pnpm build`, package contract - // guardrails, and `subpaths.test.ts`. This file only keeps the expensive + // guardrails, and `plugin-sdk-subpaths.test.ts`. This file only keeps the expensive // bundler path honest across representative entrypoint families plus the // Matrix SDK runtime import surface that historically crashed plugin // loading when bare and deep SDK entrypoints mixed. @@ -90,7 +90,7 @@ describe("plugin-sdk bundled exports", () => { expect(filesWithBareMatrixSdkImports).toEqual([]); // Export list and package-specifier coverage already live in - // package-contract-guardrails.test.ts and subpaths.test.ts. Keep this file + // plugin-sdk-package-contract-guardrails.test.ts and plugin-sdk-subpaths.test.ts. Keep this file // focused on the expensive part: can tsdown emit working bundle artifacts? const importResults = await Promise.all( bundledRepresentativeEntrypoints.map(async (entry) => [ diff --git a/src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts b/src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts index d32b0def4ed..81e6bfc38d0 100644 --- a/src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts +++ b/src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts @@ -12,7 +12,7 @@ const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); const REPO_ROOT = resolve(ROOT_DIR, ".."); const PUBLIC_CONTRACT_REFERENCE_FILES = [ "docs/plugins/architecture.md", - "src/plugin-sdk/subpaths.test.ts", + "src/plugins/contracts/plugin-sdk-subpaths.test.ts", ] as const; const PLUGIN_SDK_SUBPATH_PATTERN = /openclaw\/plugin-sdk\/([a-z0-9][a-z0-9-]*)\b/g; const NPM_PACK_MAX_BUFFER_BYTES = 64 * 1024 * 1024; diff --git a/src/plugin-sdk/runtime-api-guardrails.test.ts b/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts similarity index 99% rename from src/plugin-sdk/runtime-api-guardrails.test.ts rename to src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts index 00ef22ff32b..9aad0f8c38d 100644 --- a/src/plugin-sdk/runtime-api-guardrails.test.ts +++ b/src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts @@ -3,9 +3,9 @@ import { dirname, relative, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import ts from "typescript"; import { describe, expect, it } from "vitest"; -import { bundledPluginFile } from "../../test/helpers/bundled-plugin-paths.js"; +import { bundledPluginFile } from "../../../test/helpers/bundled-plugin-paths.js"; -const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); const RUNTIME_API_EXPORT_GUARDS: Record = { [bundledPluginFile("discord", "runtime-api.ts")]: [ diff --git a/src/plugin-sdk/subpaths.test.ts b/src/plugins/contracts/plugin-sdk-subpaths.test.ts similarity index 99% rename from src/plugin-sdk/subpaths.test.ts rename to src/plugins/contracts/plugin-sdk-subpaths.test.ts index 553d18a998f..c4cc3200d10 100644 --- a/src/plugin-sdk/subpaths.test.ts +++ b/src/plugins/contracts/plugin-sdk-subpaths.test.ts @@ -22,6 +22,7 @@ import type { } from "openclaw/plugin-sdk/core"; import * as providerEntrySdk from "openclaw/plugin-sdk/provider-entry"; import { describe, expect, expectTypeOf, it } from "vitest"; +import { pluginSdkSubpaths } from "../../plugin-sdk/entrypoints.js"; import type { ChannelMessageActionContext } from "../channels/plugins/types.js"; import type { BaseProbeResult, @@ -43,9 +44,8 @@ import type { OpenClawPluginApi as SharedOpenClawPluginApi, PluginRuntime as SharedPluginRuntime, } from "./channel-plugin-common.js"; -import { pluginSdkSubpaths } from "./entrypoints.js"; -const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const ROOT_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); const PLUGIN_SDK_DIR = resolve(ROOT_DIR, "plugin-sdk"); const sourceCache = new Map(); const representativeRuntimeSmokeSubpaths = ["channel-runtime", "conversation-runtime"] as const;