Compare commits

...

3 commits

Author SHA1 Message Date
igardev
a05c993987 Update documentation for llama-vscode 2026-03-02 23:50:46 +02:00
igardev
75bcee28d9 - Subagents implemented
- new agent Unit Test Writer
- new tool create_agent
- new agent "Agent creator"
2026-03-02 23:02:35 +02:00
igardev
97c82f3f11 Read SOUL.md and USER.md files from project root and add them in the prompt if they exist (similar to OpenClaw). 2026-02-23 17:50:21 +02:00
15 changed files with 728 additions and 52 deletions

View file

@ -338,7 +338,11 @@
},
"description": {
"type": "string",
"description": "Description of the model - for what purposes should be used, what are his strengths, etc."
"description": "Description of the agent - for what purposes should be used, what are his strengths, etc."
},
"subagentEnabled": {
"type": "string",
"description": "If the agent could be used as subagent of another agent to execute a specific task."
},
"systemInstruction": {
"type": "array",
@ -481,9 +485,213 @@
"get_diff",
"edit_file",
"ask_user",
"update_todo_list",
"delegate_task"
]
},
{
"name": "Unite test writer",
"description": "Writes the unit tests. The input should provide a path to a source file to be tested.",
"systemInstruction": [
"You are an expert software engineer specializing in writing unit tests. Your task is to generate highquality, reliable, and maintainable unit tests based on the users instructions and the provided source code. You must infer the programming language, testing framework, and project conventions from the source file and any accompanying context (such as imports, file extensions, or existing test files).",
"Tools & Environment",
"",
" read_file to examine the source code and any relevant configuration files (e.g., package.json, pom.xml, requirements.txt, Cargo.toml, etc.).",
"",
" edit_file to create or modify test files.",
"",
" run_terminal_command to execute tests and report results.",
"",
"Input & Context",
"",
"The user will give you the path to a source file that needs unit tests (e.g., src/services/user_service.py, lib/user.dart, internal/user.go). They may also include additional instructions, such as specific scenarios to cover or edge cases to consider.",
"Your Thought Process (Internal Reasoning)",
"",
"Before generating any code, work through these steps in your mind:",
"",
" Analyze the Source Code",
"",
" Use read_file to understand the modules purpose, its exported functions/classes/methods, input parameters, return types, and dependencies.",
"",
" Determine the programming language (from the file extension, shebang, or import/require statements).",
"",
" Identify all public APIs that need testing.",
"",
" Note side effects, asynchronous operations, or interactions with external systems (databases, APIs, file system, etc.).",
"",
" Infer the Testing Conventions",
"",
" Look for an existing test directory (e.g., test/, tests/, spec/, __tests__/) and the naming pattern of existing test files (e.g., *.test.js, *_test.py, *_spec.rb).",
"",
" Detect the testing framework being used:",
"",
" JavaScript/TypeScript: look for mocha, jest, jasmine in package.json.",
"",
" Python: look for pytest, unittest in imports or config files.",
"",
" Java: look for JUnit in pom.xml or build.gradle.",
"",
" Go: look for testing package imports, etc.",
"",
" Determine the preferred assertion style (e.g., assert module, expect, should, assertThat).",
"",
" If no existing tests or configuration are found, use the most common default for that language (e.g., pytest for Python, JUnit 5 for Java, go test for Go, Mocha + assert for Node.js).",
"",
" Plan the Test Structure",
"",
" Test file location: For a source file at src/path/to/file.ext, the test file should normally be placed at test/path/to/file_test.ext or follow the projects convention (mirroring the source directory under a test/ or tests/ root). Ensure the directory structure is created if needed.",
"",
" Plan the outer test suite (e.g., describe('moduleName', ...) in Mocha, a test class in JUnit, or a modulelevel docstring in pytest).",
"",
" Plan nested suites for each function or method.",
"",
" List all test cases (happy path, edge cases, error cases) with clear, descriptive names.",
"",
" Consider Dependencies and Mocking",
"",
" Identify the modules dependencies.",
"",
" Design the module under test to allow dependency injection your tests should inject simple, manual mocks or stubs to replace real dependencies.",
"",
" Do not introduce thirdparty mocking libraries unless they are already present in the project. Rely on manual mocks (e.g., creating test doubles yourself).",
"",
" Example: If a function imports an HTTP client, your test should inject a mock client that returns controlled data or throws predictable errors.",
"",
"Core Principles & Rules",
"",
"Adhere strictly to these principles in every test you write:",
"",
" Test Location: Test files must be created in the appropriate test directory (commonly test/, tests/, spec/, etc.) mirroring the source structure. Use the naming convention inferred from the project.",
"",
" Framework & Style: Use the testing framework and assertion style that the project already uses (or the default you inferred). Write idiomatic tests for that language.",
"",
" Test Quality:",
"",
" Tests must be isolated and idempotent the outcome of one test must not depend on another.",
"",
" Each test should verify one specific behavior.",
"",
" Test descriptions must be clear and descriptive, explaining the scenario and expected outcome.",
"",
" Properly handle asynchronous code using the languages native async patterns (e.g., async/await, Future, Promise). Ensure the test framework waits for completion.",
"",
" Reset any module state or mocks in setup/teardown hooks (e.g., beforeEach, setUp, @BeforeEach) to guarantee tests can run in any order.",
"",
" Code Generation:",
"",
" Output only the pure code for the test file, properly formatted.",
"",
" Include all necessary imports/requires for the module under test and the testing/assertion libraries.",
"",
" Import the actual functions/classes from the source file. Mocking is done inside the test, not by mocking the import itself.",
"",
" No Source Modification: You cannot modify the source code. If the source is untestable due to poor design (e.g., hardcoded dependencies), inform the user of the challenges and suggest refactoring the source to allow proper unit testing.",
"",
"Output Format",
"",
"Your final response must contain:",
"",
" A brief, nontechnical confirmation stating the language you inferred and the test file path you will create.",
"",
"Use the edit_file tool to create the file and the run_terminal_command tool (e.g., npx mocha 'test/services/userService.spec.ts') to verify your work, reporting the results back to the user.",
"",
"Crucially, you cannot modify the source code itself. If the source code is not testable due to poor design (e.g., hard-to-mock dependencies), you must inform the user of the challenges and suggest refactoring the source to allow for proper unit testing.",
""
],
"tools": [
"run_terminal_command",
"search_source",
"read_file",
"list_directory",
"regex_search",
"delete_file",
"edit_file",
"update_todo_list"
],
"subagentEnabled": true
},
{
"name": "Agent creator",
"description": "Creates new agent. Assists the user on creating a new agent by asking relevant questions and making suggestions.",
"subagentEnabled": true,
"systemInstruction": [
"You are an AI assistant specialized in helping users create new agents. Your task is to guide the user step by step, asking one question at a time, to collect all the necessary information for creating a new agent. Once you have all the required details, you will use the create_agent tool, passing the information as a JSON string in the format expected by the tool (as described in its documentation). After the agent is successfully created, inform the user that they can edit the newly created agent using the agent editor (Ctrl+Shift+M → Agents… → Edit agent…).",
"",
"Required Information:",
"",
" name (string): The name of the new agent.",
"",
" description (string): A brief description of what the agent does.",
"",
" systemInstruction (string): The system prompt or instructions that define the agent's behavior.",
"",
"Optional Information:",
"",
" subagentEnabled (boolean): Whether the agent can be used as a subagent within other agents. Ask the user for a yes/no answer; convert it to true or false (default to false if not specified).",
"",
" tools (string): A comma-separated list of tool names that the agent should have access to. If the user says \"none\" or leaves it blank, omit this field or set it to an empty string.",
"",
"Process:",
"",
" Begin by greeting the user and explaining that you will ask a series of questions to gather the details for the new agent.",
"",
" Ask for the name first. Wait for the user's response.",
"",
" After receiving the name, ask for the description.",
"",
" Then ask for the systemInstruction.",
"",
" Next, ask whether the agent should be usable as a subagent (subagentEnabled). Prompt for a yes/no answer. If the answer is ambiguous, ask for clarification.",
"",
" Finally, ask for any tools the agent should have. Prompt for a comma-separated list or indicate that they can say \"none\".",
"The available tools for the new agent are:",
"run_terminal_command: runs a terminal command and returns the output",
"search_source: searches the code base for the provided query and returns the most relevant chungs (works if RAG is enabled)",
"read_file: reads a file",
"list_directory: returns the content of a directory/folder",
"regex_search: does a regex search in the code base (requires RAG)",
"delete_file: deletes the a file",
"edit_file: creates are changes a source file",
"ask_user: asks user a question without interrupting the tools loop of the agent",
"llama_vscode_help: returns the documentation for llama-vscode extension",
"update_todo_list: creates or updates a todo list (plan)",
"delegate_task: delegates a task to a subagent and returns only the result (the subagent executes in another session, which reduces the context size)",
"create_agent: creates a new agent from the provided json string",
"",
" Once all information is collected, construct a JSON object with the appropriate keys. Ensure that boolean values are represented as true or false (without quotes) and that the tools string is included only if provided.",
"",
" Example JSON:",
" {",
" \"name\": \"ExampleAgent\",",
" \"description\": \"An agent that helps with example tasks.\",",
" \"systemInstruction\": \"You are a helpful assistant specialized in examples.\",",
" \"subagentEnabled\": true,",
" \"tools\": \"web_search,calculator\"",
" }",
"",
" Call the create_agent tool with this JSON string as the argument.",
"",
" After the tool executes successfully, inform the user that the agent has been created and remind them that they can edit it later via the agent editor (Ctrl+Shift+M → Agents… → Edit agent…). If the tool returns an error, explain the issue and ask the user to provide corrected information.",
"",
"Important Guidelines:",
"",
" Ask only one question at a time and wait for the user's response before proceeding.",
"",
" If the user provides incomplete or unclear answers, politely ask for clarification or more details.",
"",
" Do not assume default values without asking; always ask explicitly for optional fields, but you can mention that they can skip them if they want.",
"",
" Keep your tone friendly and helpful. Make the process feel like a guided conversation.",
"",
" After the agent is created, do not continue asking for more information unless the user wants to create another agent. If they do, you may restart the process.",
"",
""
],
"tools": [
"create_agent"
]
}
],
"description": "The list of the agents, which could be selected"
},
@ -1705,6 +1913,11 @@
"default": true,
"description": "Enable/disable tool run_terminal_command"
},
"llama-vscode.tool_create_agent_enabled": {
"type": "boolean",
"default": true,
"description": "Enable/disable tool create_agent"
},
"llama-vscode.tools_custom": {
"type": "array",
"description": "Array of tool definitions for REST requests to LLM",
@ -1884,6 +2097,11 @@
"default": true,
"description": "Enable/disable tool update_todo_list"
},
"llama-vscode.tool_delegate_task_enabled": {
"type": "boolean",
"default": true,
"description": "Enable/disable tool delegate_task"
},
"llama-vscode.tool_custom_tool_description": {
"type": "string",
"default": "Use this tool to get information about ...",

View file

@ -198,6 +198,12 @@ Settings:
- Health_check_chat_enabled: Enable/disable health check for chat model
- Health_check_embs_enabled: Enable/disable health check for embedding model
- Health_check_tools_enabled: Enable/disable health check for tools model
<img width="580" height="779" alt="image" src="https://github.com/user-attachments/assets/dca91333-687e-4856-b187-25df50d17b1c" />
<img width="580" height="779" alt="image" src="https://github.com/user-attachments/assets/bb29e0c8-85b4-4e7a-a3d9-f2d9a1679d3d" />
## Version 0.0.40 is released (05.01.2025)
## What is new
@ -691,6 +697,17 @@ There are different ways to select a model
- In Llama Agent click the button for selecting a model (completion, chat, embeddings, tools)
- In llama-vscode menu select "Completion models..." (or chat, embeddings, tools)
- Select an env. This will select the models, which are part of the env
## More context files
### What are AGENTS.md, SOUL.md, and USER.md
If in the project folder there are files: AGENTS.md, SOUL.md, and USER.md, they are used to provide additional context to the AI model when a request is sent.
AGENTS.md - instructions related with agents
SOUL.md - instructions related with the "soul" of the agent (how to behave, what values to follow, etc.)
USER.md - information about the user - preferences, additional information, etc.
These files are not mandatory. Ther are added because in some systems are quite popular and probably could be reused from there.
### How to use them
Just add one or more of these files to the project folder.
## Parallel Completions
### Overview
@ -992,6 +1009,18 @@ Settings:
https://github.com/user-attachments/assets/8f0b4575-104f-471c-be3f-f3d5b58aeee1
## Subagents
### What are subagents
Subagents are a way to optimize the user of LLM context. Some tasks are be executed in a separate session and only the final result is added to the context of the original agent session.
This is implemented with the tool delegate_task. If the delegate_task tool is enabled, the agent could decide to delegate some tasks to subagents. Each agent could be used as a subagent if it's field "Available as Subagent" is checked.
### How to use them
1. Make sure the tool delegate_task is enabled.
2. Make sure the agents you want to use as subagents have the field "Available as Subagent" checked and meaningful description.
3. Write a prompt, for which it is good idea to use the subagent. Alternatively, you could directly ask in the prompt to use the subagent.
The agent "Agent creator" makes it easier to create agents (which could be used as subagents).
## Update todos tool
### Overview

View file

@ -73,6 +73,7 @@ export class Configuration {
rag_max_context_file_chars = 10000
tool_run_terminal_command_enabled = true;
tool_create_agent_enabled = true;
tool_search_source_enabled = true;
tool_read_file_enabled = true;
tool_list_directory_enabled = true;
@ -92,6 +93,7 @@ export class Configuration {
tool_custom_eval_tool_code = "";
tool_llama_vscode_help_enabled = true;
tool_update_todo_list_enabled = true;
tool_delegate_task_enabled = true;
tools_max_iterations = 50;
plan_review_frequency = 5;
tools_log_calls = false;
@ -222,6 +224,7 @@ export class Configuration {
this.rag_max_context_files = Number(config.get<number>("rag_max_context_files"));
this.rag_max_context_file_chars = Number(config.get<number>("rag_max_context_file_chars"));
this.tool_run_terminal_command_enabled = Boolean(config.get<boolean>("tool_run_terminal_command_enabled"));
this.tool_create_agent_enabled = Boolean(config.get<boolean>("tool_create_agent_enabled"));
this.tool_search_source_enabled = Boolean(config.get<boolean>("tool_search_source_enabled"));
this.tool_read_file_enabled = Boolean(config.get<boolean>("tool_read_file_enabled"));
this.tool_list_directory_enabled = Boolean(config.get<boolean>("tool_list_directory_enabled"));
@ -234,6 +237,7 @@ export class Configuration {
this.tool_ask_user_enabled = Boolean(config.get<boolean>("tool_ask_user_enabled"));
this.tool_custom_tool_enabled = Boolean(config.get<boolean>("tool_custom_tool_enabled"));
this.tool_update_todo_list_enabled = Boolean(config.get<boolean>("tool_update_todo_list_enabled"));
this.tool_delegate_task_enabled = Boolean(config.get<boolean>("tool_delegate_task_enabled"));
this.tool_llama_vscode_help_enabled = Boolean(config.get<boolean>("tool_llama_vscode_help_enabled"));
this.tool_custom_tool_description = String(config.get<string>("tool_custom_tool_description"));
this.tool_custom_tool_source = String(config.get<string>("tool_custom_tool_source"));
@ -315,6 +319,7 @@ export class Configuration {
isToolChanged = (event: vscode.ConfigurationChangeEvent) => {
return event.affectsConfiguration("llama-vscode.tool_run_terminal_command_enabled")
|| event.affectsConfiguration("llama-vscode.tool_create_agent_enabled")
|| event.affectsConfiguration("llama-vscode.tool_search_source_enabled")
|| event.affectsConfiguration("llama-vscode.tool_list_directory_enabled")
|| event.affectsConfiguration("llama-vscode.tool_read_file_enabled")
@ -328,6 +333,7 @@ export class Configuration {
|| event.affectsConfiguration("llama-vscode.tool_get_diff_enabled")
|| event.affectsConfiguration("llama-vscode.tool_llama_vscode_help_enabled")
|| event.affectsConfiguration("llama-vscode.tool_update_todo_list_enabled")
|| event.affectsConfiguration("llama-vscode.tool_delegate_task_enabled")
|| event.affectsConfiguration("llama-vscode.tool_custom_eval_tool_enabled")
|| event.affectsConfiguration("llama-vscode.tool_custom_eval_tool_description")
|| event.affectsConfiguration("llama-vscode.tool_custom_eval_tool_property_description")

View file

@ -712,9 +712,131 @@ export const PREDEFINED_LISTS = new Map<string, any>([
"get_diff",
"edit_file",
"ask_user",
"update_todo_list"
"update_todo_list",
"delegate_task"
]
},
{
"name": "Unite test writer",
"description": "Writes the unit tests. The input should provide a path to a source file to be tested.",
"systemInstruction": [
"You are an expert software engineer specializing in writing unit tests. Your task is to generate highquality, reliable, and maintainable unit tests based on the users instructions and the provided source code. You must infer the programming language, testing framework, and project conventions from the source file and any accompanying context (such as imports, file extensions, or existing test files).",
"Tools & Environment",
"",
" read_file to examine the source code and any relevant configuration files (e.g., package.json, pom.xml, requirements.txt, Cargo.toml, etc.).",
"",
" edit_file to create or modify test files.",
"",
" run_terminal_command to execute tests and report results.",
"",
"Input & Context",
"",
"The user will give you the path to a source file that needs unit tests (e.g., src/services/user_service.py, lib/user.dart, internal/user.go). They may also include additional instructions, such as specific scenarios to cover or edge cases to consider.",
"Your Thought Process (Internal Reasoning)",
"",
"Before generating any code, work through these steps in your mind:",
"",
" Analyze the Source Code",
"",
" Use read_file to understand the modules purpose, its exported functions/classes/methods, input parameters, return types, and dependencies.",
"",
" Determine the programming language (from the file extension, shebang, or import/require statements).",
"",
" Identify all public APIs that need testing.",
"",
" Note side effects, asynchronous operations, or interactions with external systems (databases, APIs, file system, etc.).",
"",
" Infer the Testing Conventions",
"",
" Look for an existing test directory (e.g., test/, tests/, spec/, __tests__/) and the naming pattern of existing test files (e.g., *.test.js, *_test.py, *_spec.rb).",
"",
" Detect the testing framework being used:",
"",
" JavaScript/TypeScript: look for mocha, jest, jasmine in package.json.",
"",
" Python: look for pytest, unittest in imports or config files.",
"",
" Java: look for JUnit in pom.xml or build.gradle.",
"",
" Go: look for testing package imports, etc.",
"",
" Determine the preferred assertion style (e.g., assert module, expect, should, assertThat).",
"",
" If no existing tests or configuration are found, use the most common default for that language (e.g., pytest for Python, JUnit 5 for Java, go test for Go, Mocha + assert for Node.js).",
"",
" Plan the Test Structure",
"",
" Test file location: For a source file at src/path/to/file.ext, the test file should normally be placed at test/path/to/file_test.ext or follow the projects convention (mirroring the source directory under a test/ or tests/ root). Ensure the directory structure is created if needed.",
"",
" Plan the outer test suite (e.g., describe('moduleName', ...) in Mocha, a test class in JUnit, or a modulelevel docstring in pytest).",
"",
" Plan nested suites for each function or method.",
"",
" List all test cases (happy path, edge cases, error cases) with clear, descriptive names.",
"",
" Consider Dependencies and Mocking",
"",
" Identify the modules dependencies.",
"",
" Design the module under test to allow dependency injection your tests should inject simple, manual mocks or stubs to replace real dependencies.",
"",
" Do not introduce thirdparty mocking libraries unless they are already present in the project. Rely on manual mocks (e.g., creating test doubles yourself).",
"",
" Example: If a function imports an HTTP client, your test should inject a mock client that returns controlled data or throws predictable errors.",
"",
"Core Principles & Rules",
"",
"Adhere strictly to these principles in every test you write:",
"",
" Test Location: Test files must be created in the appropriate test directory (commonly test/, tests/, spec/, etc.) mirroring the source structure. Use the naming convention inferred from the project.",
"",
" Framework & Style: Use the testing framework and assertion style that the project already uses (or the default you inferred). Write idiomatic tests for that language.",
"",
" Test Quality:",
"",
" Tests must be isolated and idempotent the outcome of one test must not depend on another.",
"",
" Each test should verify one specific behavior.",
"",
" Test descriptions must be clear and descriptive, explaining the scenario and expected outcome.",
"",
" Properly handle asynchronous code using the languages native async patterns (e.g., async/await, Future, Promise). Ensure the test framework waits for completion.",
"",
" Reset any module state or mocks in setup/teardown hooks (e.g., beforeEach, setUp, @BeforeEach) to guarantee tests can run in any order.",
"",
" Code Generation:",
"",
" Output only the pure code for the test file, properly formatted.",
"",
" Include all necessary imports/requires for the module under test and the testing/assertion libraries.",
"",
" Import the actual functions/classes from the source file. Mocking is done inside the test, not by mocking the import itself.",
"",
" No Source Modification: You cannot modify the source code. If the source is untestable due to poor design (e.g., hardcoded dependencies), inform the user of the challenges and suggest refactoring the source to allow proper unit testing.",
"",
"Output Format",
"",
"Your final response must contain:",
"",
" A brief, nontechnical confirmation stating the language you inferred and the test file path you will create.",
"",
"Use the edit_file tool to create the file and the run_terminal_command tool (e.g., npx mocha 'test/services/userService.spec.ts') to verify your work, reporting the results back to the user.",
"",
"Crucially, you cannot modify the source code itself. If the source code is not testable due to poor design (e.g., hard-to-mock dependencies), you must inform the user of the challenges and suggest refactoring the source to allow for proper unit testing.",
""
],
"tools": [
"run_terminal_command",
"search_source",
"read_file",
"list_directory",
"regex_search",
"delete_file",
"edit_file",
"update_todo_list"
],
"subagentEnabled": false
},
{
"name": "Ask",
"description": "This is an agent for questions about source code without changing it.",
@ -765,6 +887,87 @@ export const PREDEFINED_LISTS = new Map<string, any>([
"get_diff",
"ask_user"
]
},
{
"name": "Agent creator",
"description": "Creates new agent. Assists the user on creating a new agent by asking relevant questions and making suggestions.",
"subagentEnabled": true,
"systemInstruction": [
"You are an AI assistant specialized in helping users create new agents. Your task is to guide the user step by step, asking one question at a time, to collect all the necessary information for creating a new agent. Once you have all the required details, you will use the create_agent tool, passing the information as a JSON string in the format expected by the tool (as described in its documentation). After the agent is successfully created, inform the user that they can edit the newly created agent using the agent editor (Ctrl+Shift+M → Agents… → Edit agent…).",
"",
"Required Information:",
"",
" name (string): The name of the new agent.",
"",
" description (string): A brief description of what the agent does.",
"",
" systemInstruction (string): The system prompt or instructions that define the agent's behavior.",
"",
"Optional Information:",
"",
" subagentEnabled (boolean): Whether the agent can be used as a subagent within other agents. Ask the user for a yes/no answer; convert it to true or false (default to false if not specified).",
"",
" tools (string): A comma-separated list of tool names that the agent should have access to. If the user says \"none\" or leaves it blank, omit this field or set it to an empty string.",
"",
"Process:",
"",
" Begin by greeting the user and explaining that you will ask a series of questions to gather the details for the new agent.",
"",
" Ask for the name first. Wait for the user's response.",
"",
" After receiving the name, ask for the description.",
"",
" Then ask for the systemInstruction.",
"",
" Next, ask whether the agent should be usable as a subagent (subagentEnabled). Prompt for a yes/no answer. If the answer is ambiguous, ask for clarification.",
"",
" Finally, ask for any tools the agent should have. Prompt for a comma-separated list or indicate that they can say \"none\".",
"The available tools for the new agent are:",
"run_terminal_command: runs a terminal command and returns the output",
"search_source: searches the code base for the provided query and returns the most relevant chungs (works if RAG is enabled)",
"read_file: reads a file",
"list_directory: returns the content of a directory/folder",
"regex_search: does a regex search in the code base (requires RAG)",
"delete_file: deletes the a file",
"edit_file: creates are changes a source file",
"ask_user: asks user a question without interrupting the tools loop of the agent",
"llama_vscode_help: returns the documentation for llama-vscode extension",
"update_todo_list: creates or updates a todo list (plan)",
"delegate_task: delegates a task to a subagent and returns only the result (the subagent executes in another session, which reduces the context size)",
"create_agent: creates a new agent from the provided json string",
"",
" Once all information is collected, construct a JSON object with the appropriate keys. Ensure that boolean values are represented as true or false (without quotes) and that the tools string is included only if provided.",
"",
" Example JSON:",
" {",
" \"name\": \"ExampleAgent\",",
" \"description\": \"An agent that helps with example tasks.\",",
" \"systemInstruction\": \"You are a helpful assistant specialized in examples.\",",
" \"subagentEnabled\": true,",
" \"tools\": \"web_search,calculator\"",
" }",
"",
" Call the create_agent tool with this JSON string as the argument.",
"",
" After the tool executes successfully, inform the user that the agent has been created and remind them that they can edit it later via the agent editor (Ctrl+Shift+M → Agents… → Edit agent…). If the tool returns an error, explain the issue and ask the user to provide corrected information.",
"",
"Important Guidelines:",
"",
" Ask only one question at a time and wait for the user's response before proceeding.",
"",
" If the user provides incomplete or unclear answers, politely ask for clarification or more details.",
"",
" Do not assume default values without asking; always ask explicitly for optional fields, but you can mention that they can skip them if they want.",
"",
" Keep your tone friendly and helpful. Make the process feel like a guided conversation.",
"",
" After the agent is created, do not continue asking for more information unless the user wants to create another agent. If they do, you may restart the process.",
"",
""
],
"tools": [
"create_agent"
]
}
]],
[PREDEFINED_LISTS_KEYS.AGENT_COMMANDS, [

View file

@ -42,6 +42,19 @@ export class LlamaAgent {
resetMessages = () => {
let systemPromt = this.app.prompts.TOOLS_SYSTEM_PROMPT_ACTION;
if (this.app.isAgentSelected()) systemPromt = this.app.getAgent().systemInstruction.join("\n")
if (this.app.configuration.tool_delegate_task_enabled) {
let agentPromtPrefix = " \n\n " + this.app.prompts.SUBAGENTS_DESCRIPTION;
agentPromtPrefix += " \n\n Subagents:";
let subagentsList = "";
for (let agent of this.app.configuration.agents_list) {
if (agent.subagentEnabled){
subagentsList += " \n" + agent.name + ": " + agent.description;
}
}
if (subagentsList.length > 0) {
systemPromt += agentPromtPrefix + subagentsList;
}
}
let worspaceFolder = "";
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[0]){
worspaceFolder = " Project root folder: " + vscode.workspace.workspaceFolders[0].uri.fsPath;
@ -58,12 +71,19 @@ export class LlamaAgent {
const absolutePath = Utils.getAbsolutFilePath("llama-vscode-rules.md");
if (fs.existsSync(absolutePath)) {
projectContext += " \n\nAdditional rules from the user: \n" + fs.readFileSync(absolutePath, "utf-8");
} else {
const agentsAbsolutePath = Utils.getAbsolutFilePath("AGENTS.md");
if (fs.existsSync(agentsAbsolutePath)) {
projectContext += " \n\nInstructions from " + agentsAbsolutePath + ": \n" + fs.readFileSync(agentsAbsolutePath, "utf-8");
}
}
}
}
const agentsAbsolutePath = Utils.getAbsolutFilePath("AGENTS.md");
if (fs.existsSync(agentsAbsolutePath)) {
projectContext += " \n\nInstructions from " + agentsAbsolutePath + ": \n" + fs.readFileSync(agentsAbsolutePath, "utf-8");
}
const soulAbsolutePath = Utils.getAbsolutFilePath("SOUL.md");
if (fs.existsSync(soulAbsolutePath)) {
projectContext += " \n\n AI soul desription from " + soulAbsolutePath + ": \n" + fs.readFileSync(soulAbsolutePath, "utf-8");
}
const userInstructionsPath = Utils.getAbsolutFilePath("USER.md");
if (fs.existsSync(userInstructionsPath)) {
projectContext += " \n\nUser profile from " + userInstructionsPath + ": \n" + fs.readFileSync(userInstructionsPath, "utf-8");
}
this.messages = [
{
@ -74,15 +94,15 @@ export class LlamaAgent {
this.logText = "";
}
selectChat = (chat: Chat) => {
if (chat && chat.defaultAgent) this.app.agentService.selectAgent(chat.defaultAgent);
selectChat = async (chat: Chat) => {
if (chat && chat.defaultAgent) await this.app.agentService.selectAgent(chat.defaultAgent);
this.resetMessages();
if (chat){
const currentChat = this.app.getChat();
this.messages = chat.messages??[];
this.logText = chat.log??"";
}
}
// this.app.llamaWebviewProvider.logInUi(this.logText);
this.resetContext();
}
@ -383,15 +403,7 @@ export class LlamaAgent {
this.logText += " \nAgent session finished. \n\n"
this.app.llamaWebviewProvider.logInUi(this.logText);
this.app.llamaWebviewProvider.setState("AI finished")
let chat = this.app.getChat()
if (!this.app.isChatSelected()){
chat.name = this.logText.slice(0, 25);
chat.id = Date.now().toString(36);
chat.description = new Date().toLocaleString() + " " + this.logText.slice(0,150)
}
chat.messages = this.messages;
chat.log = this.logText;
await this.app.chatService.selectUpdateChat(chat)
await this.updateChat();
// Clean up AbortController
this.abortController = null;
@ -429,6 +441,18 @@ export class LlamaAgent {
return progress;
}
public async updateChat() {
let chat = this.app.getChat();
if (!this.app.isChatSelected()) {
chat.name = this.logText.slice(0, 25);
chat.id = Date.now().toString(36);
chat.description = new Date().toLocaleString() + " " + this.logText.slice(0, 150);
}
chat.messages = this.messages;
chat.log = this.logText;
await this.app.chatService.selectUpdateChat(chat);
}
private removeFile(todoFile: string) {
if (fs.existsSync(todoFile)) {
fs.unlinkSync(todoFile);

View file

@ -274,7 +274,7 @@ export class LlamaServer {
}
}
return {
return {
"messages": filteredMsgs,
"stream": stream,
"temperature": 0.8,

View file

@ -52,17 +52,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
this.app.llamaAgent.run(message.text, message.agentCommand);
break;
case 'clearText':
this.app.llamaAgent.resetMessages();
this.app.llamaAgent.resetContext()
await this.app.chatService.selectUpdateChat({name:"", id:""})
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
command: 'updateText',
text: ''
});
webviewView.webview.postMessage({
command: 'updateContextImage',
image: ""
});
await this.clearChatText(webviewView);
break;
case 'showChatsHistory':
this.app.chatService.selectChatFromList();
@ -155,7 +145,11 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
break;
case 'selectAgent':
let agentsList = this.app.configuration.agents_list
await this.app.agentService.pickAndSelectAgent(agentsList)
let shouldContinue = await Utils.showYesNoDialog("This will remove the current conversation. Do you want to continue?")
if (shouldContinue) {
await this.app.agentService.pickAndSelectAgent(agentsList)
await this.clearChatText(webviewView);
}
break;
case 'chatWithAI':
this.app.askAi.closeChatWithAi(false);
@ -283,6 +277,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
let agentToSave: Agent = {
name: message.name,
description: message.description,
subagentEnabled: message.subagentEnabled,
systemInstruction: message.systemInstruction.split(/\r?\n/),
toolsModel: agentModelToSave,
tools: message.tools
@ -306,6 +301,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
const newAgent: Agent = {
name: message.name,
description: message.description,
subagentEnabled: message.subagentEnabled,
systemInstruction: message.systemInstruction,
toolsModel: toolsModel,
tools: message.tools
@ -361,6 +357,20 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
}, 1000);
}
private async clearChatText(webviewView: vscode.WebviewView) {
this.app.llamaAgent.resetMessages();
this.app.llamaAgent.resetContext();
await this.app.chatService.selectUpdateChat({ name: "", id: "" });
vscode.commands.executeCommand('llama-vscode.webview.postMessage', {
command: 'updateText',
text: ''
});
webviewView.webview.postMessage({
command: 'updateContextImage',
image: ""
});
}
public addEditAgent(agent: Agent) {
this.app.agentService.resetEditedAgentTools();
agent.tools?.map(tool => this.app.agentService.addEditedAgentTools(tool, ""));
@ -370,6 +380,7 @@ export class LlamaWebviewProvider implements vscode.WebviewViewProvider {
command: 'loadAgent',
name: agent?.name,
description: agent?.description,
subagentEnabled: agent?.subagentEnabled,
systemInstruction: agent?.systemInstruction.join("\n"),
toolsModel: agent?.toolsModel?.name??'',
tools: Array.from(edAgtools.entries())

View file

@ -275,6 +275,42 @@ Replace the entire TODO list with an updated checklist reflecting the current st
TOOL_UPDATE_TODO_LIST_PARAMETER_DESCRIPTION = `Full markdown checklist in execution order, using [ ] for pending, [x] for completed, and [-] for in progress`
TOOL_DELEGATE_TASK_DESCRIPTION = `Delegates a specific task to a subagent.
Use this when you encounter a subtask that is better handled by a dedicated agent (e.g. providing help for llama.vscode, performing calculations, retrieving specific data) or for optimizing context length.
Provide the subagent's name and a clear, self-contained description of the task to be performed.
Optionally, include relevant context (such as user preferences or key conversation snippets) to help the subagent.
The subagent will execute the task using its own tools and return a result.
If the delegation fails, an error status with details will be returned.`
TOOL_CREATE_AGENT_DESCRIPTION = `Creates a new agent in the system. The agent's configuration must be provided as a JSON string conforming to the schema defined in the description of property "agent_json".
Upon successful creation, returns a confirmation message containing the unique identifier of the new agent. Ensure that any tool names listed in the tools field correspond to existing tools in the system.`
PROPERTY_AGENT_JSON_DESCRIPTION = `A JSON string that defines the agent to be created. The object must include the following fields:
name (string): The name of the agent.
description (string): A brief explanation of the agent's purpose and behavior.
subagentEnabled (boolean): Set to true if this agent can be invoked as a subagent by other agents; otherwise false.
systemInstruction (string): The system prompt or instruction that guides the agent's responses and actions.
tools (string, optional): A comma-separated list of tool names that the agent is permitted to use. Do not include spaces around the commas (e.g., "tool1,tool2,tool3"). If omitted, the agent will have no tools.
Example value:
{
"name": "CustomerSupportAgent",
"description": "Handles customer inquiries and returns troubleshooting steps.",
"subagentEnabled": true,
"systemInstruction": "You are a helpful customer support representative...",
"tools": "searchKnowledgeBase,ticketCreator"
}
`
SUBAGENTS_DESCRIPTION = `Subagents
You have access to specialized subagents via the delegate_task tool. Use it when you encounter a welldefined subtask that can be handled independently for example, providing help for llama.vscode, performing complex calculations, or retrieving data from a specific source.
If the delegation fails (error or timeout), decide whether to retry with a different subagent, handle the task yourself, or report the issue to the user.`
constructor(application: Application) {
this.app = application;
}

View file

@ -113,10 +113,14 @@ export class AgentService {
this.app.setAgent(agent);
const allTools = Array.from(this.app.tools.toolsFunc.keys());
for (let toolName of allTools) {
this.app.configuration.updateConfigValue(`tool_${toolName}_enabled`, agent.tools?.includes(toolName) ?? false);
try {
await this.app.configuration.updateConfigValue(`tool_${toolName}_enabled`, agent.tools?.includes(toolName) ?? false);
} catch (err) {
vscode.window.showErrorMessage("Error updating tools configuration.")
}
}
if (agent.toolsModel && agent.toolsModel.name) {
this.app.modelService.selectStartModel(agent.toolsModel, ModelType.Tools, this.app.modelService.getTypeDetails(ModelType.Tools))
await this.app.modelService.selectStartModel(agent.toolsModel, ModelType.Tools, this.app.modelService.getTypeDetails(ModelType.Tools))
}
await this.app.persistence.setValue(PERSISTENCE_KEYS.SELECTED_AGENT, agent);
this.app.llamaWebviewProvider.updateLlamaView();
@ -175,6 +179,7 @@ export class AgentService {
let agentExisting = agentsList.find(agn => agn.name.trim() == editedAgent.name.trim())
if (agentExisting){
agentExisting.description = editedAgent.description
agentExisting.subagentEnabled = editedAgent.subagentEnabled
agentExisting.systemInstruction = editedAgent.systemInstruction
agentExisting.toolsModel = editedAgent.toolsModel
agentExisting.tools = editedAgent.tools
@ -357,6 +362,7 @@ export class AgentService {
"\nname: " + agent.name +
"\ndescription: " + agent.description +
"\nsystem prompt: \n" + agent.systemInstruction.join("\n") +
"\nsubagent enabled: " + agent.subagentEnabled +
"\ntools model: \n" + agent.toolsModel?.name +
"\n\ntools: " + (agent.tools ? agent.tools.join(", ") : "");
}

View file

@ -41,16 +41,16 @@ export class ChatService {
}
selectUpdateChat = async (chatToSelect: Chat) => {
if (chatToSelect.id != this.app.getChat().id){
if (!chatToSelect.id){
this.app.setChat(chatToSelect);
await this.app.persistence.setValue(PERSISTENCE_KEYS.SELECTED_CHAT, this.app.getChat());
} else {
await this.updateChatHistory();
this.app.setChat(chatToSelect);
await this.app.persistence.setValue(PERSISTENCE_KEYS.SELECTED_CHAT, chatToSelect);
this.app.llamaAgent.selectChat(chatToSelect);
await this.app.llamaAgent.selectChat(chatToSelect);
this.app.llamaWebviewProvider.updateLlamaView();
} else {
this.app.setChat(chatToSelect);
await this.app.persistence.setValue(PERSISTENCE_KEYS.SELECTED_CHAT, this.app.getChat());
}
}
}
deleteChatFromList = async (chatList: Chat[]) => {

View file

@ -5,6 +5,7 @@ import path from "path";
import fs from 'fs';
import { Plugin } from './plugin';
import { UI_TEXT_KEYS } from "./constants";
import { Chat, Agent } from "./types";
type ToolsMap = Map<string, (...args: any[]) => any>;
@ -31,6 +32,8 @@ export class Tools {
this.toolsFunc.set("custom_eval_tool", this.customEvalTool)
this.toolsFunc.set("llama_vscode_help", this.llamaVscodeHelp)
this.toolsFunc.set("update_todo_list", this.updateTodoList)
this.toolsFunc.set("delegate_task", this.delegateTask)
this.toolsFunc.set("create_agent", this.createAgent)
this.toolsFuncDesc.set("run_terminal_command", this.runTerminalCommandDesc);
this.toolsFuncDesc.set("search_source", this.searchSourceDesc)
this.toolsFuncDesc.set("read_file", this.readFileDesc)
@ -44,7 +47,9 @@ export class Tools {
this.toolsFuncDesc.set("custom_eval_tool", this.customEvalToolDesc)
this.toolsFuncDesc.set("llama_vscode_help", this.llamaVscodeHelpDesc)
this.toolsFuncDesc.set("update_todo_list", this.updateTodoListDesc)
this.toolsFuncDesc.set("update_todo_list", this.updateTodoListDesc);
this.toolsFuncDesc.set("delegate_task", this.delegateTaskDesc)
this.toolsFuncDesc.set("create_agent ", this.createAgentDesc);
}
public runTerminalCommand = async (args: string ) => {
@ -394,7 +399,7 @@ export class Tools {
return "The todos are created/updated."
}
public updateTodoListDesc = async (args: string) => {
let ret = "update_todo_list tool is executed. \n\n"
let params = JSON.parse(args);
@ -402,8 +407,89 @@ export class Tools {
return ret
}
public delegateTask = async (args: string) => {
let params = JSON.parse(args);
let finalAnswer = "No answer from the subagent.";
if (params.subagent_name) {
// store current agent
await this.app.llamaAgent.updateChat()
let parentChat = this.app.getChat();
parentChat.defaultAgent = this.app.getAgent();
let subagent: Agent = this.app.configuration.agents_list.find(agent => agent.name == params.subagent_name)
if (!subagent) return "No subagent found with name " + params.subagent_name;
this.app.llamaAgent.resetContext();
let newChatName = "delegate_task" + Date.now()
let newSubagent: Agent = { ...subagent };
if (subagent.tools){
// clone the tools to avoid changing the original agent
newSubagent.tools = [...subagent.tools];
} else {
newSubagent.tools = [];
}
newSubagent.tools.push("ask_user")
// The goal is to get the answer from the subagent in one tools loop - so use a tool call if user input is needed
newSubagent.systemInstruction.push("For questions to the user, please use the tool 'ask_user'.")
let newChat: Chat = {
name: newChatName,
id: newChatName,
messages: [],
defaultAgent: newSubagent,
log: "subagent: " + params.subagent_name + " \n \n"
}
await this.app.chatService.selectUpdateChat(newChat)
if (params.task) {
finalAnswer = await this.app.llamaAgent.askAgent(params.task)
} else {
return "No task provided."
}
await this.app.chatService.selectUpdateChat(parentChat)
this.app.llamaWebviewProvider.setState("AI is working")
} else {
return "No subagent name provided."
}
return finalAnswer
}
public delegateTaskDesc = async (args: string) => {
let ret = "delegate_task tool is executed. \n\n"
let params = JSON.parse(args);
if (params.task && params.subagent_name) ret += "subagent: " + params.subagent_name + "\ntask: " + params.task
return ret.split(/\r?\n/).join(" \n")
}
public createAgent = async (args: string) => {
let params = JSON.parse(args);
let finalAnswer = "The agent is created";
if (params.agent_json) {
let receivedAgent = JSON.parse(params.agent_json)
let newAgent:Agent = {
name: receivedAgent.name,
description: receivedAgent.description,
subagentEnabled: receivedAgent.subagentEnabled??false,
systemInstruction: receivedAgent.systemInstruction.split(/\r?\n/)
}
if (receivedAgent.tools) {
newAgent.tools = receivedAgent.tools.split(",")
}
// TODO check if one more parsing of agent_json is needed
await this.app.agentService.addUpdateAgent(newAgent)
} else {
return "No agent provided."
}
return finalAnswer
}
public createAgentDesc = async (args: string) => {
let ret = "create_agent tool is executed. \n\n"
// let params = JSON.parse(args);
// if (params.task && params.subagent_name) ret += "subagent: " + params.subagent_name + "\ntask: " + params.task
return ret.split(/\r?\n/).join(" \n")
}
public init = () => {
this.tools = [
@ -685,6 +771,50 @@ export class Tools {
}
}
] : []),
...(this.app.configuration.tool_create_agent_enabled ? [
{
"type": "function",
"function": {
"name": "create_agent",
"description": this.app.prompts.TOOL_CREATE_AGENT_DESCRIPTION,
"parameters": {
"type": "object",
"properties": {
"agent_json": {
"description": this.app.prompts.PROPERTY_AGENT_JSON_DESCRIPTION,
"type": "string",
},
},
"required": [],
},
"strict": true
}
}
] : []),
...(this.app.configuration.tool_delegate_task_enabled ? [
{
"type": "function",
"function": {
"name": "delegate_task",
"description": this.app.prompts.TOOL_DELEGATE_TASK_DESCRIPTION,
"parameters": {
"type": "object",
"properties": {
"subagent_name": {
"description": "Name of the subagent to invoke. Must be one of the available subagents listed in the system prompt.",
"type": "string",
},
"task": {
"description": "Description of the task to be delegated to the subagent.",
"type": "string",
},
},
"required": [],
},
"strict": true
}
}
] : []),
]
for (let tool of this.app.configuration.tools_custom){

View file

@ -197,4 +197,5 @@ export const translations: string[][] = [
["Copy agent...", "Копиране на агент...", "Agent kopieren...", "Копировать агента...", "Copiar agente...", "复制代理...", "Copier l'agent..."],
["Edit multiple files with AI", "Редактиране на множество файлове с изкуствен интелект", "Mehrere Dateien mit KI bearbeiten", "Редактировать несколько файлов с ИИ", "Editar múltiples archivos con IA", "使用人工智能编辑多个文件", "Modifier plusieurs fichiers avec IA"],
["Asks for glob pattern and prompt and edits with AI the files, which match the glob pattern with the provided prompt.", "Пита за шаблон за обхват и инструкция, след което редактира с изкуствен интелект файловете, които отговарят на шаблона, със зададената инструкция.", "Fragt nach einem Glob-Muster und einer Eingabeaufforderung und bearbeitet mit KI die Dateien, die dem Glob-Muster mit der bereitgestellten Eingabeaufforderung entsprechen.", "Запрашивает шаблон glob и подсказку, а затем редактирует с помощью ИИ файлы, соответствующие шаблону, с предоставленной подсказкой.", "Pide un patrón glob y un mensaje, y edita con IA los archivos que coinciden con el patrón glob con el mensaje proporcionado.", "请求输入通配符模式和提示词,然后使用人工智能编辑符合该通配符模式的文件,并根据提供的提示词进行修改。", "Demande un motif glob et une invite, puis modifie avec IA les fichiers correspondant au motif glob avec l'invite fournie."],
["This will remove the current conversation. Do you want to continue?", "Това ще премахне текущия разговор. Искате ли да продължите?", "Dadurch wird die aktuelle Unterhaltung gelöscht. Möchten Sie fortfahren?", "Это удалит текущий разговор. Хотите продолжить?", "Esto eliminará la conversación actual. ¿Quieres continuar?", "这将删除当前对话。是否要继续?", "Cela supprimera la conversation en cours. Voulez-vous continuer?"],
];

View file

@ -60,6 +60,7 @@ export interface Env {
export interface Agent {
name: string,
description?: string,
subagentEnabled?: boolean,
systemInstruction: string[],
toolsModel?: LlmModel,
tools?: string[]

View file

@ -51,7 +51,7 @@ const App: React.FC<AppProps> = () => {
const [contextFiles, setContextFiles] = useState<Map<string, string>>(new Map());
const [imagePath, setContextImage] = useState<string>("");
const [agentEditTools, setAgentEditTools] = useState<Map<string, string>>(new Map());
const [agentEditDetails, setAgentEditDetails] = useState<{name:string, description:string, systemInstruction:string, toolsModel: string}>({name:"", description:"", systemInstruction:"", toolsModel:""});
const [agentEditDetails, setAgentEditDetails] = useState<{name:string, description:string, systemInstruction:string, toolsModel: string, subagentEnabled: boolean}>({name:"", description:"", systemInstruction:"", toolsModel:"", subagentEnabled: false});
// Save state to VS Code whenever it changes
useEffect(() => {
@ -106,10 +106,10 @@ const App: React.FC<AppProps> = () => {
setContextImage(message.image || "");
break;
case 'updateAgentEdit':
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel});
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel,subagentEnabled: message.subagentEnabled});
break;
case 'loadAgent':
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel});
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel, subagentEnabled: message.subagentEnabled});
setCurrentAgentModel(message.toolsModel);
setAgentEditTools(new Map(message.tools || []));
break;

View file

@ -10,8 +10,8 @@ interface AgentEditorProps {
setCurrentState: (state: string) => void;
contextFiles: Map<string, string>;
setContextFiles: (files: Map<string, string>) => void;
agentEditDetails: {name: string, description: string, systemInstruction: string, toolsModel: string}
setAgentEditDetails:(agentDetails: {name: string, description: string, systemInstruction: string, toolsModel: string}) => void
agentEditDetails: {name: string, description: string, systemInstruction: string, toolsModel: string, subagentEnabled: boolean}
setAgentEditDetails:(agentDetails: {name: string, description: string, systemInstruction: string, toolsModel: string, subagentEnabled: boolean}) => void
}
const AgentEditor: React.FC<AgentEditorProps> = ({
@ -90,7 +90,7 @@ const AgentEditor: React.FC<AgentEditorProps> = ({
setTools(new Map(message.files || []));
break;
case 'loadAgent':
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel});
setAgentEditDetails({name: message.name, description: message.description, systemInstruction: message.systemInstruction, toolsModel: message.toolsModel, subagentEnabled: message.subagentEnabled});
setTools(new Map(message.tools || []));
currentAgentModel = message.toolsModel;
break;
@ -120,6 +120,7 @@ const AgentEditor: React.FC<AgentEditorProps> = ({
vscode.postMessage({
command: 'saveEditAgent',
name: agentEditDetails.name,
subagentEnabled: agentEditDetails.subagentEnabled,
description: agentEditDetails.description,
systemInstruction: agentEditDetails.systemInstruction,
toolsModel: currentAgentModel,
@ -357,7 +358,7 @@ const AgentEditor: React.FC<AgentEditorProps> = ({
<textarea
ref={elemNameRef}
value={agentEditDetails.name}
onChange={(e) => setAgentEditDetails({name: e.target.value, description: agentEditDetails.description, systemInstruction: agentEditDetails.systemInstruction, toolsModel: agentEditDetails.toolsModel})}
onChange={(e) => setAgentEditDetails({name: e.target.value, description: agentEditDetails.description, systemInstruction: agentEditDetails.systemInstruction, toolsModel: agentEditDetails.toolsModel,subagentEnabled: agentEditDetails.subagentEnabled})}
placeholder="Enter agent name."
className="modern-textarea"
rows={1}
@ -369,7 +370,7 @@ const AgentEditor: React.FC<AgentEditorProps> = ({
<textarea
ref={elemDescriptionRef}
value={agentEditDetails.description}
onChange={(e) => setAgentEditDetails({name: agentEditDetails.name, description: e.target.value, systemInstruction: agentEditDetails.systemInstruction, toolsModel: agentEditDetails.toolsModel})}
onChange={(e) => setAgentEditDetails({name: agentEditDetails.name, description: e.target.value, systemInstruction: agentEditDetails.systemInstruction, toolsModel: agentEditDetails.toolsModel, subagentEnabled: agentEditDetails.subagentEnabled})}
placeholder="Enter agent description."
className="modern-textarea"
rows={2}
@ -381,12 +382,22 @@ const AgentEditor: React.FC<AgentEditorProps> = ({
<textarea
ref={elemSystemPromptRef}
value={agentEditDetails.systemInstruction}
onChange={(e) => setAgentEditDetails({name: agentEditDetails.name, description: agentEditDetails.description, systemInstruction: e.target.value, toolsModel: agentEditDetails.toolsModel})}
onChange={(e) => setAgentEditDetails({name: agentEditDetails.name, description: agentEditDetails.description, systemInstruction: e.target.value, toolsModel: agentEditDetails.toolsModel, subagentEnabled: agentEditDetails.subagentEnabled})}
placeholder="Enter system instructions for the agent."
className="modern-textarea"
rows={10}
style={{ height: 'auto', minHeight: '15em', resize: 'vertical' }}
/>
<div style={{ marginBottom: '20px', marginTop: '10px', fontWeight: 'bold' }}>
<label className="checkbox-label" title="If enabled - the agent could be used as a subagent.">
<input
type="checkbox"
checked={agentEditDetails.subagentEnabled}
onChange={(e) => setAgentEditDetails({name: agentEditDetails.name, description: e.target.value, systemInstruction: agentEditDetails.systemInstruction, toolsModel: agentEditDetails.toolsModel, subagentEnabled: e.target.checked})}
/>
<span style={{ marginLeft: '8px' }}>Available as Subagent</span>
</label>
</div>
<div className="single-button-frame">
<div className="frame-label">Agent Model (Optional)</div>