plugin-sdk: keep command status compatibility path light

This commit is contained in:
Mason Huang
2026-04-08 23:15:52 +08:00
committed by Peter Steinberger
parent aa15de8fdc
commit ba636d1206
7 changed files with 575 additions and 233 deletions

View File

@@ -1,6 +1,11 @@
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { resolveSenderCommandAuthorization } from "./command-auth.js";
import {
buildCommandsMessage,
buildCommandsMessagePaginated,
buildHelpMessage,
resolveSenderCommandAuthorization,
} from "./command-auth.js";
const baseCfg = {
commands: { useAccessGroups: true },
@@ -28,6 +33,17 @@ async function resolveAuthorization(params: {
}
describe("plugin-sdk/command-auth", () => {
it("keeps deprecated command status builders available for compatibility", () => {
const cfg = { commands: { config: false, debug: false } } as unknown as OpenClawConfig;
expect(buildHelpMessage(cfg)).toContain("/commands for full list");
expect(buildCommandsMessage(cfg)).toContain("More: /tools for available capabilities");
expect(buildCommandsMessagePaginated(cfg)).toMatchObject({
currentPage: 1,
totalPages: expect.any(Number),
});
});
it("resolves command authorization across allowlist sources", async () => {
const cases = [
{