Skip to content

Commit 025081d

Browse files
committed
refactor(memory-host): consolidate core adapter
1 parent 82eb90b commit 025081d

15 files changed

Lines changed: 655 additions & 115 deletions

packages/memory-host-sdk/src/engine-embeddings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export {
55
listRegisteredMemoryEmbeddingProviders,
66
listMemoryEmbeddingProviders,
77
listRegisteredMemoryEmbeddingProviderAdapters,
8-
} from "../../../src/plugins/memory-embedding-provider-runtime.js";
8+
} from "./host/openclaw-runtime.js";
99
export type {
1010
MemoryEmbeddingBatchChunk,
1111
MemoryEmbeddingBatchOptions,
@@ -14,7 +14,7 @@ export type {
1414
MemoryEmbeddingProviderCreateOptions,
1515
MemoryEmbeddingProviderCreateResult,
1616
MemoryEmbeddingProviderRuntime,
17-
} from "../../../src/plugins/memory-embedding-providers.js";
17+
} from "./host/openclaw-runtime.js";
1818
export { createLocalEmbeddingProvider, DEFAULT_LOCAL_MODEL } from "./host/embeddings.js";
1919
export { extractBatchErrorMessage, formatUnavailableBatchError } from "./host/batch-error-utils.js";
2020
export { postJsonWithRetry } from "./host/batch-http.js";

packages/memory-host-sdk/src/engine-foundation.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,43 @@ export {
66
resolveAgentWorkspaceDir,
77
resolveDefaultAgentId,
88
resolveSessionAgentId,
9-
} from "../../../src/agents/agent-scope.js";
9+
} from "./host/openclaw-runtime.js";
1010
export {
1111
resolveMemorySearchConfig,
1212
resolveMemorySearchSyncConfig,
1313
type ResolvedMemorySearchConfig,
1414
type ResolvedMemorySearchSyncConfig,
15-
} from "../../../src/agents/memory-search.js";
16-
export { parseDurationMs } from "../../../src/cli/parse-duration.js";
17-
export { loadConfig } from "../../../src/config/config.js";
18-
export { resolveStateDir } from "../../../src/config/paths.js";
19-
export { resolveSessionTranscriptsDirForAgent } from "../../../src/config/sessions/paths.js";
15+
} from "./host/openclaw-runtime.js";
16+
export { parseDurationMs } from "./host/openclaw-runtime.js";
17+
export { loadConfig } from "./host/openclaw-runtime.js";
18+
export { resolveStateDir } from "./host/openclaw-runtime.js";
19+
export { resolveSessionTranscriptsDirForAgent } from "./host/openclaw-runtime.js";
2020
export {
2121
hasConfiguredSecretInput,
2222
normalizeResolvedSecretInputString,
23-
} from "../../../src/config/types.secrets.js";
24-
export { writeFileWithinRoot } from "../../../src/infra/fs-safe.js";
25-
export { createSubsystemLogger } from "../../../src/logging/subsystem.js";
26-
export { detectMime } from "../../../src/media/mime.js";
27-
export { resolveGlobalSingleton } from "../../../src/shared/global-singleton.js";
28-
export { onSessionTranscriptUpdate } from "../../../src/sessions/transcript-events.js";
29-
export { splitShellArgs } from "../../../src/utils/shell-argv.js";
30-
export { runTasksWithConcurrency } from "../../../src/utils/run-with-concurrency.js";
23+
} from "./host/openclaw-runtime.js";
24+
export { writeFileWithinRoot } from "./host/openclaw-runtime.js";
25+
export { createSubsystemLogger } from "./host/openclaw-runtime.js";
26+
export { detectMime } from "./host/openclaw-runtime.js";
27+
export { resolveGlobalSingleton } from "./host/openclaw-runtime.js";
28+
export { onSessionTranscriptUpdate } from "./host/openclaw-runtime.js";
29+
export { splitShellArgs } from "./host/openclaw-runtime.js";
30+
export { runTasksWithConcurrency } from "./host/openclaw-runtime.js";
3131
export {
3232
shortenHomeInString,
3333
shortenHomePath,
3434
resolveUserPath,
3535
truncateUtf16Safe,
36-
} from "../../../src/utils.js";
37-
export type { OpenClawConfig } from "../../../src/config/config.js";
38-
export type { SessionSendPolicyConfig } from "../../../src/config/types.base.js";
39-
export type { SecretInput } from "../../../src/config/types.secrets.js";
36+
} from "./host/openclaw-runtime.js";
37+
export type { OpenClawConfig } from "./host/openclaw-runtime.js";
38+
export type { SessionSendPolicyConfig } from "./host/openclaw-runtime.js";
39+
export type { SecretInput } from "./host/openclaw-runtime.js";
4040
export type {
4141
MemoryBackend,
4242
MemoryCitationsMode,
4343
MemoryQmdConfig,
4444
MemoryQmdIndexPath,
4545
MemoryQmdMcporterConfig,
4646
MemoryQmdSearchMode,
47-
} from "../../../src/config/types.memory.js";
48-
export type { MemorySearchConfig } from "../../../src/config/types.tools.js";
47+
} from "./host/openclaw-runtime.js";
48+
export type { MemorySearchConfig } from "./host/openclaw-runtime.js";

packages/memory-host-sdk/src/engine-qmd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export {
1212
type SessionFileEntry,
1313
type SessionTranscriptClassification,
1414
} from "./host/session-files.js";
15-
export { parseUsageCountedSessionIdFromFileName } from "../../../src/config/sessions/artifacts.js";
15+
export { parseUsageCountedSessionIdFromFileName } from "./host/openclaw-runtime.js";
1616
export { parseQmdQueryJson, type QmdQueryResult } from "./host/qmd-query-parser.js";
1717
export {
1818
deriveQmdScopeChannel,

packages/memory-host-sdk/src/host/backend-config.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import fs from "node:fs/promises";
44
import os from "node:os";
55
import path from "node:path";
66
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
7-
import { resolveAgentWorkspaceDir } from "../../../../src/agents/agent-scope-config.js";
8-
import type { OpenClawConfig } from "../../../../src/config/config.js";
97
import { resolveMemoryBackendConfig } from "./backend-config.js";
8+
import type { OpenClawConfig } from "./config-utils.js";
109

1110
type ResolvedMemoryBackendConfig = ReturnType<typeof resolveMemoryBackendConfig>;
1211

@@ -170,8 +169,7 @@ describe("resolveMemoryBackendConfig", () => {
170169
const resolved = resolveMemoryBackendConfig({ cfg, agentId: "main" });
171170
const custom = resolved.qmd?.collections.find((c) => c.name.startsWith("custom-notes"));
172171
expect(custom).toBeDefined();
173-
const workspaceRoot = resolveAgentWorkspaceDir(cfg, "main");
174-
expect(custom?.path).toBe(path.resolve(workspaceRoot, "notes"));
172+
expect(custom?.path).toBe(path.resolve("/workspace/root", "notes"));
175173
});
176174

177175
it("scopes qmd collection names per agent", () => {

packages/memory-host-sdk/src/host/backend-config.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import fs from "node:fs";
22
import path from "node:path";
3-
import { resolveAgentWorkspaceDir } from "../../../../src/agents/agent-scope-config.js";
4-
import { parseDurationMs } from "../../../../src/cli/parse-duration.js";
5-
import type { OpenClawConfig } from "../../../../src/config/config.js";
6-
import type { SessionSendPolicyConfig } from "../../../../src/config/types.base.js";
7-
import type {
8-
MemoryBackend,
9-
MemoryCitationsMode,
10-
MemoryQmdConfig,
11-
MemoryQmdIndexPath,
12-
MemoryQmdMcporterConfig,
13-
MemoryQmdSearchMode,
14-
} from "../../../../src/config/types.memory.js";
15-
import { CANONICAL_ROOT_MEMORY_FILENAME } from "../../../../src/memory/root-memory-files.js";
16-
import { normalizeAgentId } from "../../../../src/routing/session-key.js";
17-
import { resolveUserPath } from "../../../../src/utils.js";
18-
import { splitShellArgs } from "../../../../src/utils/shell-argv.js";
3+
import {
4+
CANONICAL_ROOT_MEMORY_FILENAME,
5+
type MemoryBackend,
6+
type MemoryCitationsMode,
7+
type MemoryQmdConfig,
8+
type MemoryQmdIndexPath,
9+
type MemoryQmdMcporterConfig,
10+
type MemoryQmdSearchMode,
11+
type OpenClawConfig,
12+
parseDurationMs,
13+
resolveAgentWorkspaceDir,
14+
normalizeAgentId,
15+
resolveUserPath,
16+
type SessionSendPolicyConfig,
17+
splitShellArgs,
18+
} from "./config-utils.js";
1919
import { normalizeLowercaseStringOrEmpty } from "./string-utils.js";
2020

2121
export type ResolvedMemoryBackendConfig = {

0 commit comments

Comments
 (0)