diff --git a/plugins/AI-Agent-Local/src/main/assets/prompts/tools.yml b/plugins/AI-Agent-Local/src/main/assets/prompts/tools.yml index e44632f0..c439cdb7 100644 --- a/plugins/AI-Agent-Local/src/main/assets/prompts/tools.yml +++ b/plugins/AI-Agent-Local/src/main/assets/prompts/tools.yml @@ -13,8 +13,8 @@ tool_call_format: examples: - purpose: Greeting / question you can answer -> respond call: '{"tool":"respond","args":{"message":"Hi! What would you like to build?"}}' - - purpose: Open a file (a bare name is fine here) -> open_file - call: '{"tool":"open_file","args":{"file_path":"{{EXAMPLE_FILE_NAME}}"}}' + - purpose: Show or read a file (source, build.gradle, strings.xml; a bare name is fine) -> read_file + call: '{"tool":"read_file","args":{"file_path":"{{EXAMPLE_FILE_NAME}}"}}' - purpose: Change one line of a file -> edit_file call: '{"tool":"edit_file","args":{"file_path":"{{EXAMPLE_FILE_PATH}}","old_string":"setTitle(\"Old\")","new_string":"setTitle(\"New\")"}}' - purpose: Change two lines (note the \n, never a real line break) -> edit_file diff --git a/plugins/AI-Agent-Local/src/test/kotlin/com/itsaky/androidide/plugins/aiagentlocal/prompt/LocalSystemPromptTest.kt b/plugins/AI-Agent-Local/src/test/kotlin/com/itsaky/androidide/plugins/aiagentlocal/prompt/LocalSystemPromptTest.kt index c9eefd76..df5a2722 100644 --- a/plugins/AI-Agent-Local/src/test/kotlin/com/itsaky/androidide/plugins/aiagentlocal/prompt/LocalSystemPromptTest.kt +++ b/plugins/AI-Agent-Local/src/test/kotlin/com/itsaky/androidide/plugins/aiagentlocal/prompt/LocalSystemPromptTest.kt @@ -100,6 +100,15 @@ class LocalSystemPromptTest { assertTrue(prompt.contains(""""query":"Foo"""")) } + @Test + fun givenTheShippedExamples_whenBuilding_thenOneShowsHowToReadAFile() { + // "Show me app/build.gradle" went to search_project while the prompt had no read_file example. + assertTrue( + prompt(examplePath = "src/Foo.kt") + .contains("""{"tool":"read_file","args":{"file_path":"Foo.kt"}}""") + ) + } + @Test fun givenADotfileExamplePath_whenBuilding_thenTheStemIsItsWholeName() { assertTrue(prompt(examplePath = "app/.gitignore").contains(""""query":".gitignore"""")) diff --git a/plugins/AI-Core/src/main/assets/prompts/tool_descriptions.yml b/plugins/AI-Core/src/main/assets/prompts/tool_descriptions.yml index a384fb21..d442ccfe 100644 --- a/plugins/AI-Core/src/main/assets/prompts/tool_descriptions.yml +++ b/plugins/AI-Core/src/main/assets/prompts/tool_descriptions.yml @@ -34,7 +34,7 @@ built_in_tools: arguments: file_path: Project-relative path of the file to open. read_build_output: - description: Read the current build output and status + description: Read the log of the last build and whether it passed; to read build.gradle or any other file, use read_file create_file: description: Create a new file with given content arguments: