Skip to content

Commit bd6c796

Browse files
committed
refactor: extract memory host sdk package
1 parent dff3ca2 commit bd6c796

41 files changed

Lines changed: 576 additions & 288 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.generated/plugin-sdk-api-baseline.json

Lines changed: 138 additions & 12 deletions
Large diffs are not rendered by default.

docs/.generated/plugin-sdk-api-baseline.jsonl

Lines changed: 24 additions & 10 deletions
Large diffs are not rendered by default.

extensions/memory-core/src/api.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

extensions/memory-core/src/cli.runtime.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ import {
77
defaultRuntime,
88
formatErrorMessage,
99
isRich,
10-
listMemoryFiles,
11-
loadConfig,
12-
normalizeExtraMemoryPaths,
1310
resolveCommandSecretRefsViaGateway,
14-
resolveDefaultAgentId,
15-
resolveSessionTranscriptsDirForAgent,
16-
resolveStateDir,
1711
setVerbose,
1812
shortenHomeInString,
1913
shortenHomePath,
2014
theme,
2115
withManager,
2216
withProgress,
2317
withProgressTotals,
18+
} from "openclaw/plugin-sdk/memory-core-host-runtime-cli";
19+
import {
20+
loadConfig,
21+
resolveDefaultAgentId,
22+
resolveSessionTranscriptsDirForAgent,
23+
resolveStateDir,
2424
type OpenClawConfig,
25-
} from "./api.js";
25+
} from "openclaw/plugin-sdk/memory-core-host-runtime-core";
26+
import {
27+
listMemoryFiles,
28+
normalizeExtraMemoryPaths,
29+
} from "openclaw/plugin-sdk/memory-core-host-runtime-files";
2630
import type { MemoryCommandOptions, MemorySearchCommandOptions } from "./cli.types.js";
2731
import { getMemorySearchManager } from "./runtime-api.js";
2832

extensions/memory-core/src/cli.test.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,21 @@ const resolveCommandSecretRefsViaGateway = vi.hoisted(() =>
2020
})),
2121
);
2222

23-
vi.mock("./api.js", async (importOriginal) => {
24-
const actual = await importOriginal<typeof import("./api.js")>();
23+
vi.mock("openclaw/plugin-sdk/memory-core-host-runtime-core", async (importOriginal) => {
24+
const actual =
25+
await importOriginal<typeof import("openclaw/plugin-sdk/memory-core-host-runtime-core")>();
2526
return {
2627
...actual,
2728
loadConfig,
2829
resolveDefaultAgentId,
30+
};
31+
});
32+
33+
vi.mock("openclaw/plugin-sdk/memory-core-host-runtime-cli", async (importOriginal) => {
34+
const actual =
35+
await importOriginal<typeof import("openclaw/plugin-sdk/memory-core-host-runtime-cli")>();
36+
return {
37+
...actual,
2938
resolveCommandSecretRefsViaGateway,
3039
};
3140
});
@@ -39,13 +48,14 @@ vi.mock("./runtime-api.js", async (importOriginal) => {
3948
});
4049

4150
let registerMemoryCli: typeof import("./cli.js").registerMemoryCli;
42-
let defaultRuntime: typeof import("./api.js").defaultRuntime;
43-
let isVerbose: typeof import("./api.js").isVerbose;
44-
let setVerbose: typeof import("./api.js").setVerbose;
51+
let defaultRuntime: typeof import("openclaw/plugin-sdk/memory-core-host-runtime-cli").defaultRuntime;
52+
let isVerbose: typeof import("openclaw/plugin-sdk/memory-core-host-runtime-cli").isVerbose;
53+
let setVerbose: typeof import("openclaw/plugin-sdk/memory-core-host-runtime-cli").setVerbose;
4554

4655
beforeAll(async () => {
4756
({ registerMemoryCli } = await import("./cli.js"));
48-
({ defaultRuntime, isVerbose, setVerbose } = await import("./api.js"));
57+
({ defaultRuntime, isVerbose, setVerbose } =
58+
await import("openclaw/plugin-sdk/memory-core-host-runtime-cli"));
4959
});
5060

5161
beforeEach(() => {

extensions/memory-core/src/cli.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import type { Command } from "commander";
2-
import { formatDocsLink, formatHelpExamples, theme } from "./api.js";
2+
import {
3+
formatDocsLink,
4+
formatHelpExamples,
5+
theme,
6+
} from "openclaw/plugin-sdk/memory-core-host-runtime-cli";
37
import type { MemoryCommandOptions, MemorySearchCommandOptions } from "./cli.types.js";
48

59
type MemoryCliRuntime = typeof import("./cli.runtime.js");
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
export * from "openclaw/plugin-sdk/memory-core-host-engine";
1+
export * from "openclaw/plugin-sdk/memory-core-host-engine-foundation";
2+
export * from "openclaw/plugin-sdk/memory-core-host-engine-storage";
3+
export * from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
4+
export * from "openclaw/plugin-sdk/memory-core-host-engine-qmd";

extensions/memory-core/src/flush-plan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
SILENT_REPLY_TOKEN,
66
type MemoryFlushPlan,
77
type OpenClawConfig,
8-
} from "./api.js";
8+
} from "openclaw/plugin-sdk/memory-core-host-runtime-core";
99

1010
export const DEFAULT_MEMORY_FLUSH_SOFT_TOKENS = 4000;
1111
export const DEFAULT_MEMORY_FLUSH_FORCE_TRANSCRIPT_BYTES = 2 * 1024 * 1024;

extensions/memory-core/src/memory/qmd-manager.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ function isMcporterCommand(cmd: unknown): boolean {
6767
return /(^|[\\/])mcporter(?:\.cmd)?$/i.test(cmd);
6868
}
6969

70-
vi.mock("openclaw/plugin-sdk/memory-core-host-engine", async () => {
70+
vi.mock("openclaw/plugin-sdk/memory-core-host-engine-foundation", async () => {
7171
const actual = await vi.importActual<
72-
typeof import("openclaw/plugin-sdk/memory-core-host-engine")
73-
>("openclaw/plugin-sdk/memory-core-host-engine");
72+
typeof import("openclaw/plugin-sdk/memory-core-host-engine-foundation")
73+
>("openclaw/plugin-sdk/memory-core-host-engine-foundation");
7474
return {
7575
...actual,
7676
createSubsystemLogger: () => {

extensions/memory-core/src/prompt-section.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MemoryPromptSectionBuilder } from "./api.js";
1+
import type { MemoryPromptSectionBuilder } from "openclaw/plugin-sdk/memory-core-host-runtime-core";
22

33
export const buildPromptSection: MemoryPromptSectionBuilder = ({
44
availableTools,

0 commit comments

Comments
 (0)