mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 16:50:46 +00:00
refactor(memory-host): narrow runtime adapters
This commit is contained in:
@@ -58,6 +58,16 @@ const MEMORY_HOST_SDK_EXPORTS = [
|
||||
const MEMORY_HOST_SDK_ALLOWED_CORE_BRIDGE_FILES = [
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime.ts",
|
||||
] as const;
|
||||
const MEMORY_HOST_SDK_RUNTIME_ADAPTER_FILES = [
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-agent.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-auth.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-cli.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-config.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-io.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-memory.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-network.ts",
|
||||
"packages/memory-host-sdk/src/host/openclaw-runtime-session.ts",
|
||||
] as const;
|
||||
|
||||
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Test helper lets assertions ascribe JSON file shape.
|
||||
function readJsonFile<T>(relativePath: string): T {
|
||||
@@ -87,6 +97,13 @@ function collectCoreReferenceFiles(relativeDir: string): string[] {
|
||||
});
|
||||
}
|
||||
|
||||
function collectOpenClawRuntimeDirectImportFiles(relativeDir: string): string[] {
|
||||
return collectCodeFiles(relativeDir).filter((file) => {
|
||||
const source = readFileSync(resolve(REPO_ROOT, file), "utf8");
|
||||
return source.includes('"./openclaw-runtime.js"');
|
||||
});
|
||||
}
|
||||
|
||||
describe("opt-in extension package boundaries", () => {
|
||||
it("keeps path aliases in a dedicated shared config", () => {
|
||||
const pathsConfig = readJsonFile<TsConfigJson>(EXTENSION_PACKAGE_BOUNDARY_PATHS_CONFIG);
|
||||
@@ -239,6 +256,9 @@ describe("opt-in extension package boundaries", () => {
|
||||
expect(collectCoreReferenceFiles("packages/memory-host-sdk/src")).toEqual([
|
||||
...MEMORY_HOST_SDK_ALLOWED_CORE_BRIDGE_FILES,
|
||||
]);
|
||||
expect(collectOpenClawRuntimeDirectImportFiles("packages/memory-host-sdk/src")).toEqual([
|
||||
...MEMORY_HOST_SDK_RUNTIME_ADAPTER_FILES,
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps plugin-package-contract independent from core internals", () => {
|
||||
|
||||
Reference in New Issue
Block a user