mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Remove unused ClineSay and -Ask type variants (#2061)
Co-authored-by: cte <cestreich@gmail.com>
This commit is contained in:
parent
2e1d949e65
commit
449d54bdd5
9 changed files with 16 additions and 56 deletions
|
|
@ -706,7 +706,6 @@ export const clineAsks = [
|
|||
"mistake_limit_reached",
|
||||
"browser_action_launch",
|
||||
"use_mcp_server",
|
||||
"finishTask",
|
||||
] as const
|
||||
|
||||
export const clineAskSchema = z.enum(clineAsks)
|
||||
|
|
@ -716,7 +715,6 @@ export type ClineAsk = z.infer<typeof clineAskSchema>
|
|||
// ClineSay
|
||||
|
||||
export const clineSays = [
|
||||
"task",
|
||||
"error",
|
||||
"api_req_started",
|
||||
"api_req_finished",
|
||||
|
|
@ -729,15 +727,12 @@ export const clineSays = [
|
|||
"user_feedback",
|
||||
"user_feedback_diff",
|
||||
"command_output",
|
||||
"tool",
|
||||
"shell_integration_warning",
|
||||
"browser_action",
|
||||
"browser_action_result",
|
||||
"command",
|
||||
"mcp_server_request_started",
|
||||
"mcp_server_response",
|
||||
"new_task_started",
|
||||
"new_task",
|
||||
"subtask_result",
|
||||
"checkpoint_saved",
|
||||
"rooignore_error",
|
||||
"diff_error",
|
||||
|
|
|
|||
12
src/exports/roo-code.d.ts
vendored
12
src/exports/roo-code.d.ts
vendored
|
|
@ -307,12 +307,10 @@ type ClineMessage = {
|
|||
| "mistake_limit_reached"
|
||||
| "browser_action_launch"
|
||||
| "use_mcp_server"
|
||||
| "finishTask"
|
||||
)
|
||||
| undefined
|
||||
say?:
|
||||
| (
|
||||
| "task"
|
||||
| "error"
|
||||
| "api_req_started"
|
||||
| "api_req_finished"
|
||||
|
|
@ -325,15 +323,11 @@ type ClineMessage = {
|
|||
| "user_feedback"
|
||||
| "user_feedback_diff"
|
||||
| "command_output"
|
||||
| "tool"
|
||||
| "shell_integration_warning"
|
||||
| "browser_action"
|
||||
| "browser_action_result"
|
||||
| "command"
|
||||
| "mcp_server_request_started"
|
||||
| "mcp_server_response"
|
||||
| "new_task_started"
|
||||
| "new_task"
|
||||
| "subtask_result"
|
||||
| "checkpoint_saved"
|
||||
| "rooignore_error"
|
||||
|
|
@ -388,12 +382,10 @@ type RooCodeEvents = {
|
|||
| "mistake_limit_reached"
|
||||
| "browser_action_launch"
|
||||
| "use_mcp_server"
|
||||
| "finishTask"
|
||||
)
|
||||
| undefined
|
||||
say?:
|
||||
| (
|
||||
| "task"
|
||||
| "error"
|
||||
| "api_req_started"
|
||||
| "api_req_finished"
|
||||
|
|
@ -406,15 +398,11 @@ type RooCodeEvents = {
|
|||
| "user_feedback"
|
||||
| "user_feedback_diff"
|
||||
| "command_output"
|
||||
| "tool"
|
||||
| "shell_integration_warning"
|
||||
| "browser_action"
|
||||
| "browser_action_result"
|
||||
| "command"
|
||||
| "mcp_server_request_started"
|
||||
| "mcp_server_response"
|
||||
| "new_task_started"
|
||||
| "new_task"
|
||||
| "subtask_result"
|
||||
| "checkpoint_saved"
|
||||
| "rooignore_error"
|
||||
|
|
|
|||
|
|
@ -312,12 +312,10 @@ type ClineMessage = {
|
|||
| "mistake_limit_reached"
|
||||
| "browser_action_launch"
|
||||
| "use_mcp_server"
|
||||
| "finishTask"
|
||||
)
|
||||
| undefined
|
||||
say?:
|
||||
| (
|
||||
| "task"
|
||||
| "error"
|
||||
| "api_req_started"
|
||||
| "api_req_finished"
|
||||
|
|
@ -330,15 +328,11 @@ type ClineMessage = {
|
|||
| "user_feedback"
|
||||
| "user_feedback_diff"
|
||||
| "command_output"
|
||||
| "tool"
|
||||
| "shell_integration_warning"
|
||||
| "browser_action"
|
||||
| "browser_action_result"
|
||||
| "command"
|
||||
| "mcp_server_request_started"
|
||||
| "mcp_server_response"
|
||||
| "new_task_started"
|
||||
| "new_task"
|
||||
| "subtask_result"
|
||||
| "checkpoint_saved"
|
||||
| "rooignore_error"
|
||||
|
|
@ -397,12 +391,10 @@ type RooCodeEvents = {
|
|||
| "mistake_limit_reached"
|
||||
| "browser_action_launch"
|
||||
| "use_mcp_server"
|
||||
| "finishTask"
|
||||
)
|
||||
| undefined
|
||||
say?:
|
||||
| (
|
||||
| "task"
|
||||
| "error"
|
||||
| "api_req_started"
|
||||
| "api_req_finished"
|
||||
|
|
@ -415,15 +407,11 @@ type RooCodeEvents = {
|
|||
| "user_feedback"
|
||||
| "user_feedback_diff"
|
||||
| "command_output"
|
||||
| "tool"
|
||||
| "shell_integration_warning"
|
||||
| "browser_action"
|
||||
| "browser_action_result"
|
||||
| "command"
|
||||
| "mcp_server_request_started"
|
||||
| "mcp_server_response"
|
||||
| "new_task_started"
|
||||
| "new_task"
|
||||
| "subtask_result"
|
||||
| "checkpoint_saved"
|
||||
| "rooignore_error"
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
|
|||
customSupportPrompts: undefined,
|
||||
enhancementApiConfigId: undefined,
|
||||
cachedChromeHostUrl: undefined,
|
||||
historyPreviewCollapsed: undefined,
|
||||
historyPreviewCollapsed: undefined,
|
||||
}
|
||||
|
||||
export const GLOBAL_SETTINGS_KEYS = Object.keys(globalSettingsRecord) as Keys<GlobalSettings>[]
|
||||
|
|
@ -741,7 +741,6 @@ export const clineAsks = [
|
|||
"mistake_limit_reached",
|
||||
"browser_action_launch",
|
||||
"use_mcp_server",
|
||||
"finishTask",
|
||||
] as const
|
||||
|
||||
export const clineAskSchema = z.enum(clineAsks)
|
||||
|
|
@ -751,7 +750,6 @@ export type ClineAsk = z.infer<typeof clineAskSchema>
|
|||
// ClineSay
|
||||
|
||||
export const clineSays = [
|
||||
"task",
|
||||
"error",
|
||||
"api_req_started",
|
||||
"api_req_finished",
|
||||
|
|
@ -764,15 +762,11 @@ export const clineSays = [
|
|||
"user_feedback",
|
||||
"user_feedback_diff",
|
||||
"command_output",
|
||||
"tool",
|
||||
"shell_integration_warning",
|
||||
"browser_action",
|
||||
"browser_action_result",
|
||||
"command",
|
||||
"mcp_server_request_started",
|
||||
"mcp_server_response",
|
||||
"new_task_started",
|
||||
"new_task",
|
||||
"subtask_result",
|
||||
"checkpoint_saved",
|
||||
"rooignore_error",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// npx jest src/shared/__tests__/combineApiRequests.test.ts
|
||||
|
||||
import { combineApiRequests } from "../combineApiRequests"
|
||||
import { ClineMessage } from "../ExtensionMessage"
|
||||
import { ClineMessage, ClineSay } from "../ExtensionMessage"
|
||||
|
||||
describe("combineApiRequests", () => {
|
||||
// Helper function to create a basic api_req_started message
|
||||
|
|
@ -22,15 +22,10 @@ describe("combineApiRequests", () => {
|
|||
|
||||
// Helper function to create a non-API message
|
||||
const createOtherMessage = (
|
||||
say: "text" | "task" | "error" | "command" = "text",
|
||||
say: ClineSay = "text",
|
||||
text: string = "Hello world",
|
||||
ts: number = 999,
|
||||
): ClineMessage => ({
|
||||
type: "say",
|
||||
say,
|
||||
text,
|
||||
ts,
|
||||
})
|
||||
): ClineMessage => ({ type: "say", say, text, ts })
|
||||
|
||||
describe("Basic functionality", () => {
|
||||
it("should combine a pair of api_req_started and api_req_finished messages", () => {
|
||||
|
|
@ -141,7 +136,7 @@ describe("combineApiRequests", () => {
|
|||
it("should return original array when no API request messages exist", () => {
|
||||
const messages: ClineMessage[] = [
|
||||
createOtherMessage("text", "Message 1", 999),
|
||||
createOtherMessage("task", "Task message", 1000),
|
||||
createOtherMessage("text", "Task message", 1000),
|
||||
createOtherMessage("error", "Error message", 1001),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe("ContextWindowProgress", () => {
|
|||
const renderComponent = (props: Record<string, any>) => {
|
||||
// Create a simple mock of the task that avoids importing the actual types
|
||||
const defaultProps = {
|
||||
task: { ts: Date.now(), type: "say" as const, say: "task" as const, text: "Test task" },
|
||||
task: { ts: Date.now(), type: "say" as const, say: "text" as const, text: "Test task" },
|
||||
tokensIn: 100,
|
||||
tokensOut: 50,
|
||||
doesModelSupportPromptCache: true,
|
||||
|
|
|
|||
|
|
@ -253,12 +253,10 @@ export const ChatRowContent = ({
|
|||
overflowWrap: "anywhere",
|
||||
}
|
||||
|
||||
const tool = useMemo(() => {
|
||||
if (message.ask === "tool" || message.say === "tool") {
|
||||
return safeJsonParse<ClineSayTool>(message.text)
|
||||
}
|
||||
return null
|
||||
}, [message.ask, message.say, message.text])
|
||||
const tool = useMemo(
|
||||
() => (message.ask === "tool" ? safeJsonParse<ClineSayTool>(message.text) : null),
|
||||
[message.ask, message.text],
|
||||
)
|
||||
|
||||
const followUpData = useMemo(() => {
|
||||
if (message.type === "ask" && message.ask === "followup" && !message.partial) {
|
||||
|
|
|
|||
|
|
@ -289,7 +289,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
}
|
||||
break
|
||||
case "api_req_finished":
|
||||
case "task":
|
||||
case "error":
|
||||
case "text":
|
||||
case "browser_action":
|
||||
|
|
@ -298,7 +297,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
case "mcp_server_request_started":
|
||||
case "mcp_server_response":
|
||||
case "completion_result":
|
||||
case "tool":
|
||||
break
|
||||
}
|
||||
break
|
||||
|
|
|
|||
|
|
@ -567,7 +567,11 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
|
|||
value={(() => {
|
||||
const customMode = findModeBySlug(visualMode, customModes)
|
||||
const prompt = customModePrompts?.[visualMode] as PromptComponent
|
||||
return customMode?.roleDefinition ?? prompt?.roleDefinition ?? getRoleDefinition(visualMode)
|
||||
return (
|
||||
customMode?.roleDefinition ??
|
||||
prompt?.roleDefinition ??
|
||||
getRoleDefinition(visualMode)
|
||||
)
|
||||
})()}
|
||||
onChange={(e) => {
|
||||
const value =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue