Changesets · Branches · Tags · Compare
| Changeset | 7f8b1ea26802a360dcbedc46d5449295b3363d54548cdd3463bcc15cf306c6c9 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-07-01 13:54 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-01 13:54 -07:00 |
| Parents | 54bc82ab2ee9, 0e93a6dcb1e3 |
11 files changed
modified core/core.ts +3 −1
| @@ -872,7 +872,7 @@ | ||
| 872 | 872 | this.messenger.send("toolCallPartialOutput", params); |
| 873 | 873 | }; |
| 874 | 874 | |
| 875 | - return await callTool(tool, toolCall, { | |
| 875 | + const result = await callTool(tool, toolCall, { | |
| 876 | 876 | config, |
| 877 | 877 | ide: this.ide, |
| 878 | 878 | llm: config.selectedModelByRole.chat, |
| @@ -883,6 +883,8 @@ | ||
| 883 | 883 | onPartialOutput, |
| 884 | 884 | codeBaseIndexer: this.codeBaseIndexer, |
| 885 | 885 | }); |
| 886 | + | |
| 887 | + return result; | |
| 886 | 888 | } |
| 887 | 889 | |
| 888 | 890 | private async isItemTooBig(item: ContextItemWithId) { |
modified core/tools/callTool.ts +23 −0
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { ContextItem, Tool, ToolCall, ToolExtras } from ".."; |
| 2 | 2 | import { MCPManagerSingleton } from "../context/mcp/MCPManagerSingleton"; |
| 3 | +import { DataLogger } from "../data/log"; | |
| 3 | 4 | import { canParseUrl } from "../util/url"; |
| 4 | 5 | import { BuiltInToolNames } from "./builtIn"; |
| 5 | 6 | |
| @@ -172,6 +173,26 @@ | ||
| 172 | 173 | } |
| 173 | 174 | } |
| 174 | 175 | |
| 176 | +function logToolUsage( | |
| 177 | + toolCall: ToolCall, | |
| 178 | + args: Record<string, any>, | |
| 179 | + contextItems: ContextItem[], | |
| 180 | + success: boolean, | |
| 181 | +) { | |
| 182 | + void DataLogger.getInstance().logDevData({ | |
| 183 | + name: "toolUsage", | |
| 184 | + data: { | |
| 185 | + toolCallId: toolCall.id, | |
| 186 | + functionName: toolCall.function.name, | |
| 187 | + functionArgs: toolCall.function.arguments, | |
| 188 | + toolCallArgs: args, | |
| 189 | + parsedArgs: args, | |
| 190 | + output: contextItems, | |
| 191 | + succeeded: success, | |
| 192 | + }, | |
| 193 | + }); | |
| 194 | +} | |
| 195 | + | |
| 175 | 196 | // Handles calls for core/non-client tools |
| 176 | 197 | // Returns an error context item if the tool call fails |
| 177 | 198 | // Note: Edit tool is handled on client |
| @@ -193,6 +214,7 @@ | ||
| 193 | 214 | item.icon = tool.faviconUrl; |
| 194 | 215 | }); |
| 195 | 216 | } |
| 217 | + logToolUsage(toolCall, args, contextItems, true); | |
| 196 | 218 | return { |
| 197 | 219 | contextItems, |
| 198 | 220 | errorMessage: undefined, |
| @@ -202,6 +224,7 @@ | ||
| 202 | 224 | if (e instanceof Error) { |
| 203 | 225 | errorMessage = e.message; |
| 204 | 226 | } |
| 227 | + logToolUsage(toolCall, {}, [], false); | |
| 205 | 228 | return { |
| 206 | 229 | contextItems: [], |
| 207 | 230 | errorMessage, |
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 extensions/vscode/package.json +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | "name": "continue", |
| 3 | 3 | "icon": "media/icon.png", |
| 4 | 4 | "author": "Continue Dev, Inc", |
| 5 | - "version": "1.1.53", | |
| 5 | + "version": "1.1.54", | |
| 6 | 6 | "repository": { |
| 7 | 7 | "type": "git", |
| 8 | 8 | "url": "https://github.com/continuedev/continue" |
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/slices/sessionSlice.ts +2 −0
| @@ -28,6 +28,8 @@ | ||
| 28 | 28 | import { streamResponseThunk } from "../thunks/streamResponse"; |
| 29 | 29 | import { findCurrentToolCall, findToolCall } from "../util"; |
| 30 | 30 | |
| 31 | +const getIdeMessenger = () => (window as any).ideMessenger; | |
| 32 | + | |
| 31 | 33 | // We need this to handle reorderings (e.g. a mid-array deletion) of the messages array. |
| 32 | 34 | // The proper fix is adding a UUID to all chat messages, but this is the temp workaround. |
| 33 | 35 | export type ChatHistoryItemWithMessageId = ChatHistoryItem & { |
modified gui/src/redux/thunks/callCurrentTool.ts +5 −0
| @@ -12,6 +12,7 @@ | ||
| 12 | 12 | updateToolCallOutput, |
| 13 | 13 | } from "../slices/sessionSlice"; |
| 14 | 14 | import { ThunkApiType } from "../store"; |
| 15 | +import { logToolUsage } from "../util"; | |
| 15 | 16 | import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; |
| 16 | 17 | |
| 17 | 18 | export const callCurrentTool = createAsyncThunk<void, undefined, ThunkApiType>( |
| @@ -100,6 +101,8 @@ | ||
| 100 | 101 | ], |
| 101 | 102 | }), |
| 102 | 103 | ); |
| 104 | + | |
| 105 | + logToolUsage(toolCallState, false, extra.ideMessenger, output); | |
| 103 | 106 | } else if (output?.length) { |
| 104 | 107 | dispatch( |
| 105 | 108 | updateToolCallOutput({ |
| @@ -107,6 +110,8 @@ | ||
| 107 | 110 | contextItems: output, |
| 108 | 111 | }), |
| 109 | 112 | ); |
| 113 | + | |
| 114 | + logToolUsage(toolCallState, true, extra.ideMessenger, output); | |
| 110 | 115 | } |
| 111 | 116 | |
| 112 | 117 | // 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/src/schemas/data/index.ts +10 −0
| @@ -28,6 +28,7 @@ | ||
| 28 | 28 | editInteractionEventSchema_0_2_0, |
| 29 | 29 | editInteractionEventSchema_0_2_0_noCode, |
| 30 | 30 | } from "./editInteraction/v0.2.0.js"; |
| 31 | +import { editOutcomeEventAllSchema } from "./editOutcome/index.js"; | |
| 31 | 32 | import { |
| 32 | 33 | editOutcomeEventSchema_0_2_0, |
| 33 | 34 | editOutcomeEventSchema_0_2_0_noCode, |
| @@ -51,6 +52,11 @@ | ||
| 51 | 52 | tokensGeneratedEventSchema_0_2_0, |
| 52 | 53 | tokensGeneratedEventSchema_0_2_0_noCode, |
| 53 | 54 | } from "./tokensGenerated/v0.2.0.js"; |
| 55 | +import { toolUsageEventAllSchema } from "./toolUsage/index.js"; | |
| 56 | +import { | |
| 57 | + toolUsageEventSchema_0_2_0, | |
| 58 | + toolUsageEventSchema_0_2_0_noCode, | |
| 59 | +} from "./toolUsage/v0.2.0.js"; | |
| 54 | 60 | |
| 55 | 61 | const semverRegex = |
| 56 | 62 | /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/; |
| @@ -81,7 +87,9 @@ | ||
| 81 | 87 | tokensGenerated: tokensGeneratedEventAllSchema, |
| 82 | 88 | chatInteraction: chatInteractionEventAllSchema, |
| 83 | 89 | editInteraction: editInteractionEventAllSchema, |
| 90 | + editOutcome: editOutcomeEventAllSchema, | |
| 84 | 91 | nextEdit: nextEditEventAllSchema, |
| 92 | + toolUsage: toolUsageEventAllSchema, | |
| 85 | 93 | }); |
| 86 | 94 | |
| 87 | 95 | // Version and level specific schemas are organized here |
| @@ -109,6 +117,7 @@ | ||
| 109 | 117 | editInteraction: editInteractionEventSchema_0_2_0, |
| 110 | 118 | editOutcome: editOutcomeEventSchema_0_2_0, |
| 111 | 119 | nextEdit: nextEditEventSchema_0_2_0, |
| 120 | + toolUsage: toolUsageEventSchema_0_2_0, | |
| 112 | 121 | }, |
| 113 | 122 | noCode: { |
| 114 | 123 | autocomplete: autocompleteEventSchema_0_2_0_noCode, |
| @@ -118,6 +127,7 @@ | ||
| 118 | 127 | editInteraction: editInteractionEventSchema_0_2_0_noCode, |
| 119 | 128 | editOutcome: editOutcomeEventSchema_0_2_0_noCode, |
| 120 | 129 | nextEdit: nextEditEventSchema_0_2_0_noCode, |
| 130 | + toolUsage: toolUsageEventSchema_0_2_0_noCode, | |
| 121 | 131 | }, |
| 122 | 132 | }, |
| 123 | 133 | }; |
added packages/config-yaml/src/schemas/data/toolUsage/index.ts +12 −0
| @@ -0,0 +1,12 @@ | ||
| 1 | +import { z } from "zod"; | |
| 2 | +import { baseDevDataAllSchema } from "../base.js"; | |
| 3 | + | |
| 4 | +export const toolUsageEventAllSchema = baseDevDataAllSchema.extend({ | |
| 5 | + toolCallId: z.string(), | |
| 6 | + functionName: z.string(), | |
| 7 | + functionArgs: z.string(), | |
| 8 | + toolCallArgs: z.any(), | |
| 9 | + parsedArgs: z.any(), | |
| 10 | + succeeded: z.boolean(), | |
| 11 | + output: z.array(z.any()).optional(), | |
| 12 | +}); |
added packages/config-yaml/src/schemas/data/toolUsage/v0.2.0.ts +27 −0
| @@ -0,0 +1,27 @@ | ||
| 1 | +import { toolUsageEventAllSchema } from "./index.js"; | |
| 2 | + | |
| 3 | +export const toolUsageEventSchema_0_2_0 = toolUsageEventAllSchema.pick({ | |
| 4 | + // base | |
| 5 | + timestamp: true, | |
| 6 | + userId: true, | |
| 7 | + userAgent: true, | |
| 8 | + selectedProfileId: true, | |
| 9 | + eventName: true, | |
| 10 | + schema: true, | |
| 11 | + | |
| 12 | + // tool-usage-specific | |
| 13 | + toolCallId: true, | |
| 14 | + functionName: true, | |
| 15 | + functionArgs: true, | |
| 16 | + toolCallArgs: true, | |
| 17 | + parsedArgs: true, | |
| 18 | + succeeded: true, | |
| 19 | + output: true, | |
| 20 | +}); | |
| 21 | + | |
| 22 | +export const toolUsageEventSchema_0_2_0_noCode = | |
| 23 | + toolUsageEventSchema_0_2_0.omit({ | |
| 24 | + functionArgs: true, | |
| 25 | + parsedArgs: true, | |
| 26 | + output: true, | |
| 27 | + }); |