diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index baad2e6a8d..0d186eeb75 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -486,7 +486,15 @@ const ChatViewComponent: React.ForwardRefRenderFunction { if (isHidden) { @@ -1585,6 +1593,13 @@ const ChatViewComponent: React.ForwardRefRenderFunction )} + {typeof rootOrchestrationCost === "number" && rootOrchestrationCost > 0 && ( + <> + ยท + + {t("chat:costs.orchestrationTotal", { + cost: rootOrchestrationCost.toFixed(2), + })} + + } + side="top" + sideOffset={8}> + + {t("chat:costs.orchestrationLabel")}: ${rootOrchestrationCost.toFixed(2)} + + + + )} )} @@ -406,6 +427,28 @@ const TaskHeader = ({ )} + {typeof rootOrchestrationCost === "number" && rootOrchestrationCost > 0 && ( + + + {t("chat:costs.orchestrationLabel")} + + + + {t("chat:costs.orchestrationTotal", { + cost: rootOrchestrationCost.toFixed(2), + })} + + } + side="top" + sideOffset={8}> + ${rootOrchestrationCost.toFixed(2)} + + + + )} + {/* Size display */} {!!currentTaskItem?.size && currentTaskItem.size > 0 && ( diff --git a/webview-ui/src/components/chat/__tests__/TaskHeader.spec.tsx b/webview-ui/src/components/chat/__tests__/TaskHeader.spec.tsx index 41aa452ab1..c5aa89eac0 100644 --- a/webview-ui/src/components/chat/__tests__/TaskHeader.spec.tsx +++ b/webview-ui/src/components/chat/__tests__/TaskHeader.spec.tsx @@ -268,4 +268,26 @@ describe("TaskHeader", () => { expect(screen.getByText("0%")).toBeInTheDocument() }) }) + + describe("Root orchestration cost", () => { + it("should display orchestration cost when rootOrchestrationCost is provided and > 0", () => { + renderTaskHeader({ rootOrchestrationCost: 1.5 }) + expect(screen.getByText("chat:costs.orchestrationLabel: $1.50")).toBeInTheDocument() + }) + + it("should not display orchestration cost when rootOrchestrationCost is undefined", () => { + renderTaskHeader({ rootOrchestrationCost: undefined }) + expect(screen.queryByText(/chat:costs.orchestrationLabel/)).not.toBeInTheDocument() + }) + + it("should not display orchestration cost when rootOrchestrationCost is 0", () => { + renderTaskHeader({ rootOrchestrationCost: 0 }) + expect(screen.queryByText(/chat:costs.orchestrationLabel/)).not.toBeInTheDocument() + }) + + it("should display orchestration cost tooltip with correct text", () => { + renderTaskHeader({ rootOrchestrationCost: 2.75 }) + expect(screen.getByText("chat:costs.orchestrationLabel: $2.75")).toBeInTheDocument() + }) + }) }) diff --git a/webview-ui/src/i18n/locales/en/chat.json b/webview-ui/src/i18n/locales/en/chat.json index 3068c92d74..07dcaf3075 100644 --- a/webview-ui/src/i18n/locales/en/chat.json +++ b/webview-ui/src/i18n/locales/en/chat.json @@ -381,7 +381,9 @@ "costs": { "totalWithSubtasks": "Total Cost (including subtasks): ${{cost}}", "total": "Total Cost: ${{cost}}", - "includesSubtasks": "Includes subtask costs" + "includesSubtasks": "Includes subtask costs", + "orchestrationLabel": "Orchestration", + "orchestrationTotal": "Full orchestration cost (all tasks): ${{cost}}" }, "codeblock": { "tooltips": {