Files
openclaw/extensions/active-memory/config.test.ts
Peter Steinberger 1507a9701b refactor: centralize inbound supplemental context
* 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
2026-05-27 09:26:06 +01:00

140 lines
3.7 KiB
TypeScript

import fs from "node:fs";
import {
type JsonSchemaObject,
validateJsonSchemaValue,
} from "openclaw/plugin-sdk/json-schema-runtime";
import { describe, expect, it } from "vitest";
const manifest = JSON.parse(
fs.readFileSync(new URL("./openclaw.plugin.json", import.meta.url), "utf-8"),
) as { configSchema: JsonSchemaObject };
describe("active-memory manifest config schema", () => {
it("accepts modelFallback for CLI and config.patch flows", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.model-fallback",
value: {
enabled: true,
agents: ["main"],
modelFallback: "google/gemini-3-flash",
modelFallbackPolicy: "resolved-only",
},
});
expect(result.ok).toBe(true);
});
it("accepts custom toolsAllow entries", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.tools-allow",
value: {
enabled: true,
agents: ["main"],
toolsAllow: ["lcm_grep", "lcm_describe", "lcm_expand_query"],
},
});
expect(result.ok).toBe(true);
});
it("rejects wildcard and group toolsAllow entries", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.tools-allow.reserved",
value: {
enabled: true,
agents: ["main"],
toolsAllow: ["*", "group:plugins"],
},
});
expect(result.ok).toBe(false);
});
it("accepts timeoutMs values at the runtime ceiling", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.timeout-ceiling",
value: {
enabled: true,
agents: ["main"],
timeoutMs: 120_000,
},
});
expect(result.ok).toBe(true);
});
it("accepts setupGraceTimeoutMs values at the runtime ceiling", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.setup-grace-timeout-ceiling",
value: {
enabled: true,
agents: ["main"],
setupGraceTimeoutMs: 30_000,
},
});
expect(result.ok).toBe(true);
});
it("accepts explicit in allowedChatTypes", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.allowed-chat-types.explicit",
value: {
enabled: true,
agents: ["main"],
allowedChatTypes: ["direct", "explicit"],
},
});
expect(result.ok).toBe(true);
});
it("rejects timeoutMs values above the runtime ceiling", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.timeout-above-ceiling",
value: {
enabled: true,
agents: ["main"],
timeoutMs: 120_001,
},
});
expect(result.ok).toBe(false);
});
it("rejects setupGraceTimeoutMs values above the runtime ceiling", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.setup-grace-timeout-above-ceiling",
value: {
enabled: true,
agents: ["main"],
setupGraceTimeoutMs: 30_001,
},
});
expect(result.ok).toBe(false);
});
it("rejects unknown allowedChatTypes values", () => {
const result = validateJsonSchemaValue({
schema: manifest.configSchema,
cacheKey: "active-memory.manifest.allowed-chat-types.invalid",
value: {
enabled: true,
agents: ["main"],
allowedChatTypes: ["direct", "portal"],
},
});
expect(result.ok).toBe(false);
});
});