File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,7 @@ export type PrintModeText = z.infer<typeof printModeTextSchema>
3838
3939export const printModeFinishSchema = z . object ( {
4040 type : z . literal ( 'finish' ) ,
41- agentId : z . string ( ) ,
42- model : z . string ( ) ,
41+ agentId : z . string ( ) . optional ( ) ,
4342 totalCost : z . number ( ) ,
4443} )
4544export type PrintModeFinish = z . infer < typeof printModeFinishSchema >
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727 yellow ,
2828} from 'picocolors'
2929
30+ import { PrintModeFinish } from '@codebuff/common/types/print-mode'
3031import {
3132 killAllBackgroundProcesses ,
3233 sendKillSignalToAllBackgroundProcesses ,
@@ -1201,6 +1202,17 @@ export class CLI {
12011202 . flat ( )
12021203 . reduce ( ( sum , credits ) => sum + credits , 0 )
12031204
1205+ if ( printModeIsEnabled ( ) ) {
1206+ const finishObj : PrintModeFinish = {
1207+ type : 'finish' ,
1208+ totalCost : totalCreditsUsedThisSession ,
1209+ }
1210+ const agentId = CLI . getInstance ( ) . agent
1211+ if ( agentId ) {
1212+ finishObj . agentId = agentId
1213+ }
1214+ printModeLog ( finishObj )
1215+ }
12041216 let exitUsageMessage = `${ pluralize ( totalCreditsUsedThisSession , 'credit' ) } used this session`
12051217 if ( client . usageData . remainingBalance !== null ) {
12061218 exitUsageMessage += `, ${ client . usageData . remainingBalance . toLocaleString ( ) } credits left.`
You can’t perform that action at this time.
0 commit comments