Changesets · Branches · Tags · Compare
| Changeset | 707bce180eb3803c8bc96e52208397e9dc0315fdee21b3e6a27989867991764a |
|---|---|
| Author | adarshramiyer <adarsh.r.iyer@gmail.com> · 2025-07-01 10:26 -07:00 |
| Committer | adarshramiyer <adarsh.r.iyer@gmail.com> · 2025-07-01 10:26 -07:00 |
| Parents | 0b91103abe86 |
5 files changed
modified extensions/vscode/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified gui/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified gui/src/redux/thunks/callCurrentTool.ts +3 −18
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; |
| 2 | 2 | import { ContextItem } from "core"; |
| 3 | 3 | import { CLIENT_TOOLS_IMPLS } from "core/tools/builtIn"; |
| 4 | -import { safeParseToolCallArgs } from "core/tools/parseArgs"; | |
| 5 | 4 | import posthog from "posthog-js"; |
| 6 | 5 | import { callClientTool } from "../../util/clientTools/callClientTool"; |
| 7 | 6 | import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; |
| @@ -13,6 +12,7 @@ | ||
| 13 | 12 | updateToolCallOutput, |
| 14 | 13 | } from "../slices/sessionSlice"; |
| 15 | 14 | import { ThunkApiType } from "../store"; |
| 15 | +import { logToolUsage } from "../util"; | |
| 16 | 16 | import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; |
| 17 | 17 | |
| 18 | 18 | export const callCurrentTool = createAsyncThunk<void, undefined, ThunkApiType>( |
| @@ -29,21 +29,6 @@ | ||
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - const logToolUsage = (success: boolean, finalOutput?: ContextItem[]) => { | |
| 33 | - extra.ideMessenger.post("devdata/log", { | |
| 34 | - name: "toolUsage", | |
| 35 | - data: { | |
| 36 | - toolCallId: toolCallState.toolCallId, | |
| 37 | - functionName: toolCallState.toolCall?.function?.name, | |
| 38 | - functionArgs: toolCallState.toolCall?.function?.arguments, | |
| 39 | - toolCallArgs: safeParseToolCallArgs(toolCallState.toolCall), | |
| 40 | - parsedArgs: toolCallState.parsedArgs, | |
| 41 | - output: finalOutput || toolCallState.output || [], | |
| 42 | - succeeded: success, | |
| 43 | - }, | |
| 44 | - }); | |
| 45 | - }; | |
| 46 | - | |
| 47 | 32 | const selectedChatModel = selectSelectedChatModel(state); |
| 48 | 33 | |
| 49 | 34 | if (!selectedChatModel) { |
| @@ -122,7 +107,7 @@ | ||
| 122 | 107 | }), |
| 123 | 108 | ); |
| 124 | 109 | |
| 125 | - logToolUsage(false, output); | |
| 110 | + logToolUsage(toolCallState, false, extra.ideMessenger, output); | |
| 126 | 111 | } else if (output?.length) { |
| 127 | 112 | dispatch( |
| 128 | 113 | updateToolCallOutput({ |
| @@ -131,7 +116,7 @@ | ||
| 131 | 116 | }), |
| 132 | 117 | ); |
| 133 | 118 | |
| 134 | - logToolUsage(true, output); | |
| 119 | + logToolUsage(toolCallState, true, extra.ideMessenger, output); | |
| 135 | 120 | } |
| 136 | 121 | |
| 137 | 122 | // Because we don't have access to use hooks, we check `allowAnonymousTelemetry` |
modified gui/src/redux/util/index.ts +23 −1
| @@ -1,4 +1,6 @@ | ||
| 1 | -import { ToolCallState } from "core"; | |
| 1 | +import { ContextItem, ToolCallState } from "core"; | |
| 2 | +import { safeParseToolCallArgs } from "core/tools/parseArgs"; | |
| 3 | +import { IIdeMessenger } from "../../context/IdeMessenger"; | |
| 2 | 4 | import { RootState } from "../store"; |
| 3 | 5 | |
| 4 | 6 | export function findCurrentToolCall( |
| @@ -15,3 +17,23 @@ | ||
| 15 | 17 | (item) => item.toolCallState?.toolCallId === toolCallId, |
| 16 | 18 | )?.toolCallState; |
| 17 | 19 | } |
| 20 | + | |
| 21 | +export function logToolUsage( | |
| 22 | + toolCallState: ToolCallState, | |
| 23 | + success: boolean, | |
| 24 | + messenger: IIdeMessenger, | |
| 25 | + finalOutput?: ContextItem[], | |
| 26 | +) { | |
| 27 | + messenger.post("devdata/log", { | |
| 28 | + name: "toolUsage", | |
| 29 | + data: { | |
| 30 | + toolCallId: toolCallState.toolCallId, | |
| 31 | + functionName: toolCallState.toolCall?.function?.name, | |
| 32 | + functionArgs: toolCallState.toolCall?.function?.arguments, | |
| 33 | + toolCallArgs: safeParseToolCallArgs(toolCallState.toolCall), | |
| 34 | + parsedArgs: toolCallState.parsedArgs, | |
| 35 | + output: finalOutput || toolCallState.output || [], | |
| 36 | + succeeded: success, | |
| 37 | + }, | |
| 38 | + }); | |
| 39 | +} |
modified packages/config-yaml/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.