mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 00:02:20 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import { setPluginEnabledInConfig } from "./plugins-config.js";
|
|
|
|
describe("setPluginEnabledInConfig", () => {
|
|
it("sets enabled flag for an existing plugin entry", () => {
|
|
const config = {
|
|
plugins: {
|
|
entries: {
|
|
alpha: { enabled: false, custom: "x" },
|
|
},
|
|
},
|
|
} as OpenClawConfig;
|
|
|
|
const next = setPluginEnabledInConfig(config, "alpha", true);
|
|
|
|
expect(next.plugins?.entries?.alpha).toEqual({
|
|
enabled: true,
|
|
custom: "x",
|
|
});
|
|
});
|
|
|
|
it("creates a plugin entry when it does not exist", () => {
|
|
const config = {} as OpenClawConfig;
|
|
|
|
const next = setPluginEnabledInConfig(config, "beta", false);
|
|
|
|
expect(next.plugins?.entries?.beta).toEqual({
|
|
enabled: false,
|
|
});
|
|
});
|
|
|
|
it("keeps built-in channel and plugin entry flags in sync", () => {
|
|
const config = {
|
|
channels: {
|
|
telegram: {
|
|
enabled: true,
|
|
dmPolicy: "open",
|
|
},
|
|
},
|
|
plugins: {
|
|
entries: {
|
|
telegram: {
|
|
enabled: true,
|
|
},
|
|
},
|
|
},
|
|
} as OpenClawConfig;
|
|
|
|
const disabled = setPluginEnabledInConfig(config, "telegram", false);
|
|
expect(disabled.channels?.telegram).toEqual({
|
|
enabled: false,
|
|
dmPolicy: "open",
|
|
});
|
|
expect(disabled.plugins?.entries?.telegram).toEqual({
|
|
enabled: false,
|
|
});
|
|
|
|
const reenabled = setPluginEnabledInConfig(disabled, "telegram", true);
|
|
expect(reenabled.channels?.telegram).toEqual({
|
|
enabled: true,
|
|
dmPolicy: "open",
|
|
});
|
|
expect(reenabled.plugins?.entries?.telegram).toEqual({
|
|
enabled: true,
|
|
});
|
|
});
|
|
});
|