Skip to content

Commit 4264377

Browse files
committed
Cleanup
1 parent a9d624d commit 4264377

File tree

12 files changed

+168
-439
lines changed

12 files changed

+168
-439
lines changed

src/core/Cline.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,8 +2325,6 @@ export class Cline extends EventEmitter<ClineEvents> {
23252325
let sourceCodeDef = ""
23262326

23272327
if (isRangeRead) {
2328-
// Read specific lines (startLine is guaranteed to be defined if isRangeRead is true)
2329-
console.log("Reading specific lines", startLine, endLine, startLineStr, endLineStr)
23302328
if (startLine === undefined) {
23312329
content = addLineNumbers(await readLines(absolutePath, endLine, startLine))
23322330
} else {
@@ -2904,11 +2902,9 @@ export class Cline extends EventEmitter<ClineEvents> {
29042902
}
29052903

29062904
try {
2907-
parsedSuggest = parseXml(follow_up, ["suggest.answer"]) as {
2905+
parsedSuggest = parseXml(follow_up, ["suggest"]) as {
29082906
suggest: Suggest[] | Suggest
29092907
}
2910-
console.log("follow_up", follow_up)
2911-
console.log("parsedSuggest", parsedSuggest)
29122908
} catch (error) {
29132909
this.consecutiveMistakeCount++
29142910
await this.say("error", `Failed to parse operations: ${error.message}`)
@@ -2922,7 +2918,6 @@ export class Cline extends EventEmitter<ClineEvents> {
29222918
? parsedSuggest.suggest
29232919
: [parsedSuggest?.suggest].filter((sug): sug is Suggest => sug !== undefined)
29242920

2925-
console.log("normalizedSuggest", normalizedSuggest)
29262921
const follow_up_json = {
29272922
question,
29282923
suggest: normalizedSuggest,

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 135 additions & 255 deletions
Large diffs are not rendered by default.

src/core/prompts/sections/objective.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ You accomplish a given task iteratively, breaking it down into clear steps and w
88
1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
99
2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go.
1010
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. First, analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Then, think about which of the provided tools is the most relevant tool to accomplish the user's task. Next, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided.
11-
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built. You must provide suggested answer based on your question. The suggestions should be specific, actionable, and directly related to the completed task. They should be ordered by priority or logical sequence, and you should provide a minimum of 2-4 suggestions and a maximum of 10 suggestions.
11+
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user. You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built.
1212
5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`
1313
}

src/core/prompts/sections/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ${getEditingInstructions(diffStrategy, experiments)}
7474
* For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$"
7575
- When making changes to code, always consider the context in which the code is being used. Ensure that your changes are compatible with the existing codebase and that they follow the project's coding standards and best practices.
7676
- Do not ask for more information than necessary. Use the tools provided to accomplish the user's request efficiently and effectively. When you've completed your task, you must use the attempt_completion tool to present the result to the user. The user may provide feedback, which you can use to make improvements and try again.
77-
- You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. You must provide suggested answer based on your question. The suggestions should be specific, actionable, and directly related to the completed task. They should be ordered by priority or logical sequence, and you should provide a minimum of 2-4 suggestions and a maximum of 10 suggestions. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves.
77+
- You are only allowed to ask the user questions using the ask_followup_question tool. Use this tool only when you need additional details to complete a task, and be sure to use a clear and concise question that will help you move forward with the task. When you ask a question, provide the user with 2-4 suggested answers based on your question so they don't need to do so much typing. The suggestions should be specific, actionable, and directly related to the completed task. They should be ordered by priority or logical sequence. However if you can use the available tools to avoid having to ask the user questions, you should do so. For example, if the user mentions a file that may be in an outside directory like the Desktop, you should use the list_files tool to list the files in the Desktop and check if the file they are talking about is there, rather than asking the user to provide the file path themselves.
7878
- When executing commands, if you don't see the expected output, assume the terminal executed the command successfully and proceed with the task. The user's terminal may be unable to stream the output back properly. If you absolutely need to see the actual terminal output, use the ask_followup_question tool to request the user to copy and paste it back to you.
7979
- The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it.
8080
- Your goal is to try to accomplish the user's task, NOT engage in a back and forth conversation.${

src/core/prompts/tools/ask-followup-question.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ export function getAskFollowupQuestionDescription(): string {
33
Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth.
44
Parameters:
55
- question: (required) The question to ask the user. This should be a clear, specific question that addresses the information you need.
6-
- follow_up: (required) A list of suggested answer for question that logically follow from the question. Each suggestion must:
7-
1. Be provided in its own <suggest> tag with two fields:
8-
- answer: The description of the suggested answer
6+
- follow_up: (required) A list of 2-4 suggested answers that logically follow from the question, ordered by priority or logical sequence. Each suggestion must:
7+
1. Be provided in its own <suggest> tag
98
2. Be specific, actionable, and directly related to the completed task
10-
3. Be ordered by priority or logical sequence
11-
4. Provide minimum 2-4 suggestions and maximum 12 suggestions
9+
3. Be a complete answer to the question - the user should not need to provide additional information or fill in any missing details
1210
Usage:
1311
<ask_followup_question>
1412
<question>Your question here</question>
1513
<follow_up>
1614
<suggest>
17-
<answer>Your Suggested answer here</answer>
15+
Your suggested answer here
1816
</suggest>
1917
</follow_up>
2018
</ask_followup_question>
@@ -23,15 +21,9 @@ Example: Requesting to ask the user for the path to the frontend-config.json fil
2321
<ask_followup_question>
2422
<question>What is the path to the frontend-config.json file?</question>
2523
<follow_up>
26-
<suggest>
27-
<answer>./src/frontend-config.json</answer>
28-
</suggest>
29-
<suggest>
30-
<answer>./config/frontend-config.json</answer>
31-
</suggest>
32-
<suggest>
33-
<answer>./frontend-config.json</answer>
34-
</suggest>
24+
<suggest>./src/frontend-config.json</suggest>
25+
<suggest>./config/frontend-config.json</suggest>
26+
<suggest>./frontend-config.json</suggest>
3527
</follow_up>
3628
</ask_followup_question>`
3729
}

src/exports/roo-code.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export type ClineAsk =
108108
| "browser_action_launch"
109109
| "use_mcp_server"
110110
| "finishTask"
111-
| "follow_up_suggest"
112111

113112
export type ClineSay =
114113
| "task"
@@ -135,7 +134,6 @@ export type ClineSay =
135134
| "new_task"
136135
| "checkpoint_saved"
137136
| "rooignore_error"
138-
| "follow_up_suggest"
139137

140138
export interface ClineMessage {
141139
ts: number

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@ export const ChatRowContent = ({
225225
style={{ color: normalColor, marginBottom: "-1.5px" }}></span>,
226226
<span style={{ color: normalColor, fontWeight: "bold" }}>{t("chat:questions.hasQuestion")}</span>,
227227
]
228-
case "follow_up_suggest": {
229-
return [
230-
<span
231-
className="codicon codicon-question" // TODO: change icon
232-
style={{ color: normalColor, marginBottom: "-1.5px" }}></span>,
233-
<span style={{ color: normalColor, fontWeight: "bold" }}>Roo has suggest prompt:</span>,
234-
]
235-
}
236228
default:
237229
return [null, null]
238230
}
@@ -1014,9 +1006,13 @@ export const ChatRowContent = ({
10141006
</div>
10151007
)}
10161008
<div style={{ paddingTop: 10, paddingBottom: 15 }}>
1017-
<Markdown markdown={message.partial === true ? message?.text : followUpData?.question} />
1009+
<Markdown markdown={followUpData?.question} />
10181010
</div>
1019-
<FollowUpSuggest suggestions={followUpData?.suggest} onSuggestionClick={onSuggestionClick} ts={message?.ts} />
1011+
<FollowUpSuggest
1012+
suggestions={followUpData?.suggest}
1013+
onSuggestionClick={onSuggestionClick}
1014+
ts={message?.ts}
1015+
/>
10201016
</>
10211017
)
10221018
default:

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
244244
setEnableButtons(false)
245245
}
246246
break
247-
case "follow_up_suggest":
248247
case "api_req_finished":
249248
case "task":
250249
case "error":
@@ -350,19 +349,10 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
350349
// There is no other case that a textfield should be enabled.
351350
}
352351
}
353-
// Only reset message-specific state, preserving mode
354-
setInputValue("")
355-
setTextAreaDisabled(true)
356-
setSelectedImages([])
357-
setClineAsk(undefined)
358-
setEnableButtons(false)
359-
// Do not reset mode here as it should persist
360-
// setPrimaryButtonText(undefined)
361-
// setSecondaryButtonText(undefined)
362-
disableAutoScrollRef.current = false
352+
handleChatReset()
363353
}
364354
},
365-
[messages.length, clineAsk],
355+
[messages.length, clineAsk, handleChatReset],
366356
)
367357

368358
const handleSetChatBoxMessage = useCallback(
@@ -1024,7 +1014,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
10241014
onHeightChange={handleRowHeightChange}
10251015
isStreaming={isStreaming}
10261016
onSuggestionClick={(answer: string) => {
1027-
setInputValue(answer)
1017+
handleSendMessage(answer, [])
10281018
}}
10291019
/>
10301020
)
@@ -1035,7 +1025,6 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
10351025
groupedMessages.length,
10361026
handleRowHeightChange,
10371027
isStreaming,
1038-
10391028
toggleRowExpansion,
10401029
handleSendMessage,
10411030
],

webview-ui/src/components/chat/FollowUpSuggest.tsx

Lines changed: 11 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,41 @@
1-
import { useCallback, useRef, useState } from "react"
1+
import { useCallback } from "react"
22
import { cn } from "../../lib/utils"
33
import { Button } from "../ui/button"
4-
import { ChevronDown, ChevronUp } from "lucide-react"
54

65
interface FollowUpSuggestProps {
7-
suggestions?: { answer: string; id?: string }[]
6+
suggestions?: string[]
87
onSuggestionClick?: (answer: string) => void
98
ts: number
109
}
1110

1211
const FollowUpSuggest = ({ suggestions = [], onSuggestionClick, ts = 1 }: FollowUpSuggestProps) => {
13-
const [isExpanded, setIsExpanded] = useState(false)
14-
const buttonRef = useRef<HTMLButtonElement>(null)
15-
1612
const handleSuggestionClick = useCallback(
17-
(suggestion: { answer: string; }) => {
18-
onSuggestionClick?.(suggestion.answer)
13+
(suggestion: string) => {
14+
onSuggestionClick?.(suggestion)
1915
},
2016
[onSuggestionClick],
2117
)
2218

23-
const toggleExpand = useCallback(() => {
24-
setIsExpanded((prev) => !prev)
25-
26-
// Use setTimeout to ensure the DOM has updated before scrolling
27-
setTimeout(() => {
28-
if (buttonRef.current) {
29-
// Use scrollIntoView to ensure the button is visible
30-
buttonRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" })
31-
}
32-
}, 100) // Increased timeout to ensure DOM updates
33-
}, [])
34-
3519
// Don't render if there are no suggestions or no click handler
3620
if (!suggestions?.length || !onSuggestionClick) {
3721
return null
3822
}
3923

40-
const displayedSuggestions = isExpanded ? suggestions : suggestions.slice(0, 1)
41-
4224
return (
43-
<div className="h-full" aria-label="Next step suggestions">
25+
<div className="h-full">
4426
<div className="h-full scrollbar-thin scrollbar-thumb-vscode-scrollbarSlider-background scrollbar-track-transparent">
4527
<div className={cn("flex gap-2.5 pb-2 flex-col h-full")}>
46-
{displayedSuggestions.map((suggestion) => (
47-
<div key={`${suggestion.answer}-${ts}`} className="w-full">
28+
{suggestions.map((suggestion) => (
29+
<div key={`${suggestion}-${ts}`} className="w-full">
4830
<Button
49-
variant="ui-toolkit-primary-no-border"
50-
className={cn(
51-
"text-left",
52-
"focus:outline-none",
53-
"overflow-hidden",
54-
"w-full",
55-
"group h-full",
56-
"rounded-[3px]",
57-
"p-[9px] whitespace-pre-wrap break-words overflow-wrap-anywhere",
58-
)}
31+
variant="outline"
32+
className="w-full text-left whitespace-normal break-words h-auto min-h-[28px] py-2 justify-start"
5933
onClick={() => handleSuggestionClick(suggestion)}
60-
aria-label={`${suggestion.answer}`}>
61-
<div className="relative h-full w-full">
62-
<div className="flex justify-between items-start gap-2.5 h-full w-full">
63-
<span className="block flex-grow p-1 whitespace-pre-wrap break-words overflow-wrap-anywhere w-full h-full pb-6">
64-
{suggestion.answer}
65-
</span>
66-
</div>
67-
</div>
34+
aria-label={suggestion}>
35+
<span className="text-left">{suggestion}</span>
6836
</Button>
6937
</div>
7038
))}
71-
{suggestions.length > 1 && (
72-
<Button
73-
ref={buttonRef}
74-
variant="ghost"
75-
size="sm"
76-
className="flex items-center gap-1"
77-
onClick={toggleExpand}
78-
aria-label={isExpanded ? "Show less suggestions" : "Show more suggestions"}>
79-
{isExpanded ? (
80-
<>
81-
<ChevronUp className="w-4 h-4" />
82-
Show Less
83-
</>
84-
) : (
85-
<>
86-
<ChevronDown className="w-4 h-4" />
87-
Show More ({suggestions.length - 1} more)
88-
</>
89-
)}
90-
</Button>
91-
)}
9239
</div>
9340
</div>
9441
</div>

webview-ui/src/components/ui/badge.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ const badgeVariants = cva(
1212
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1313
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/80",
1414
outline: "text-muted-foreground border-vscode-input-border",
15-
toolkit:
16-
"bg-vscode-badge-background text-vscode-badge-foreground border border-vscode-button-border rounded-full text-xs font-normal",
17-
"toolkit-no-border":
18-
"bg-vscode-badge-background text-vscode-badge-foreground rounded-full text-xs font-normal shadow",
1915
},
2016
},
2117
defaultVariants: {

0 commit comments

Comments
 (0)