Skip to content

Commit 742909b

Browse files
committed
feat: include additional ai heartbeat fields
1 parent eaac400 commit 742909b

6 files changed

Lines changed: 3272 additions & 3196 deletions

File tree

coverage/coverage.out

Lines changed: 3194 additions & 3194 deletions
Large diffs are not rendered by default.

models/compat/wakatime/v1/heartbeat.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ type HeartbeatEntry struct {
7878
LineDeletions int `json:"line_deletions"`
7979
LineAdditions int `json:"line_additions"`
8080
CreatedAt time.Time `json:"created_at"`
81-
AILineChanges int `json:"ai_line_changes,omitempty" hash:"ignore"`
82-
HumanLineChanges int `json:"human_line_changes,omitempty" hash:"ignore"`
81+
AILineChanges int `json:"ai_line_changes"`
82+
AISession string `json:"ai_session"`
83+
AIInputTokens int `json:"ai_input_tokens"`
84+
AIOutputTokens int `json:"ai_output_tokens"`
85+
AIPromptLength int `json:"ai_prompt_length"`
86+
HumanLineChanges int `json:"human_line_changes"`
8387
}
8488

8589
func HeartbeatsToCompat(entries []*models.Heartbeat) []*HeartbeatEntry {
@@ -106,6 +110,10 @@ func HeartbeatsToCompat(entries []*models.Heartbeat) []*HeartbeatEntry {
106110
CursorPos: entry.CursorPos,
107111
CreatedAt: entry.CreatedAt.T(),
108112
AILineChanges: entry.AILineChanges,
113+
AISession: entry.AISession,
114+
AIInputTokens: entry.AIInputTokens,
115+
AIOutputTokens: entry.AIOutputTokens,
116+
AIPromptLength: entry.AIPromptLength,
109117
HumanLineChanges: entry.HumanLineChanges,
110118
}
111119
}

models/heartbeat.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ type Heartbeat struct {
4141
LineAdditions int `json:"line_additions,omitempty" hash:"ignore"`
4242
ProjectRootCount int `json:"project_root_count,omitempty" hash:"ignore"`
4343
AILineChanges int `json:"ai_line_changes,omitempty" hash:"ignore"`
44+
AISession string `json:"ai_session,omitempty" hash:"ignore"`
45+
AIInputTokens int `json:"ai_input_tokens,omitempty" hash:"ignore"`
46+
AIOutputTokens int `json:"ai_output_tokens,omitempty" hash:"ignore"`
47+
AIPromptLength int `json:"ai_prompt_length,omitempty" hash:"ignore"`
4448
HumanLineChanges int `json:"human_line_changes,omitempty" hash:"ignore"`
4549
}
4650

static/docs/docs.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,9 +1080,21 @@ const docTemplate = `{
10801080
"models.Heartbeat": {
10811081
"type": "object",
10821082
"properties": {
1083+
"ai_input_tokens": {
1084+
"type": "integer"
1085+
},
10831086
"ai_line_changes": {
10841087
"type": "integer"
10851088
},
1089+
"ai_output_tokens": {
1090+
"type": "integer"
1091+
},
1092+
"ai_prompt_length": {
1093+
"type": "integer"
1094+
},
1095+
"ai_session": {
1096+
"type": "string"
1097+
},
10861098
"branch": {
10871099
"type": "string"
10881100
},
@@ -1307,9 +1319,21 @@ const docTemplate = `{
13071319
"v1.HeartbeatEntry": {
13081320
"type": "object",
13091321
"properties": {
1322+
"ai_input_tokens": {
1323+
"type": "integer"
1324+
},
13101325
"ai_line_changes": {
13111326
"type": "integer"
13121327
},
1328+
"ai_output_tokens": {
1329+
"type": "integer"
1330+
},
1331+
"ai_prompt_length": {
1332+
"type": "integer"
1333+
},
1334+
"ai_session": {
1335+
"type": "string"
1336+
},
13131337
"branch": {
13141338
"type": "string"
13151339
},

static/docs/swagger.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,21 @@
10721072
"models.Heartbeat": {
10731073
"type": "object",
10741074
"properties": {
1075+
"ai_input_tokens": {
1076+
"type": "integer"
1077+
},
10751078
"ai_line_changes": {
10761079
"type": "integer"
10771080
},
1081+
"ai_output_tokens": {
1082+
"type": "integer"
1083+
},
1084+
"ai_prompt_length": {
1085+
"type": "integer"
1086+
},
1087+
"ai_session": {
1088+
"type": "string"
1089+
},
10781090
"branch": {
10791091
"type": "string"
10801092
},
@@ -1299,9 +1311,21 @@
12991311
"v1.HeartbeatEntry": {
13001312
"type": "object",
13011313
"properties": {
1314+
"ai_input_tokens": {
1315+
"type": "integer"
1316+
},
13021317
"ai_line_changes": {
13031318
"type": "integer"
13041319
},
1320+
"ai_output_tokens": {
1321+
"type": "integer"
1322+
},
1323+
"ai_prompt_length": {
1324+
"type": "integer"
1325+
},
1326+
"ai_session": {
1327+
"type": "string"
1328+
},
13051329
"branch": {
13061330
"type": "string"
13071331
},

static/docs/swagger.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ definitions:
1818
type: object
1919
models.Heartbeat:
2020
properties:
21+
ai_input_tokens:
22+
type: integer
2123
ai_line_changes:
2224
type: integer
25+
ai_output_tokens:
26+
type: integer
27+
ai_prompt_length:
28+
type: integer
29+
ai_session:
30+
type: string
2331
branch:
2432
type: string
2533
category:
@@ -185,8 +193,16 @@ definitions:
185193
type: object
186194
v1.HeartbeatEntry:
187195
properties:
196+
ai_input_tokens:
197+
type: integer
188198
ai_line_changes:
189199
type: integer
200+
ai_output_tokens:
201+
type: integer
202+
ai_prompt_length:
203+
type: integer
204+
ai_session:
205+
type: string
190206
branch:
191207
type: string
192208
category:

0 commit comments

Comments
 (0)