@@ -24,7 +24,7 @@ interface Balance {
2424 */
2525export const usage : Command = {
2626 name : "usage" ,
27- description : "Show metered credits and included Codebase turn allowances ." ,
27+ description : "Show metered credits and Codebase turn quotas ." ,
2828 handler : async ( _args , ctx ) => {
2929 ctx . emit ( await fetchUsageReport ( ) ) ;
3030 return { handled : true } ;
@@ -67,18 +67,27 @@ export async function fetchUsageReport(): Promise<string> {
6767 } else {
6868 lines . push ( "Monthly allowance was not returned yet; showing remaining credits only." ) ;
6969 }
70- if ( typeof b . anyBuildsRemaining === "number" && b . anyBuildsRemaining >= 0 ) {
71- lines . push ( `Included web-build turns remaining: ${ b . anyBuildsRemaining . toLocaleString ( ) } ` ) ;
72- }
73- if ( typeof b . cheapBuildsRemaining === "number" && b . cheapBuildsRemaining >= 0 ) {
74- lines . push ( `Included fast coding turns remaining: ${ b . cheapBuildsRemaining . toLocaleString ( ) } ` ) ;
75- }
70+ lines . push ( ...formatTurnQuotas ( b ) ) ;
7671 return lines . join ( "\n" ) ;
7772 } catch ( err ) {
7873 return `Couldn't fetch usage: ${ ( err as Error ) . message } ` ;
7974 }
8075}
8176
77+ export function formatTurnQuotas ( b : Balance ) : string [ ] {
78+ const lines : string [ ] = [ ] ;
79+ if ( typeof b . anyBuildsRemaining === "number" && b . anyBuildsRemaining >= 0 ) {
80+ lines . push ( `Any-model turn quota remaining: ${ b . anyBuildsRemaining . toLocaleString ( ) } ` ) ;
81+ }
82+ if ( typeof b . cheapBuildsRemaining === "number" && b . cheapBuildsRemaining >= 0 ) {
83+ lines . push ( `Low-cost model turn quota remaining: ${ b . cheapBuildsRemaining . toLocaleString ( ) } ` ) ;
84+ }
85+ if ( lines . length > 0 ) {
86+ lines . push ( "Metered runs require both an eligible turn and credits; builds that fail final QA are not charged." ) ;
87+ }
88+ return lines ;
89+ }
90+
8291export function formatUsageBalance ( b : Balance ) : {
8392 creditLine : string ;
8493 days : number | null ;
0 commit comments