mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 13:53:35 +00:00
* fix(plugins): pin official npm install records * fix(infra): tolerate equivalent plugin install migrations * fix(plugins): preserve manual exact plugin pins * fix(infra): remove stale migration imports * chore: unblock ci guards * fix: preserve official sync integrity checks * fix: avoid prerelease integrity carryover * fix: preserve manual official npm specs * fix: preserve beta fallback integrity checks * fix: preserve trusted prerelease fallback integrity * fix: preserve prerelease-only integrity checks * fix: pin unchanged official npm records * fix: allow official compatible fallback updates * fix: preserve fallback integrity after prerelease resolution * fix: skip incompatible fallback integrity pins * fix: preserve pin-only install provenance * fix: check integrity when repairing missing official pins --------- Co-authored-by: Lilac <lilac@Lilacs-iMac.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
64 lines
2.2 KiB
TypeScript
64 lines
2.2 KiB
TypeScript
/**
|
|
* Tests the plugin SDK public API baseline.
|
|
*/
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
normalizePluginSdkApiDeclarationText,
|
|
normalizePluginSdkApiSourcePath,
|
|
} from "./api-baseline.js";
|
|
|
|
describe("Plugin SDK API baseline", () => {
|
|
it("normalizes declaration import paths to repo-relative paths", () => {
|
|
const repoRoot = process.cwd();
|
|
const modelCatalogPath = path.join(repoRoot, "src", "agents", "agent-model-discovery");
|
|
const declaration = `export function setModelCatalogImportForTest(loader?: (() => Promise<typeof import("${modelCatalogPath}", { with: { "resolution-mode": "import" } })>) | undefined): void;`;
|
|
|
|
const normalized = normalizePluginSdkApiDeclarationText(repoRoot, declaration);
|
|
|
|
expect(normalized).not.toContain(repoRoot);
|
|
expect(normalized).toContain(
|
|
'import("src/agents/agent-model-discovery", { with: { "resolution-mode": "import" } })',
|
|
);
|
|
});
|
|
|
|
it("normalizes dependency source paths to stable node_modules paths", () => {
|
|
const repoRoot = path.join(path.sep, "workspace", "openclaw-worktree");
|
|
const linkedDependencyPath = path.join(
|
|
path.sep,
|
|
"workspace",
|
|
"openclaw",
|
|
"node_modules",
|
|
"@openclaw",
|
|
"fs-safe",
|
|
"dist",
|
|
"secret-file.d.ts",
|
|
);
|
|
const pnpmDependencyPath = path.join(
|
|
repoRoot,
|
|
"node_modules",
|
|
".pnpm",
|
|
"@openclaw+fs-safe@1.0.0",
|
|
"node_modules",
|
|
"@openclaw",
|
|
"fs-safe",
|
|
"dist",
|
|
"secret-file.d.ts",
|
|
);
|
|
|
|
expect(normalizePluginSdkApiSourcePath(repoRoot, linkedDependencyPath)).toBe(
|
|
"node_modules/@openclaw/fs-safe/dist/secret-file.d.ts",
|
|
);
|
|
expect(normalizePluginSdkApiSourcePath(repoRoot, pnpmDependencyPath)).toBe(
|
|
"node_modules/@openclaw/fs-safe/dist/secret-file.d.ts",
|
|
);
|
|
});
|
|
|
|
it("keeps repo source paths relative when a parent directory is named node_modules", () => {
|
|
const repoRoot = path.join(path.sep, "workspace", "node_modules", "openclaw");
|
|
const sourcePath = path.join(repoRoot, "src", "plugin-sdk", "core.ts");
|
|
|
|
expect(normalizePluginSdkApiSourcePath(repoRoot, sourcePath)).toBe("src/plugin-sdk/core.ts");
|
|
});
|
|
});
|