Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface ExtensionMessage {
| "claudeCodeRateLimits"
| "customToolsResult"
| "modes"
| "taskWithAggregatedCosts"
text?: string
payload?: any // eslint-disable-line @typescript-eslint/no-explicit-any
checkpointWarning?: {
Expand Down Expand Up @@ -182,6 +183,13 @@ export interface ExtensionMessage {
stepIndex?: number // For browserSessionNavigate: the target step index to display
tools?: SerializedCustomToolDefinition[] // For customToolsResult
modes?: { slug: string; name: string }[] // For modes response
aggregatedCosts?: {
// For taskWithAggregatedCosts response
totalCost: number
ownCost: number
childrenCost: number
}
historyItem?: HistoryItem
}

export type ExtensionState = Pick<
Expand Down Expand Up @@ -498,6 +506,7 @@ export interface WebviewMessage {
| "getDismissedUpsells"
| "updateSettings"
| "allowedCommands"
| "getTaskWithAggregatedCosts"
| "deniedCommands"
| "killBrowserSession"
| "openBrowserSessionPanel"
Expand Down
15 changes: 15 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
DEFAULT_CHECKPOINT_TIMEOUT_SECONDS,
getModelId,
} from "@roo-code/types"
import { aggregateTaskCostsRecursive, type AggregatedCosts } from "./aggregateTaskCosts"
import { TelemetryService } from "@roo-code/telemetry"
import { CloudService, BridgeOrchestrator, getRooCodeApiUrl } from "@roo-code/cloud"

Expand Down Expand Up @@ -1705,6 +1706,20 @@ export class ClineProvider
throw new Error("Task not found")
}

async getTaskWithAggregatedCosts(taskId: string): Promise<{
historyItem: HistoryItem
aggregatedCosts: AggregatedCosts
}> {
const { historyItem } = await this.getTaskWithId(taskId)

const aggregatedCosts = await aggregateTaskCostsRecursive(taskId, async (id: string) => {
const result = await this.getTaskWithId(id)
return result.historyItem
})

return { historyItem, aggregatedCosts }
}

async showTaskWithId(id: string) {
if (id !== this.getCurrentTask()?.taskId) {
// Non-current task.
Expand Down
Loading
Loading