import type { OpenClawPluginCommandDefinition } from "openclaw/plugin-sdk/core"; import { describe, expect, it, vi } from "vitest"; import type { PluginRuntime } from "./api.js"; import register from "./index.js";
function createHarness(config: Record<string, unknown>) {
let command: OpenClawPluginCommandDefinition | undefined; const runtime = {
config: {
loadConfig: vi.fn(() => config),
writeConfigFile: vi.fn().mockResolvedValue(undefined),
},
tts: {
listVoices: vi.fn(),
},
} as unknown as PluginRuntime; const api = {
runtime,
registerCommand: vi.fn((definition: OpenClawPluginCommandDefinition) => {
command = definition;
}),
};
register.register(api as never); if (!command) { thrownew Error("talk-voice command not registered");
} return { command, runtime };
}
it("rejects /voice set from gateway client with only operator.write scope", async () => { const { runtime, run } = createElevenlabsVoiceSetHarness("webchat", ["operator.write"]); const result = await run();
it("rejects /voice set from webchat channel with no scopes (TUI/internal)", async () => { const { runtime, run } = createElevenlabsVoiceSetHarness(); const result = await run();
it("allows /voice set from non-gateway channels without operator.admin", async () => { const { runtime, run } = createElevenlabsVoiceSetHarness("telegram"); const result = await run();
it("allows /voice set when operator.admin is present on a non-webchat channel", async () => { const { runtime, run } = createElevenlabsVoiceSetHarness("telegram", ["operator.admin"]); const result = await run();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.