mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: address PR review comments
- Replace any[] with TodoItem[] type in ExtensionStateContext.tsx for better type safety - Remove redundant initialTodos parameter from startTask call in Task.ts (todos already set in constructor) - Improve code clarity in newTaskTool.ts by checking provider reference early and reusing state
This commit is contained in:
parent
dfbd0f7362
commit
fbad1e9c11
3 changed files with 11 additions and 8 deletions
|
|
@ -356,7 +356,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
|
||||
if (startTask) {
|
||||
if (task || images) {
|
||||
this.startTask(task, images, initialTodos)
|
||||
this.startTask(task, images)
|
||||
} else if (historyItem) {
|
||||
this.resumeTaskFromHistory()
|
||||
} else {
|
||||
|
|
@ -937,7 +937,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
|
||||
// Start / Abort / Resume
|
||||
|
||||
private async startTask(task?: string, images?: string[], initialTodos?: TodoItem[]): Promise<void> {
|
||||
private async startTask(task?: string, images?: string[]): Promise<void> {
|
||||
// `conversationHistory` (for API) and `clineMessages` (for webview)
|
||||
// need to be in sync.
|
||||
// If the extension process were killed, then on restart the
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ export async function newTaskTool(
|
|||
|
||||
// Get the experimental setting for requiring todos
|
||||
const provider = cline.providerRef.deref()
|
||||
const state = await provider?.getState()
|
||||
if (!provider) {
|
||||
pushToolResult(formatResponse.toolError("Provider reference lost"))
|
||||
return
|
||||
}
|
||||
const state = await provider.getState()
|
||||
const requireTodos = Experiments.isEnabled(state?.experiments ?? {}, EXPERIMENT_IDS.NEW_TASK_REQUIRE_TODOS)
|
||||
|
||||
// Check if todos are required based on experimental setting
|
||||
|
|
@ -82,7 +86,7 @@ export async function newTaskTool(
|
|||
const unescapedMessage = message.replace(/\\\\@/g, "\\@")
|
||||
|
||||
// Verify the mode exists
|
||||
const targetMode = getModeBySlug(mode, (await cline.providerRef.deref()?.getState())?.customModes)
|
||||
const targetMode = getModeBySlug(mode, state?.customModes)
|
||||
|
||||
if (!targetMode) {
|
||||
pushToolResult(formatResponse.toolError(`Invalid mode: ${mode}`))
|
||||
|
|
@ -102,9 +106,7 @@ export async function newTaskTool(
|
|||
return
|
||||
}
|
||||
|
||||
if (!provider) {
|
||||
return
|
||||
}
|
||||
// Provider is guaranteed to be defined here due to earlier check
|
||||
|
||||
if (cline.enableCheckpoints) {
|
||||
cline.checkpointSave(true)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {
|
|||
type ModeConfig,
|
||||
type ExperimentId,
|
||||
type OrganizationAllowList,
|
||||
type TodoItem,
|
||||
ORGANIZATION_ALLOW_ALL,
|
||||
} from "@roo-code/types"
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ export interface ExtensionStateContextType extends ExtensionState {
|
|||
mcpServers: McpServer[]
|
||||
hasSystemPromptOverride?: boolean
|
||||
currentCheckpoint?: string
|
||||
currentTaskTodos?: any[] // Initial todos for the current task
|
||||
currentTaskTodos?: TodoItem[] // Initial todos for the current task
|
||||
filePaths: string[]
|
||||
openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
|
||||
commands: Command[]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue