|
1 | 1 | import { getToolUseGuidelinesSection } from "../tool-use-guidelines" |
2 | 2 | import { TOOL_PROTOCOL } from "@roo-code/types" |
| 3 | +import { EXPERIMENT_IDS } from "../../../../shared/experiments" |
3 | 4 |
|
4 | 5 | describe("getToolUseGuidelinesSection", () => { |
5 | 6 | describe("XML protocol", () => { |
@@ -35,30 +36,53 @@ describe("getToolUseGuidelinesSection", () => { |
35 | 36 | }) |
36 | 37 |
|
37 | 38 | describe("native protocol", () => { |
38 | | - it("should include proper numbered guidelines", () => { |
39 | | - const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE) |
| 39 | + describe("with MULTIPLE_NATIVE_TOOL_CALLS disabled (default)", () => { |
| 40 | + it("should include proper numbered guidelines", () => { |
| 41 | + const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE) |
40 | 42 |
|
41 | | - // Check that all numbered items are present with correct numbering |
42 | | - expect(guidelines).toContain("1. Assess what information") |
43 | | - expect(guidelines).toContain("2. Choose the most appropriate tool") |
44 | | - expect(guidelines).toContain("3. If multiple actions are needed") |
45 | | - expect(guidelines).toContain("4. After each tool use") |
46 | | - }) |
| 43 | + // Check that all numbered items are present with correct numbering |
| 44 | + expect(guidelines).toContain("1. Assess what information") |
| 45 | + expect(guidelines).toContain("2. Choose the most appropriate tool") |
| 46 | + expect(guidelines).toContain("3. If multiple actions are needed") |
| 47 | + expect(guidelines).toContain("4. After each tool use") |
| 48 | + }) |
| 49 | + |
| 50 | + it("should include single-tool-per-message guidance when experiment disabled", () => { |
| 51 | + const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE, {}) |
| 52 | + |
| 53 | + expect(guidelines).toContain("use one tool at a time per message") |
| 54 | + expect(guidelines).not.toContain("you may use multiple tools in a single message") |
| 55 | + expect(guidelines).not.toContain("Formulate your tool use using the XML format") |
| 56 | + expect(guidelines).not.toContain("ALWAYS wait for user confirmation") |
| 57 | + }) |
47 | 58 |
|
48 | | - it("should include native protocol-specific guidelines", () => { |
49 | | - const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE) |
| 59 | + it("should include simplified iterative process guidelines", () => { |
| 60 | + const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE) |
50 | 61 |
|
51 | | - expect(guidelines).toContain("you may use multiple tools in a single message") |
52 | | - expect(guidelines).not.toContain("Formulate your tool use using the XML format") |
53 | | - expect(guidelines).not.toContain("ALWAYS wait for user confirmation") |
| 62 | + expect(guidelines).toContain("carefully considering the user's response after tool executions") |
| 63 | + // Native protocol doesn't have the step-by-step list |
| 64 | + expect(guidelines).not.toContain("It is crucial to proceed step-by-step") |
| 65 | + }) |
54 | 66 | }) |
55 | 67 |
|
56 | | - it("should include simplified iterative process guidelines", () => { |
57 | | - const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE) |
| 68 | + describe("with MULTIPLE_NATIVE_TOOL_CALLS enabled", () => { |
| 69 | + it("should include multiple-tools-per-message guidance when experiment enabled", () => { |
| 70 | + const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE, { |
| 71 | + [EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true, |
| 72 | + }) |
| 73 | + |
| 74 | + expect(guidelines).toContain("you may use multiple tools in a single message") |
| 75 | + expect(guidelines).not.toContain("use one tool at a time per message") |
| 76 | + }) |
| 77 | + |
| 78 | + it("should include simplified iterative process guidelines", () => { |
| 79 | + const guidelines = getToolUseGuidelinesSection(TOOL_PROTOCOL.NATIVE, { |
| 80 | + [EXPERIMENT_IDS.MULTIPLE_NATIVE_TOOL_CALLS]: true, |
| 81 | + }) |
58 | 82 |
|
59 | | - expect(guidelines).toContain("carefully considering the user's response after tool executions") |
60 | | - // Native protocol doesn't have the step-by-step list |
61 | | - expect(guidelines).not.toContain("It is crucial to proceed step-by-step") |
| 83 | + expect(guidelines).toContain("carefully considering the user's response after tool executions") |
| 84 | + expect(guidelines).not.toContain("It is crucial to proceed step-by-step") |
| 85 | + }) |
62 | 86 | }) |
63 | 87 | }) |
64 | 88 |
|
|
0 commit comments