mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
fix: disable tts tool for voice provider
This commit is contained in:
@@ -319,6 +319,11 @@ describe("createOpenClawCodingTools", () => {
|
||||
expect(names.has("telegram")).toBe(false);
|
||||
expect(names.has("whatsapp")).toBe(false);
|
||||
});
|
||||
it("does not expose tts tool for voice message provider", () => {
|
||||
const tools = createOpenClawCodingTools({ messageProvider: "voice" });
|
||||
const names = new Set(tools.map((tool) => tool.name));
|
||||
expect(names.has("tts")).toBe(false);
|
||||
});
|
||||
it("filters session tools for sub-agent sessions by default", () => {
|
||||
const tools = createOpenClawCodingTools({
|
||||
sessionKey: "agent:main:subagent:test",
|
||||
|
||||
@@ -217,6 +217,8 @@ export function createOpenClawCodingTools(options?: {
|
||||
/** Whether the sender is an owner (required for owner-only tools). */
|
||||
senderIsOwner?: boolean;
|
||||
}): AnyAgentTool[] {
|
||||
const rawMessageProvider = options?.messageProvider?.trim().toLowerCase();
|
||||
const isVoiceMessageProvider = rawMessageProvider === "voice";
|
||||
const execToolName = "exec";
|
||||
const sandbox = options?.sandbox?.enabled ? options.sandbox : undefined;
|
||||
const {
|
||||
@@ -480,9 +482,12 @@ export function createOpenClawCodingTools(options?: {
|
||||
senderIsOwner: options?.senderIsOwner,
|
||||
}),
|
||||
];
|
||||
const toolsForMessageProvider = isVoiceMessageProvider
|
||||
? tools.filter((tool) => tool.name !== "tts")
|
||||
: tools;
|
||||
// Security: treat unknown/undefined as unauthorized (opt-in, not opt-out)
|
||||
const senderIsOwner = options?.senderIsOwner === true;
|
||||
const toolsByAuthorization = applyOwnerOnlyToolPolicy(tools, senderIsOwner);
|
||||
const toolsByAuthorization = applyOwnerOnlyToolPolicy(toolsForMessageProvider, senderIsOwner);
|
||||
const subagentFiltered = applyToolPolicyPipeline({
|
||||
tools: toolsByAuthorization,
|
||||
toolMeta: (tool) => getPluginToolMeta(tool),
|
||||
|
||||
Reference in New Issue
Block a user