|
14 | 14 | from ...types_ import (
|
15 | 15 | BashCommand,
|
16 | 16 | BashInteraction,
|
| 17 | + ContextSave, |
17 | 18 | FileEdit,
|
18 | 19 | GetScreenInfo,
|
19 | 20 | Initialize,
|
@@ -46,14 +47,47 @@ async def handle_read_resource(uri: AnyUrl) -> str:
|
46 | 47 |
|
47 | 48 | @server.list_prompts() # type: ignore
|
48 | 49 | async def handle_list_prompts() -> list[types.Prompt]:
|
49 |
| - return [] |
| 50 | + return [ |
| 51 | + types.Prompt( |
| 52 | + name="KnowledgeTransfer", |
| 53 | + description="Prompt for invoking ContextSave tool in order to do a comprehensive knowledge transfer of a coding task. Prompts to save detailed error log and instructions.", |
| 54 | + ) |
| 55 | + ] |
50 | 56 |
|
51 | 57 |
|
52 | 58 | @server.get_prompt() # type: ignore
|
53 | 59 | async def handle_get_prompt(
|
54 | 60 | name: str, arguments: dict[str, str] | None
|
55 | 61 | ) -> types.GetPromptResult:
|
56 |
| - return types.GetPromptResult(messages=[]) |
| 62 | + messages = [] |
| 63 | + if name == "KnowledgeTransfer": |
| 64 | + messages = [ |
| 65 | + types.PromptMessage( |
| 66 | + role="user", |
| 67 | + content=types.TextContent( |
| 68 | + type="text", |
| 69 | + text="""Use `ContextSave` tool to do a knowledge transfer of the task in hand. |
| 70 | +Write detailed description in order to do a KT. |
| 71 | +Save all information necessary for a person to understand the task and the problems. |
| 72 | +
|
| 73 | +Format the `description` field using Markdown with the following sections. |
| 74 | +- "# Objective" section containing project and task objective. |
| 75 | +- "# All user instructions" section should be provided containing all instructions user shared in the conversation. |
| 76 | +- "# Current status of the task" should be provided containing only what is already achieved, not what's remaining. |
| 77 | +- "# All issues with snippets" section containing snippets of error, traceback, file snippets, commands, etc. But no comments or solutions. |
| 78 | +- Be very verbose in the all issues with snippets section providing as much error context as possible. |
| 79 | +- "# Build and development instructions" section containing instructions to build or run project or run tests, or envrionment related information. Only include what's known. Leave empty if unknown. |
| 80 | +- After the tool completes succesfully, tell me the task id and the file path the tool generated (important!) |
| 81 | +- This tool marks end of your conversation, do not run any further tools after calling this. |
| 82 | +
|
| 83 | +Provide all relevant file paths in order to understand and solve the the task. Err towards providing more file paths than fewer. |
| 84 | +
|
| 85 | +(Note to self: this conversation can then be resumed later asking "Resume `<generated id>`" which should call Initialize tool) |
| 86 | +""", |
| 87 | + ), |
| 88 | + ) |
| 89 | + ] |
| 90 | + return types.GetPromptResult(messages=messages) |
57 | 91 |
|
58 | 92 |
|
59 | 93 | @server.list_tools() # type: ignore
|
@@ -153,24 +187,14 @@ async def handle_list_tools() -> list[types.Tool]:
|
153 | 187 | """
|
154 | 188 | + diffinstructions,
|
155 | 189 | ),
|
156 |
| - # ToolParam( |
157 |
| - # inputSchema=KnowledgeTransfer.model_json_schema(), |
158 |
| - # name="KnowledgeTransfer", |
159 |
| - # description=""" |
160 |
| - # Write detailed description in order to do a KT, if the user asks for it. |
161 |
| - # Save all information necessary for a person to understand the task and the problems. |
162 |
| - # - `all_user_instructions` should contain all instructions user shared in the conversation. |
163 |
| - # - `current_status_of_the_task` should contain only what is already achieved, not what's remaining. |
164 |
| - # - `all_issues_snippets` should only contain snippets of error, traceback, file snippets, commands, etc., no comments or solutions (important!). |
165 |
| - # - Be very verbose in `all_issues_snippets` providing as much error context as possible. |
166 |
| - # - Provide an id if the user hasn't provided one. |
167 |
| - # - This tool will return a text file path where the information is saved. |
168 |
| - # - After the tool completes succesfully, tell the user the task id and the generate file path. (important!) |
169 |
| - # - Leave arguments as empty string if they aren't relevant. |
170 |
| - # - This tool marks end of your conversation, do not run any further tools after calling this. |
171 |
| - # - Provide absolute file paths only in `relevant_file_paths` containing all relevant files. |
172 |
| - # """, |
173 |
| - # ), |
| 190 | + ToolParam( |
| 191 | + inputSchema=ContextSave.model_json_schema(), |
| 192 | + name="ContextSave", |
| 193 | + description=""" |
| 194 | +Saves provided description and file contents of all the relevant file paths or globs in a single text file. |
| 195 | +- Provide random unqiue id or whatever user provided. |
| 196 | +- Leave project path as empty string if no project path""", |
| 197 | + ), |
174 | 198 | ]
|
175 | 199 | if COMPUTER_USE_ON_DOCKER_ENABLED:
|
176 | 200 | tools += [
|
|
0 commit comments