mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-02 16:51:06 +00:00
* refactor: centralize inbound supplemental context * refactor: trim supplemental finalizer typing * docs: clarify supplemental context projection * refactor: move inbound finalization into core * refactor: simplify channel inbound facts * refactor: fold supplemental media into inbound finalizer * refactor: migrate channel inbound callers to builder * docs: mark inbound finalizer compat types deprecated * refactor: wire runtime turn context builder * refactor: replace channel turn runtime API * fix: respect discord quote visibility * fix: avoid deprecated line dispatch helper * refactor: deprecate channel message SDK seams * docs: trim channel outbound SDK page * test: migrate irc inbound assertion * refactor: deprecate outbound SDK facades * refactor: deprecate channel helper SDK facades * refactor: deprecate channel streaming SDK facade * refactor: move direct dm helpers into inbound SDK * chore: mark legacy test-utils SDK alias deprecated * refactor: remove unused allow-from read helper * refactor: route remaining channel dispatch through core * refactor: enforce modern extension SDK imports * test: give slow image root tests more time * ci: support node fallback on windows * fix: add transcripts tool display metadata * refactor: trim legacy channel test seams * fix: preserve channel compat after rebase * fix: keep deprecated channel inbound aliases * fix: preserve discord thread context visibility * fix: clean final rebase conflicts * fix: preserve channel message dispatch aliases * fix: sync channel refactor after rebase * fix: sync channel refactor after latest main * fix: dedupe memory-core subagent mock * test: align clickclack inbound dispatch assertions * fix: sync plugin sdk api hash after rebase * fix: sync channel refactor after latest main * fix: sync plugin sdk api hash after rebase * fix: sync plugin sdk api hash after latest main * test: remove stale inbound context awaits
104 lines
2.9 KiB
TypeScript
104 lines
2.9 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import {
|
|
validateJsonSchemaValue,
|
|
type JsonSchemaObject,
|
|
} from "openclaw/plugin-sdk/json-schema-runtime";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
DEFAULT_WIKI_RENDER_MODE,
|
|
DEFAULT_WIKI_SEARCH_BACKEND,
|
|
DEFAULT_WIKI_SEARCH_CORPUS,
|
|
DEFAULT_WIKI_VAULT_MODE,
|
|
resolveDefaultMemoryWikiVaultPath,
|
|
resolveMemoryWikiConfig,
|
|
} from "./config.js";
|
|
|
|
function compileManifestConfigSchema() {
|
|
const manifest = JSON.parse(
|
|
fs.readFileSync(new URL("../openclaw.plugin.json", import.meta.url), "utf8"),
|
|
) as { configSchema: JsonSchemaObject };
|
|
return (value: unknown) =>
|
|
validateJsonSchemaValue({
|
|
cacheKey: "memory-wiki.manifest.config.test",
|
|
schema: manifest.configSchema,
|
|
value,
|
|
applyDefaults: true,
|
|
}).ok;
|
|
}
|
|
|
|
describe("resolveMemoryWikiConfig", () => {
|
|
it("returns isolated defaults", () => {
|
|
const config = resolveMemoryWikiConfig(undefined, { homedir: "/Users/tester" });
|
|
|
|
expect(config.vaultMode).toBe(DEFAULT_WIKI_VAULT_MODE);
|
|
expect(config.vault.renderMode).toBe(DEFAULT_WIKI_RENDER_MODE);
|
|
expect(config.vault.path).toBe(resolveDefaultMemoryWikiVaultPath("/Users/tester"));
|
|
expect(config.search.backend).toBe(DEFAULT_WIKI_SEARCH_BACKEND);
|
|
expect(config.search.corpus).toBe(DEFAULT_WIKI_SEARCH_CORPUS);
|
|
expect(config.context.includeCompiledDigestPrompt).toBe(false);
|
|
});
|
|
|
|
it("expands ~/ paths and preserves explicit modes", () => {
|
|
const config = resolveMemoryWikiConfig(
|
|
{
|
|
vaultMode: "bridge",
|
|
vault: {
|
|
path: "~/vaults/wiki",
|
|
renderMode: "obsidian",
|
|
},
|
|
},
|
|
{ homedir: "/Users/tester" },
|
|
);
|
|
|
|
expect(config.vaultMode).toBe("bridge");
|
|
expect(config.vault.path).toBe(path.join("/Users/tester", "vaults", "wiki"));
|
|
expect(config.vault.renderMode).toBe("obsidian");
|
|
});
|
|
|
|
it("normalizes the bridge artifact toggle", () => {
|
|
const canonical = resolveMemoryWikiConfig({
|
|
bridge: {
|
|
readMemoryArtifacts: false,
|
|
},
|
|
});
|
|
|
|
expect(canonical.bridge.readMemoryArtifacts).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe("memory-wiki manifest config schema", () => {
|
|
it("accepts the documented config shape", () => {
|
|
const validate = compileManifestConfigSchema();
|
|
const config = {
|
|
vaultMode: "unsafe-local",
|
|
vault: {
|
|
path: "~/wiki",
|
|
renderMode: "obsidian",
|
|
},
|
|
obsidian: {
|
|
enabled: true,
|
|
useOfficialCli: true,
|
|
},
|
|
bridge: {
|
|
enabled: true,
|
|
readMemoryArtifacts: true,
|
|
followMemoryEvents: true,
|
|
},
|
|
unsafeLocal: {
|
|
allowPrivateMemoryCoreAccess: true,
|
|
paths: ["extensions/memory-core/src"],
|
|
},
|
|
search: {
|
|
backend: "shared",
|
|
corpus: "all",
|
|
},
|
|
context: {
|
|
includeCompiledDigestPrompt: true,
|
|
},
|
|
};
|
|
|
|
expect(validate(config)).toBe(true);
|
|
});
|
|
});
|