mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:00:42 +00:00
Verified: - pnpm install --frozen-lockfile - pnpm test extensions/active-memory/config.test.ts extensions/active-memory/index.test.ts - pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/active-memory/index.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts extensions/active-memory/openclaw.plugin.json - git diff --check Co-authored-by: Lidang-Jiang <119769478+Lidang-Jiang@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
81 lines
2.2 KiB
TypeScript
81 lines
2.2 KiB
TypeScript
import fs from "node:fs";
|
|
import { type JsonSchemaObject, validateJsonSchemaValue } from "openclaw/plugin-sdk/config-schema";
|
|
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 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 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 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);
|
|
});
|
|
});
|