mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 11:44:05 +00:00
perf(memory-core): defer embedding engine startup imports
This commit is contained in:
@@ -652,6 +652,7 @@ releases.
|
||||
| `plugin-sdk/zod` | Deprecated Zod compatibility re-export | Import `zod` from `zod` directly |
|
||||
| `plugin-sdk/memory-core` | Bundled memory-core helpers | Memory manager/config/file/CLI helper surface |
|
||||
| `plugin-sdk/memory-core-engine-runtime` | Memory engine runtime facade | Memory index/search runtime facade |
|
||||
| `plugin-sdk/memory-core-host-embedding-registry` | Memory embedding registry | Lightweight memory embedding provider registry helpers |
|
||||
| `plugin-sdk/memory-core-host-engine-foundation` | Memory host foundation engine | Memory host foundation engine exports |
|
||||
| `plugin-sdk/memory-core-host-engine-embeddings` | Memory host embedding engine | Memory embedding contracts, registry access, local provider, and generic batch/remote helpers; concrete remote providers live in their owning plugins |
|
||||
| `plugin-sdk/memory-core-host-engine-qmd` | Memory host QMD engine | Memory host QMD engine exports |
|
||||
|
||||
@@ -355,6 +355,7 @@ usage endpoint failed or returned no usable usage data.
|
||||
| --- | --- |
|
||||
| `plugin-sdk/memory-core` | Bundled memory-core helper surface for manager/config/file/CLI helpers |
|
||||
| `plugin-sdk/memory-core-engine-runtime` | Memory index/search runtime facade |
|
||||
| `plugin-sdk/memory-core-host-embedding-registry` | Lightweight memory embedding provider registry helpers |
|
||||
| `plugin-sdk/memory-core-host-engine-foundation` | Memory host foundation engine exports |
|
||||
| `plugin-sdk/memory-core-host-engine-embeddings` | Memory host embedding contracts, registry access, local provider, and generic batch/remote helpers. `registerMemoryEmbeddingProvider` on this surface is deprecated; use the generic embedding provider API for new providers. |
|
||||
| `plugin-sdk/memory-core-host-engine-qmd` | Memory host QMD engine exports |
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import fsSync from "node:fs";
|
||||
import {
|
||||
createLocalEmbeddingProvider,
|
||||
DEFAULT_LOCAL_MODEL,
|
||||
listMemoryEmbeddingProviders,
|
||||
listRegisteredMemoryEmbeddingProviderAdapters,
|
||||
type MemoryEmbeddingProviderAdapter,
|
||||
} from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
||||
import { resolveUserPath } from "openclaw/plugin-sdk/memory-core-host-engine-foundation";
|
||||
} from "openclaw/plugin-sdk/memory-core-host-embedding-registry";
|
||||
import { getProviderEnvVars } from "openclaw/plugin-sdk/provider-env-vars";
|
||||
import { formatErrorMessage } from "../dreaming-shared.js";
|
||||
import { filterUnregisteredMemoryEmbeddingProviderAdapters } from "./provider-adapter-registration.js";
|
||||
@@ -66,22 +63,6 @@ function formatLocalSetupError(err: unknown): string {
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function canAutoSelectLocal(modelPath?: string): boolean {
|
||||
const trimmed = modelPath?.trim();
|
||||
if (!trimmed) {
|
||||
return false;
|
||||
}
|
||||
if (/^(hf:|https?:)/i.test(trimmed)) {
|
||||
return false;
|
||||
}
|
||||
const resolved = resolveUserPath(trimmed);
|
||||
try {
|
||||
return fsSync.statSync(resolved).isFile();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const localAdapter: MemoryEmbeddingProviderAdapter = {
|
||||
id: "local",
|
||||
defaultModel: DEFAULT_LOCAL_MODEL,
|
||||
@@ -90,6 +71,8 @@ const localAdapter: MemoryEmbeddingProviderAdapter = {
|
||||
formatSetupError: formatLocalSetupError,
|
||||
shouldContinueAutoSelection: () => true,
|
||||
create: async (options) => {
|
||||
const { createLocalEmbeddingProvider } =
|
||||
await import("openclaw/plugin-sdk/memory-core-host-engine-embeddings");
|
||||
const provider = await createLocalEmbeddingProvider({
|
||||
...options,
|
||||
provider: "local",
|
||||
@@ -166,5 +149,3 @@ export function listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata(): Ar
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export { canAutoSelectLocal };
|
||||
|
||||
@@ -1085,6 +1085,10 @@
|
||||
"types": "./dist/plugin-sdk/memory-core-engine-runtime.d.ts",
|
||||
"default": "./dist/plugin-sdk/memory-core-engine-runtime.js"
|
||||
},
|
||||
"./plugin-sdk/memory-core-host-embedding-registry": {
|
||||
"types": "./dist/plugin-sdk/memory-core-host-embedding-registry.d.ts",
|
||||
"default": "./dist/plugin-sdk/memory-core-host-embedding-registry.js"
|
||||
},
|
||||
"./plugin-sdk/memory-core-host-engine-embeddings": {
|
||||
"types": "./dist/plugin-sdk/memory-core-host-engine-embeddings.d.ts",
|
||||
"default": "./dist/plugin-sdk/memory-core-host-engine-embeddings.js"
|
||||
|
||||
@@ -250,6 +250,7 @@
|
||||
"qa-live-transport-scenarios",
|
||||
"memory-core",
|
||||
"memory-core-engine-runtime",
|
||||
"memory-core-host-embedding-registry",
|
||||
"memory-core-host-engine-embeddings",
|
||||
"memory-core-host-engine-foundation",
|
||||
"memory-core-host-engine-qmd",
|
||||
|
||||
@@ -58,6 +58,7 @@ export const publicPluginOwnedSdkEntrypoints = [
|
||||
"browser-config",
|
||||
"image-generation-core",
|
||||
"memory-core",
|
||||
"memory-core-host-embedding-registry",
|
||||
"memory-core-host-engine-embeddings",
|
||||
"memory-core-host-engine-foundation",
|
||||
"memory-core-host-engine-qmd",
|
||||
|
||||
10
src/plugin-sdk/memory-core-host-embedding-registry.ts
Normal file
10
src/plugin-sdk/memory-core-host-embedding-registry.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export { DEFAULT_LOCAL_MODEL } from "../../packages/memory-host-sdk/src/host/embedding-defaults.js";
|
||||
export {
|
||||
listMemoryEmbeddingProviders,
|
||||
listRegisteredMemoryEmbeddingProviderAdapters,
|
||||
} from "../plugins/memory-embedding-provider-runtime.js";
|
||||
export type {
|
||||
MemoryEmbeddingProviderAdapter,
|
||||
MemoryEmbeddingProviderCreateOptions,
|
||||
MemoryEmbeddingProviderCreateResult,
|
||||
} from "../plugins/memory-embedding-providers.js";
|
||||
Reference in New Issue
Block a user