Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions packages/kilo-telemetry/src/__tests__/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,15 @@ describe("Telemetry", () => {
expect(typeof Telemetry.trackSuggestionShown).toBe("function")
expect(typeof Telemetry.trackSuggestionAccepted).toBe("function")
})

test("trackToolUsed sends Tool Used event with tool name and sessionId", () => {
const capture = spyOn(Client, "capture").mockImplementation(() => {})

try {
Telemetry.trackToolUsed("chart", "session-123")
expect(capture).toHaveBeenCalledWith(TelemetryEvent.TOOL_USED, expect.objectContaining({ tool: "chart", sessionId: "session-123" }))
} finally {
capture.mockRestore()
}
})
})
3 changes: 3 additions & 0 deletions packages/opencode/src/kilocode/tool/chart.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// kilocode_change - new file
import { Effect, Schema } from "effect"
import * as Tool from "../../tool/tool"
import { Telemetry } from "@kilocode/kilo-telemetry"

const Parameters = Schema.Struct({
title: Schema.String.annotate({
Expand Down Expand Up @@ -66,6 +67,8 @@ export const ChartTool = Tool.define(
}
}

Telemetry.trackToolUsed("chart", ctx.sessionID)
Comment thread
cosi-conda marked this conversation as resolved.
Resolved

return {
title: params.title,
output: JSON.stringify(spec),
Expand Down
Loading