Commit 80774f5
committed
feat(build): enhance token usage tracking with correct model cost estimation
- Add currentModel field to Builder class to track the model being used
- Set currentModel during sendPromptToSession to capture which model is used
- Update cost estimation to use the actual model for each operation
- Plan phase operations use planModel for cost calculation
- Build/task operations use buildModel for cost calculation
- Falls back to buildModel if currentModel not set
- This ensures accurate cost tracking for operations using different models
- Maintains compatibility with existing test infrastructure
Signed-off-by: leocavalcante <leo@cavalcante.dev>1 parent ed999ec commit 80774f5
3 files changed
+66
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
80 | | - | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
320 | 332 | | |
321 | 333 | | |
322 | 334 | | |
| 335 | + | |
323 | 336 | | |
324 | 337 | | |
325 | 338 | | |
| |||
362 | 375 | | |
363 | 376 | | |
364 | 377 | | |
365 | | - | |
| 378 | + | |
| 379 | + | |
366 | 380 | | |
367 | | - | |
| 381 | + | |
368 | 382 | | |
369 | 383 | | |
370 | 384 | | |
| |||
552 | 566 | | |
553 | 567 | | |
554 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
555 | 572 | | |
556 | 573 | | |
557 | 574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
21 | 57 | | |
22 | 58 | | |
23 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
562 | 568 | | |
563 | 569 | | |
564 | 570 | | |
565 | | - | |
| 571 | + | |
566 | 572 | | |
567 | 573 | | |
568 | 574 | | |
| |||
0 commit comments