Changesets · Branches · Tags · Compare
| Changeset | 87f75892af56dc4d1c4e30ea1bafae02b42f1fbf4ffda7dfecaeb3f86bee819e |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-09-15 11:19 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-15 11:19 -07:00 |
| Parents | a660fc8009f5, fb1cad4526eb |
18 files changed
modified core/tools/definitions/createNewFile.ts +3 −3
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | export const createNewFileTool: Tool = { |
| 5 | 5 | type: "function", |
| 6 | 6 | displayTitle: "Create New File", |
| 7 | - wouldLikeTo: "create a new file at {{{ filepath }}}", | |
| 8 | - isCurrently: "creating a new file at {{{ filepath }}}", | |
| 9 | - hasAlready: "created a new file at {{{ filepath }}}", | |
| 7 | + wouldLikeTo: "create {{{ filepath }}}", | |
| 8 | + isCurrently: "creating {{{ filepath }}}", | |
| 9 | + hasAlready: "created {{{ filepath }}}", | |
| 10 | 10 | group: BUILT_IN_GROUP_NAME, |
| 11 | 11 | readonly: false, |
| 12 | 12 | isInstant: true, |
modified core/tools/definitions/fetchUrlContent.ts +1 −1
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | displayTitle: "Read URL", |
| 7 | 7 | wouldLikeTo: "fetch {{{ url }}}", |
| 8 | 8 | isCurrently: "fetching {{{ url }}}", |
| 9 | - hasAlready: "viewed {{{ url }}}", | |
| 9 | + hasAlready: "fetched {{{ url }}}", | |
| 10 | 10 | readonly: true, |
| 11 | 11 | isInstant: true, |
| 12 | 12 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/globSearch.ts +3 −3
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | export const globSearchTool: Tool = { |
| 5 | 5 | type: "function", |
| 6 | 6 | displayTitle: "Glob File Search", |
| 7 | - wouldLikeTo: 'find file matches for "{{{ pattern }}}"', | |
| 8 | - isCurrently: 'finding file matches for "{{{ pattern }}}"', | |
| 9 | - hasAlready: 'retrieved file matches for "{{{ pattern }}}"', | |
| 7 | + wouldLikeTo: 'search for files like "{{{ pattern }}}"', | |
| 8 | + isCurrently: 'searching for files like "{{{ pattern }}}"', | |
| 9 | + hasAlready: 'searched for files like "{{{ pattern }}}"', | |
| 10 | 10 | readonly: true, |
| 11 | 11 | isInstant: true, |
| 12 | 12 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/grepSearch.ts +3 −3
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | export const grepSearchTool: Tool = { |
| 5 | 5 | type: "function", |
| 6 | 6 | displayTitle: "Grep Search", |
| 7 | - wouldLikeTo: 'search for "{{{ query }}}" in the repository', | |
| 8 | - isCurrently: 'getting search results for "{{{ query }}}"', | |
| 9 | - hasAlready: 'retrieved search results for "{{{ query }}}"', | |
| 7 | + wouldLikeTo: 'search for "{{{ query }}}"', | |
| 8 | + isCurrently: 'searching for "{{{ query }}}"', | |
| 9 | + hasAlready: 'searched for "{{{ query }}}"', | |
| 10 | 10 | readonly: true, |
| 11 | 11 | isInstant: true, |
| 12 | 12 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/ls.ts +3 −3
| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | export const lsTool: Tool = { |
| 6 | 6 | type: "function", |
| 7 | 7 | displayTitle: "ls", |
| 8 | - wouldLikeTo: "list files and folders in {{{ dirPath }}}", | |
| 9 | - isCurrently: "listing files and folders in {{{ dirPath }}}", | |
| 10 | - hasAlready: "listed files and folders in {{{ dirPath }}}", | |
| 8 | + wouldLikeTo: "list files in {{{ dirPath }}}", | |
| 9 | + isCurrently: "listing files in {{{ dirPath }}}", | |
| 10 | + hasAlready: "listed files in {{{ dirPath }}}", | |
| 11 | 11 | readonly: true, |
| 12 | 12 | isInstant: true, |
| 13 | 13 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/readCurrentlyOpenFile.ts +1 −1
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | displayTitle: "Read Currently Open File", |
| 7 | 7 | wouldLikeTo: "read the current file", |
| 8 | 8 | isCurrently: "reading the current file", |
| 9 | - hasAlready: "viewed the current file", | |
| 9 | + hasAlready: "read the current file", | |
| 10 | 10 | readonly: true, |
| 11 | 11 | isInstant: true, |
| 12 | 12 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/readFile.ts +1 −1
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | displayTitle: "Read File", |
| 7 | 7 | wouldLikeTo: "read {{{ filepath }}}", |
| 8 | 8 | isCurrently: "reading {{{ filepath }}}", |
| 9 | - hasAlready: "viewed {{{ filepath }}}", | |
| 9 | + hasAlready: "read {{{ filepath }}}", | |
| 10 | 10 | readonly: true, |
| 11 | 11 | isInstant: true, |
| 12 | 12 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/readFileRange.ts +1 −1
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | isCurrently: |
| 10 | 10 | "reading lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}", |
| 11 | 11 | hasAlready: |
| 12 | - "viewed lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}", | |
| 12 | + "read lines {{{ startLine }}}-{{{ endLine }}} of {{{ filepath }}}", | |
| 13 | 13 | readonly: true, |
| 14 | 14 | isInstant: true, |
| 15 | 15 | group: BUILT_IN_GROUP_NAME, |
modified core/tools/definitions/singleFindAndReplace.ts +3 −3
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | export const singleFindAndReplaceTool: Tool = { |
| 13 | 13 | type: "function", |
| 14 | 14 | displayTitle: "Find and Replace", |
| 15 | - wouldLikeTo: "find and replace in {{{ filepath }}}", | |
| 16 | - isCurrently: "finding and replacing in {{{ filepath }}}", | |
| 17 | - hasAlready: "found and replaced in {{{ filepath }}}", | |
| 15 | + wouldLikeTo: "edit {{{ filepath }}}", | |
| 16 | + isCurrently: "editing {{{ filepath }}}", | |
| 17 | + hasAlready: "edited {{{ filepath }}}", | |
| 18 | 18 | group: BUILT_IN_GROUP_NAME, |
| 19 | 19 | readonly: false, |
| 20 | 20 | isInstant: false, |
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx +5 −4
| @@ -236,10 +236,11 @@ | ||
| 236 | 236 | |
| 237 | 237 | render(<FindAndReplaceDisplay {...defaultProps} />); |
| 238 | 238 | |
| 239 | - const toggleButton = screen.getByTestId("toggle-find-and-replace-diff"); | |
| 240 | - fireEvent.click(toggleButton); | |
| 241 | - | |
| 242 | - expect(screen.getByText("Error generating diff")).toBeInTheDocument(); | |
| 239 | + // When diff generation errors, component shows a friendly message | |
| 240 | + // without rendering the expand/collapse container | |
| 241 | + expect( | |
| 242 | + screen.getByText("The searched string was not found in the file"), | |
| 243 | + ).toBeInTheDocument(); | |
| 243 | 244 | }); |
| 244 | 245 | |
| 245 | 246 | it("should show 'No changes to display' when diff is empty", () => { |
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +63 −23
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | |
| 31 | 31 | function EllipsisLine() { |
| 32 | 32 | return ( |
| 33 | - <div className="text-description-muted px-3 py-1 text-center font-mono"> | |
| 33 | + <div className="text-description-muted px-3 py-1 text-left font-mono"> | |
| 34 | 34 | ⋯ |
| 35 | 35 | </div> |
| 36 | 36 | ); |
| @@ -68,6 +68,19 @@ | ||
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | +function DiffStats({ added, removed }: { added: number; removed: number }) { | |
| 72 | + if (added === 0 && removed === 0) { | |
| 73 | + return null; | |
| 74 | + } | |
| 75 | + | |
| 76 | + return ( | |
| 77 | + <div className="flex items-center gap-1 font-mono text-xs"> | |
| 78 | + {added > 0 && <span className="text-success">+{added}</span>} | |
| 79 | + {removed > 0 && <span className="text-error">-{removed}</span>} | |
| 80 | + </div> | |
| 81 | + ); | |
| 82 | +} | |
| 83 | + | |
| 71 | 84 | export function FindAndReplaceDisplay({ |
| 72 | 85 | fileUri, |
| 73 | 86 | relativeFilePath, |
| @@ -141,6 +154,30 @@ | ||
| 141 | 154 | } |
| 142 | 155 | }, [currentFileContent, edits]); |
| 143 | 156 | |
| 157 | + const diffStats = useMemo(() => { | |
| 158 | + if (!diffResult?.diff) { | |
| 159 | + return { added: 0, removed: 0 }; | |
| 160 | + } | |
| 161 | + | |
| 162 | + let added = 0; | |
| 163 | + let removed = 0; | |
| 164 | + | |
| 165 | + diffResult.diff.forEach((part) => { | |
| 166 | + const lines = part.value.split("\n"); | |
| 167 | + // Exclude empty line at the end (similar to DiffLines component logic) | |
| 168 | + const lineCount = | |
| 169 | + lines[lines.length - 1] === "" ? lines.length - 1 : lines.length; | |
| 170 | + | |
| 171 | + if (part.added) { | |
| 172 | + added += lineCount; | |
| 173 | + } else if (part.removed) { | |
| 174 | + removed += lineCount; | |
| 175 | + } | |
| 176 | + }); | |
| 177 | + | |
| 178 | + return { added, removed }; | |
| 179 | + }, [diffResult?.diff]); | |
| 180 | + | |
| 144 | 181 | const statusIcon = useMemo(() => { |
| 145 | 182 | const status = toolCallState?.status; |
| 146 | 183 | if (status) { |
| @@ -174,24 +211,27 @@ | ||
| 174 | 211 | setIsExpanded(!showContent); |
| 175 | 212 | }} |
| 176 | 213 | > |
| 177 | - <div className="flex max-w-[50%] flex-row items-center text-xs"> | |
| 178 | - {statusIcon} | |
| 179 | - <ChevronDownIcon | |
| 180 | - data-testid="toggle-find-and-replace-diff" | |
| 181 | - className={`text-lightgray h-3.5 w-3.5 flex-shrink-0 cursor-pointer select-none transition-all hover:brightness-125 ${ | |
| 182 | - showContent ? "rotate-0" : "-rotate-90" | |
| 183 | - }`} | |
| 184 | - /> | |
| 185 | - <FileInfo | |
| 186 | - filepath={displayName || "..."} | |
| 187 | - onClick={(e) => { | |
| 188 | - if (!fileUri) { | |
| 189 | - return; | |
| 190 | - } | |
| 191 | - e.stopPropagation(); | |
| 192 | - ideMessenger.post("openFile", { path: fileUri }); | |
| 193 | - }} | |
| 194 | - /> | |
| 214 | + <div className="flex min-w-0 flex-1 flex-row items-center gap-2 text-xs"> | |
| 215 | + <div className="flex min-w-0 flex-row items-center"> | |
| 216 | + {statusIcon} | |
| 217 | + <ChevronDownIcon | |
| 218 | + data-testid="toggle-find-and-replace-diff" | |
| 219 | + className={`text-lightgray h-3.5 w-3.5 flex-shrink-0 cursor-pointer select-none transition-all hover:brightness-125 ${ | |
| 220 | + showContent ? "rotate-0" : "-rotate-90" | |
| 221 | + }`} | |
| 222 | + /> | |
| 223 | + <FileInfo | |
| 224 | + filepath={displayName || "..."} | |
| 225 | + onClick={(e) => { | |
| 226 | + if (!fileUri) { | |
| 227 | + return; | |
| 228 | + } | |
| 229 | + e.stopPropagation(); | |
| 230 | + ideMessenger.post("openFile", { path: fileUri }); | |
| 231 | + }} | |
| 232 | + /> | |
| 233 | + </div> | |
| 234 | + <DiffStats added={diffStats.added} removed={diffStats.removed} /> | |
| 195 | 235 | </div> |
| 196 | 236 | |
| 197 | 237 | {applyState && ( |
| @@ -218,10 +258,10 @@ | ||
| 218 | 258 | ); |
| 219 | 259 | |
| 220 | 260 | if (diffResult?.error) { |
| 221 | - return renderContainer( | |
| 222 | - <div className="text-error p-3 text-sm"> | |
| 223 | - <strong>Error generating diff</strong> | |
| 224 | - </div>, | |
| 261 | + return ( | |
| 262 | + <div className="text-description mt-2 px-3"> | |
| 263 | + The searched string was not found in the file | |
| 264 | + </div> | |
| 225 | 265 | ); |
| 226 | 266 | } |
| 227 | 267 |
modified gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +0 −19
| @@ -6,9 +6,7 @@ | ||
| 6 | 6 | } from "../../../components/mainInput/belowMainInput/ContextItemsPeek"; |
| 7 | 7 | import { IdeMessengerContext } from "../../../context/IdeMessenger"; |
| 8 | 8 | import { ToggleWithIcon } from "./ToggleWithIcon"; |
| 9 | -import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; | |
| 10 | 9 | import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; |
| 11 | -import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; | |
| 12 | 10 | import { toolCallStateToContextItems } from "./utils"; |
| 13 | 11 | |
| 14 | 12 | interface SimpleToolCallUIProps { |
| @@ -31,11 +29,6 @@ | ||
| 31 | 29 | }, [toolCallState]); |
| 32 | 30 | |
| 33 | 31 | const [open, setOpen] = useState(false); |
| 34 | - const [showingArgs, setShowingArgs] = useState(false); | |
| 35 | - | |
| 36 | - const args: [string, any][] = useMemo(() => { | |
| 37 | - return Object.entries(toolCallState.parsedArgs); | |
| 38 | - }, [toolCallState.parsedArgs]); | |
| 39 | 32 | |
| 40 | 33 | const isToggleable = shownContextItems.length > 1; |
| 41 | 34 | const isSingleItem = shownContextItems.length === 1; |
| @@ -81,19 +74,7 @@ | ||
| 81 | 74 | /> |
| 82 | 75 | <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} /> |
| 83 | 76 | </div> |
| 84 | - <div className="flex flex-row items-center gap-1.5"> | |
| 85 | - {!!toolCallState.output?.length && ( | |
| 86 | - <ToolTruncateHistoryIcon historyIndex={historyIndex} /> | |
| 87 | - )} | |
| 88 | - {args.length > 0 ? ( | |
| 89 | - <ArgsToggleIcon | |
| 90 | - isShowing={showingArgs} | |
| 91 | - setIsShowing={setShowingArgs} | |
| 92 | - /> | |
| 93 | - ) : null} | |
| 94 | - </div> | |
| 95 | 77 | </div> |
| 96 | - <ArgsItems args={args} isShowing={showingArgs} /> | |
| 97 | 78 | |
| 98 | 79 | {isToggleable && ( |
| 99 | 80 | <div |
modified gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx +0 −23
| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | import { Tool, ToolCallState } from "core"; |
| 2 | -import { useMemo, useState } from "react"; | |
| 3 | -import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; | |
| 4 | 2 | import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; |
| 5 | -import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; | |
| 6 | 3 | |
| 7 | 4 | interface ToolCallDisplayProps { |
| 8 | 5 | children: React.ReactNode; |
| @@ -19,12 +16,6 @@ | ||
| 19 | 16 | icon, |
| 20 | 17 | historyIndex, |
| 21 | 18 | }: ToolCallDisplayProps) { |
| 22 | - const [argsExpanded, setArgsExpanded] = useState(false); | |
| 23 | - | |
| 24 | - const args: [string, any][] = useMemo(() => { | |
| 25 | - return Object.entries(toolCallState.parsedArgs); | |
| 26 | - }, [toolCallState.parsedArgs]); | |
| 27 | - | |
| 28 | 19 | return ( |
| 29 | 20 | <div className="flex flex-col justify-center px-4"> |
| 30 | 21 | <div className="mb-2 flex flex-col"> |
| @@ -38,21 +29,7 @@ | ||
| 38 | 29 | )} |
| 39 | 30 | <ToolCallStatusMessage tool={tool} toolCallState={toolCallState} /> |
| 40 | 31 | </div> |
| 41 | - <div className="flex flex-row items-center gap-1.5"> | |
| 42 | - {!!toolCallState.output && ( | |
| 43 | - <ToolTruncateHistoryIcon historyIndex={historyIndex} /> | |
| 44 | - )} | |
| 45 | - {!!args.length ? ( | |
| 46 | - <ArgsToggleIcon | |
| 47 | - isShowing={argsExpanded} | |
| 48 | - setIsShowing={setArgsExpanded} | |
| 49 | - /> | |
| 50 | - ) : null} | |
| 51 | - </div> | |
| 52 | 32 | </div> |
| 53 | - {argsExpanded && !!args.length && ( | |
| 54 | - <ArgsItems args={args} isShowing={argsExpanded} /> | |
| 55 | - )} | |
| 56 | 33 | </div> |
| 57 | 34 | <div>{children}</div> |
| 58 | 35 | </div> |
modified gui/src/pages/gui/ToolCallDiv/utils.tsx +1 −1
| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | |
| 35 | 35 | switch (status) { |
| 36 | 36 | case "generating": |
| 37 | - return "is generating output to"; | |
| 37 | + return "will"; | |
| 38 | 38 | case "generated": |
| 39 | 39 | return "wants to"; |
| 40 | 40 | case "calling": |
modified gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx +2 −0
| @@ -73,6 +73,8 @@ | ||
| 73 | 73 | store.dispatch(setInactive()); |
| 74 | 74 | |
| 75 | 75 | ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR]; |
| 76 | + // Provide empty open files to avoid MockIdeMessenger throwing on getOpenFiles | |
| 77 | + ideMessenger.responses["getOpenFiles"] = [] as any; | |
| 76 | 78 | ideMessenger.responses["tools/evaluatePolicy"] = { |
| 77 | 79 | policy: "allowedWithPermission", |
| 78 | 80 | }; |
modified gui/src/redux/thunks/callToolById.ts +5 −3
| @@ -11,10 +11,10 @@ | ||
| 11 | 11 | setToolCallCalling, |
| 12 | 12 | updateToolCallOutput, |
| 13 | 13 | } from "../slices/sessionSlice"; |
| 14 | +import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; | |
| 14 | 15 | import { ThunkApiType } from "../store"; |
| 15 | 16 | import { findToolCallById, logToolUsage } from "../util"; |
| 16 | 17 | import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; |
| 17 | -import { DEFAULT_TOOL_SETTING } from "../slices/uiSlice"; | |
| 18 | 18 | |
| 19 | 19 | export const callToolById = createAsyncThunk< |
| 20 | 20 | void, |
| @@ -43,14 +43,15 @@ | ||
| 43 | 43 | DEFAULT_TOOL_SETTING; |
| 44 | 44 | const isAutoApproved = toolPolicy === "allowedWithoutPermission"; |
| 45 | 45 | |
| 46 | + const selectedChatModel = selectSelectedChatModel(state); | |
| 47 | + | |
| 46 | 48 | posthog.capture("gui_tool_call_decision", { |
| 49 | + model: selectedChatModel, | |
| 47 | 50 | decision: isAutoApproved ? "auto_accept" : "accept", |
| 48 | 51 | toolName: toolCallState.toolCall.function.name, |
| 49 | 52 | toolCallId: toolCallId, |
| 50 | 53 | }); |
| 51 | 54 | |
| 52 | - const selectedChatModel = selectSelectedChatModel(state); | |
| 53 | - | |
| 54 | 55 | if (!selectedChatModel) { |
| 55 | 56 | throw new Error("No model selected"); |
| 56 | 57 | } |
| @@ -129,6 +130,7 @@ | ||
| 129 | 130 | // Capture telemetry for tool call execution outcome with duration |
| 130 | 131 | const duration_ms = Date.now() - startTime; |
| 131 | 132 | posthog.capture("gui_tool_call_outcome", { |
| 133 | + model: selectedChatModel, | |
| 132 | 134 | succeeded: errorMessage === undefined, |
| 133 | 135 | toolName: toolCallState.toolCall.function.name, |
| 134 | 136 | errorMessage: errorMessage, |
modified gui/src/redux/thunks/cancelToolCall.ts +3 −0
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { createAsyncThunk } from "@reduxjs/toolkit"; |
| 2 | 2 | import posthog from "posthog-js"; |
| 3 | +import { selectSelectedChatModel } from "../slices/configSlice"; | |
| 3 | 4 | import { |
| 4 | 5 | cancelToolCall as cancelToolCallAction, |
| 5 | 6 | updateToolCallOutput, |
| @@ -19,6 +20,7 @@ | ||
| 19 | 20 | ThunkApiType |
| 20 | 21 | >("chat/cancelToolCall", async ({ toolCallId }, { dispatch, getState }) => { |
| 21 | 22 | const state = getState(); |
| 23 | + const selectedChatModel = selectSelectedChatModel(state); | |
| 22 | 24 | const continueAfterToolRejection = |
| 23 | 25 | state.config.config.ui?.continueAfterToolRejection; |
| 24 | 26 | const toolCallState = findToolCallById(state.session.history, toolCallId); |
| @@ -26,6 +28,7 @@ | ||
| 26 | 28 | if (toolCallState) { |
| 27 | 29 | // Track tool call rejection |
| 28 | 30 | posthog.capture("gui_tool_call_decision", { |
| 31 | + model: selectedChatModel, | |
| 29 | 32 | decision: "reject", |
| 30 | 33 | toolName: toolCallState.toolCall.function.name, |
| 31 | 34 | toolCallId: toolCallId, |
modified gui/src/redux/thunks/streamResponse_toolCalls.test.ts +36 −22
| @@ -565,18 +565,25 @@ | ||
| 565 | 565 | expect(result.type).toBe("chat/streamResponse/fulfilled"); |
| 566 | 566 | |
| 567 | 567 | // Verify telemetry events for auto-approved tool execution |
| 568 | - expect(mockPosthog.capture).toHaveBeenCalledWith("gui_tool_call_decision", { | |
| 569 | - decision: "auto_accept", | |
| 570 | - toolName: "search_codebase", | |
| 571 | - toolCallId: "tool-call-1", | |
| 572 | - }); | |
| 568 | + // Use partial matching to allow additional fields (e.g. model) in payload | |
| 569 | + expect(mockPosthog.capture).toHaveBeenCalledWith( | |
| 570 | + "gui_tool_call_decision", | |
| 571 | + expect.objectContaining({ | |
| 572 | + decision: "auto_accept", | |
| 573 | + toolName: "search_codebase", | |
| 574 | + toolCallId: "tool-call-1", | |
| 575 | + }), | |
| 576 | + ); | |
| 573 | 577 | |
| 574 | - expect(mockPosthog.capture).toHaveBeenCalledWith("gui_tool_call_outcome", { | |
| 575 | - succeeded: true, | |
| 576 | - toolName: "search_codebase", | |
| 577 | - errorMessage: undefined, | |
| 578 | - duration_ms: expect.any(Number), | |
| 579 | - }); | |
| 578 | + expect(mockPosthog.capture).toHaveBeenCalledWith( | |
| 579 | + "gui_tool_call_outcome", | |
| 580 | + expect.objectContaining({ | |
| 581 | + succeeded: true, | |
| 582 | + toolName: "search_codebase", | |
| 583 | + errorMessage: undefined, | |
| 584 | + duration_ms: expect.any(Number), | |
| 585 | + }), | |
| 586 | + ); | |
| 580 | 587 | |
| 581 | 588 | // Verify final state after tool call execution |
| 582 | 589 | const finalState = mockStoreWithToolSettings.getState(); |
| @@ -2810,18 +2817,25 @@ | ||
| 2810 | 2817 | ]); |
| 2811 | 2818 | |
| 2812 | 2819 | // Verify telemetry events for manual approval flow |
| 2813 | - expect(mockPosthog.capture).toHaveBeenCalledWith("gui_tool_call_decision", { | |
| 2814 | - decision: "accept", | |
| 2815 | - toolName: "search_codebase", | |
| 2816 | - toolCallId: "tool-approval-flow-1", | |
| 2817 | - }); | |
| 2820 | + // Use partial matching to allow additional fields (e.g. model) in payload | |
| 2821 | + expect(mockPosthog.capture).toHaveBeenCalledWith( | |
| 2822 | + "gui_tool_call_decision", | |
| 2823 | + expect.objectContaining({ | |
| 2824 | + decision: "accept", | |
| 2825 | + toolName: "search_codebase", | |
| 2826 | + toolCallId: "tool-approval-flow-1", | |
| 2827 | + }), | |
| 2828 | + ); | |
| 2818 | 2829 | |
| 2819 | - expect(mockPosthog.capture).toHaveBeenCalledWith("gui_tool_call_outcome", { | |
| 2820 | - succeeded: true, | |
| 2821 | - toolName: "search_codebase", | |
| 2822 | - errorMessage: undefined, | |
| 2823 | - duration_ms: expect.any(Number), | |
| 2824 | - }); | |
| 2830 | + expect(mockPosthog.capture).toHaveBeenCalledWith( | |
| 2831 | + "gui_tool_call_outcome", | |
| 2832 | + expect.objectContaining({ | |
| 2833 | + succeeded: true, | |
| 2834 | + toolName: "search_codebase", | |
| 2835 | + errorMessage: undefined, | |
| 2836 | + duration_ms: expect.any(Number), | |
| 2837 | + }), | |
| 2838 | + ); | |
| 2825 | 2839 | |
| 2826 | 2840 | // Verify IDE messenger calls for tool execution |
| 2827 | 2841 | expect(mockIdeMessengerApproval.request).toHaveBeenCalledWith( |